Constructor
new Node(symbol, pos) → {Node}
Parameters:
Name | Type | Description |
---|---|---|
symbol |
type | |
pos |
type | Position in the expression's string |
Returns:
- Type
- Node
Methods
figureOrder()
Counts the order; traverses the syntax tree in depth-first preordering
findNode(symbolPos)
Returns the node having its symbol on particular position in the expression's string
Parameters:
Name | Type | Description |
---|---|---|
symbolPos |
type |
Returns:
insertChild(node)
Appends child node
Parameters:
Name | Type | Description |
---|---|---|
node |
Node |
setRule(rule)
Updates the syntax tree when a rule is applied
Parameters:
Name | Type | Description |
---|---|---|
rule |
Rule |
toString(parentheses) → {String}
Generates string from the syntax tree; recursive
Parameters:
Name | Type | Description |
---|---|---|
parentheses |
type |
Returns:
- Type
- String
updatePos(pos, shift) → {undefined}
Recursively updates position when a node is inserted
Parameters:
Name | Type | Description |
---|---|---|
pos |
type | |
shift |
type |
Returns:
- Type
- undefined