class Rley::SPPF::AlternativeNode
A node in a parse forest that is a child of a parent node with :or refinement
Attributes
@return [Syntax::NonTerminal] Link to lhs symbol
Public Class Methods
Source
# File lib/rley/sppf/alternative_node.rb, line 21 def initialize(aVertex, aRange) super(aRange) @label = aVertex.label @symbol = aVertex.dotted_item.lhs end
@param aVertex [GFG::ItemVertex]
A GFG vertex that corresponds to a dotted item with the dot at the end) for the alternative under consideration.
@param aRange [Lexical::TokenRange]
A range of token indices corresponding to this node.
Calls superclass method
Rley::SPPF::CompositeNode::new
Public Instance Methods
Source
# File lib/rley/sppf/alternative_node.rb, line 36 def accept(aVisitor) aVisitor.visit_alternative(self) end
Part of the ‘visitee’ role in Visitor design pattern. @param aVisitor the visitor
Source
# File lib/rley/sppf/alternative_node.rb, line 30 def to_string(indentation) "Alt(#{label})#{range.to_string(indentation)}" end
Emit a (formatted) string representation of the node. Mainly used for diagnosis/debugging purposes. @return [String]