Sha256: 859eb5022d293a98b753266e5d038cf29a621d034b56c88d14ce0dcc0a43bbf6

Contents?: true

Size: 816 Bytes

Versions: 11

Compression:

Stored size: 816 Bytes

Contents

# frozen_string_literal: true

require_relative '../lexical/token_range'

module Rley # This module is used as a namespace
  module SPPF # This module is used as a namespace
    # Abstract class. The generalization for all kinds of nodes
    # occurring in a shared packed parse forest (SPPF).
    class SPPFNode
      # @return [Lexical::TokenRange]
      # A range of token indices corresponding to this node.
      attr_reader(:range)

      # Constructor
      # @param aRange [Lexical::TokenRange]
      def initialize(aRange)
        @range = Lexical::TokenRange.new(aRange)
      end

      # Return the origin, that is, the index of the
      # first token matched by this node.
      # @return [Integer]
      def origin
        range.low
      end
    end # class
  end # module
end # module
# End of file

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
rley-0.8.11 lib/rley/sppf/sppf_node.rb
rley-0.8.10 lib/rley/sppf/sppf_node.rb
rley-0.8.09 lib/rley/sppf/sppf_node.rb
rley-0.8.08 lib/rley/sppf/sppf_node.rb
rley-0.8.06 lib/rley/sppf/sppf_node.rb
rley-0.8.05 lib/rley/sppf/sppf_node.rb
rley-0.8.03 lib/rley/sppf/sppf_node.rb
rley-0.8.02 lib/rley/sppf/sppf_node.rb
rley-0.8.01 lib/rley/sppf/sppf_node.rb
rley-0.8.00 lib/rley/sppf/sppf_node.rb
rley-0.7.08 lib/rley/sppf/sppf_node.rb