class Rley::PTree::TerminalNode
Attributes
@return [Lexical::Token] the input token
Public Class Methods
Source
# File lib/rley/ptree/terminal_node.rb, line 13 def initialize(aToken, aPos) # (major, minor) = # Use '1.class' trick to support both Integer and Fixnum classes range = aPos.is_a?(1.class) ? { low: aPos, high: aPos + 1 } : aPos super(aToken.terminal, range) @token = aToken end
@param aToken [Lexical::Token] Input Token object @param aPos [Integer] position of the token in the input stream.
Calls superclass method
Rley::PTree::ParseTreeNode::new
Public Instance Methods
Source
# File lib/rley/ptree/terminal_node.rb, line 36 def accept(aVisitor) aVisitor.visit_terminal(self) end
Part of the ‘visitee’ role in Visitor design pattern. @param aVisitor the visitor
Source
# File lib/rley/ptree/terminal_node.rb, line 30 def to_s return super + ": '#{token.lexeme}'" end
Emit a short string representation of the node. Mainly used for diagnosis/debugging purposes.
Calls superclass method
Rley::PTree::ParseTreeNode#to_s
Source
# File lib/rley/ptree/terminal_node.rb, line 24 def to_string(indentation) return super + ": '#{token.lexeme}'" end
Emit a (formatted) string representation of the node. Mainly used for diagnosis/debugging purposes.
Calls superclass method
Rley::PTree::ParseTreeNode#to_string