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