Skip to content

Commit

Permalink
refactor: 💡 add missing comments of label and type of tree
Browse files Browse the repository at this point in the history
  • Loading branch information
Xanonymous-GitHub committed Jul 25, 2024
1 parent 5c87e4d commit 9566647
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
7 changes: 7 additions & 0 deletions core/src/main/kotlin/tw/xcc/gumtree/model/GumTree.kt
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,19 @@ import java.util.concurrent.atomic.AtomicReference

class GumTree(
type: TreeType,
/**
* The Label corresponds to the actual tokens in the code.
* */
var label: String = EMPTY_LABEL
) : BasicTree<GumTree>(), Comparable<GumTree> {
var pos: Int = -1
var length: Int = -1

private val _type = AtomicReference(TreeType.empty())

/**
* The Type corresponds to the name of their production rule in the grammar.
* */
val type: TreeType
get() = _type.get()

Expand Down
4 changes: 4 additions & 0 deletions core/src/main/kotlin/tw/xcc/gumtree/model/TreeType.kt
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
package tw.xcc.gumtree.model

/**
* TreeType corresponds to the name of their production rule in the grammar of an AST.
* e.g. `IfStatement`, `FunctionStatement`
* */
data class TreeType(val name: String) {
fun isEmpty(): Boolean = name.isEmpty()

Expand Down

0 comments on commit 9566647

Please sign in to comment.