Sha256: 046c19fb8ef1a7617b45392e0289f27e3c0afb49109850b1427f5476414e222f
Contents?: true
Size: 1.36 KB
Versions: 4
Compression:
Stored size: 1.36 KB
Contents
# frozen_string_literal: true require_relative 'composite_node' module Rley # This module is used as a namespace module SPPF # This module is used as a namespace # A node in a parse forest that is a child # of a parent node with :or refinement class AlternativeNode < CompositeNode # @return [String] GFG vertex label attr_reader(:label) # @return [Syntax::NonTerminal] Link to lhs symbol attr_reader(:symbol) # @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. def initialize(aVertex, aRange) super(aRange) @label = aVertex.label @symbol = aVertex.dotted_item.lhs end # Emit a (formatted) string representation of the node. # Mainly used for diagnosis/debugging purposes. # @return [String] def to_string(indentation) return "Alt(#{label})#{range.to_string(indentation)}" end # Part of the 'visitee' role in Visitor design pattern. # @param aVisitor[ParseTreeVisitor] the visitor def accept(aVisitor) aVisitor.visit_alternative(self) end end # class end # module end # module # End of file
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
rley-0.7.07 | lib/rley/sppf/alternative_node.rb |
rley-0.7.06 | lib/rley/sppf/alternative_node.rb |
rley-0.7.05 | lib/rley/sppf/alternative_node.rb |
rley-0.7.04 | lib/rley/sppf/alternative_node.rb |