class Rley::PTree::ParseTreeNode
Attributes
A range of indices for tokens corresponding to the node.
Link to the grammar symbol
Public Class Methods
Source
# File lib/rley/ptree/parse_tree_node.rb, line 14 def initialize(aSymbol, aRange) @symbol = aSymbol @range = Lexical::TokenRange.new(aRange) end
Public Instance Methods
Source
# File lib/rley/ptree/parse_tree_node.rb, line 43 def accept(aVisitor) raise NotImplementedError end
Part of the ‘visitee’ role in Visitor design pattern. @param aVisitor the visitor
Source
# File lib/rley/ptree/parse_tree_node.rb, line 20 def done! # Do nothing end
Notify the builder that the construction is over
Source
# File lib/rley/ptree/parse_tree_node.rb, line 25 def range=(aRange) range.assign(aRange) end
Assign a value from given range to each undefined range bound
Source
# File lib/rley/ptree/parse_tree_node.rb, line 37 def to_s "#{symbol.name}#{range.to_string(0)}" end
Emit a short string representation of the node. Mainly used for diagnosis/debugging purposes.
Source
# File lib/rley/ptree/parse_tree_node.rb, line 31 def to_string(indentation) "#{symbol.name}#{range.to_string(indentation)}" end
Emit a (formatted) string representation of the node. Mainly used for diagnosis/debugging purposes.