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
16 17 18 |
# File 'lib/rley/sppf/sppf_node.rb', line 16 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.
12 13 14 |
# File 'lib/rley/sppf/sppf_node.rb', line 12 def range @range end |
Instance Method Details
#origin ⇒ Integer
Return the origin, that is, the index of the first token matched by this node.
23 24 25 |
# File 'lib/rley/sppf/sppf_node.rb', line 23 def origin range.low end |