Sha256: a59371f07b8c056c69470efe5b44ae19f380a2da014526c7f0fef1c436dd91fa

Contents?: true

Size: 1.02 KB

Versions: 3

Compression:

Stored size: 1.02 KB

Contents

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
    
      # GFG vertex label
      attr_reader(:label)
      
      # Link to lhs symbol
      attr_reader(:symbol)
      
      # @param aVertex [ItemVertex] An GFG vertex that corresponds 
      # a dotted item (with the dot at the end)for the alternative under
      # consideration.
      # @param aRange [TokenRange]
      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.
      def to_string(indentation)
        return "Alt(#{label})#{range.to_string(indentation)}"
      end

    end # class
  end # module
end # module
# End of file

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
rley-0.3.04 lib/rley/sppf/alternative_node.rb
rley-0.3.01 lib/rley/sppf/alternative_node.rb
rley-0.3.00 lib/rley/sppf/alternative_node.rb