Class: Node

Node

Syntax tree node

Constructor

new Node(symbol, pos) → {Node}

Parameters:
Name Type Description
symbol type
pos type Position in the expression's string
Source:
Returns:
Type
Node

Methods

figureOrder()

Counts the order; traverses the syntax tree in depth-first preordering
Source:

findNode(symbolPos)

Returns the node having its symbol on particular position in the expression's string
Parameters:
Name Type Description
symbolPos type
Source:
Returns:

insertChild(node)

Appends child node
Parameters:
Name Type Description
node Node
Source:

setRule(rule)

Updates the syntax tree when a rule is applied
Parameters:
Name Type Description
rule Rule
Source:

toString(parentheses) → {String}

Generates string from the syntax tree; recursive
Parameters:
Name Type Description
parentheses type
Source:
Returns:
Type
String

updatePos(pos, shift) → {undefined}

Recursively updates position when a node is inserted
Parameters:
Name Type Description
pos type
shift type
Source:
Returns:
Type
undefined