Class: Rley::SPPF::SPPFNode
- Inherits:
-
Object
- Object
- Rley::SPPF::SPPFNode
- Defined in:
- lib/rley/sppf/sppf_node.rb
Overview
Abstract class. The generalization for all kinds of nodes occurring in a shared packed parse forest (SPPF).
Direct Known Subclasses
Instance Attribute Summary collapse
-
#range ⇒ Lexical::TokenRange
readonly
A range of token indices corresponding to this node.
Instance Method Summary collapse
-
#initialize(aRange) ⇒ SPPFNode
constructor
Constructor.
-
#origin ⇒ Integer
Return the origin, that is, the index of the first token matched by this node.
Constructor Details
#initialize(aRange) ⇒ SPPFNode
Constructor
15 16 17 |
# File 'lib/rley/sppf/sppf_node.rb', line 15 def initialize(aRange) @range = Lexical::TokenRange.new(aRange) end |
Instance Attribute Details
#range ⇒ Lexical::TokenRange (readonly)
A range of token indices corresponding to this node.
11 12 13 |
# File 'lib/rley/sppf/sppf_node.rb', line 11 def range @range end |
Instance Method Details
#origin ⇒ Integer
Return the origin, that is, the index of the first token matched by this node.
22 23 24 |
# File 'lib/rley/sppf/sppf_node.rb', line 22 def origin() return range.low end |