Class: Rley::SPPF::EpsilonNode
- Defined in:
- lib/rley/sppf/epsilon_node.rb
Overview
A leaf node in a parse forest that matches an empty string from the input
Instance Attribute Summary
Attributes inherited from SPPFNode
Instance Method Summary collapse
-
#initialize(aPosition) ⇒ EpsilonNode
constructor
aPosition is the position of the token in the input stream.
- #key ⇒ Object
-
#to_string(indentation) ⇒ Object
Emit a (formatted) string representation of the node.
Methods inherited from SPPFNode
Constructor Details
#initialize(aPosition) ⇒ EpsilonNode
aPosition is the position of the token in the input stream.
9 10 11 12 |
# File 'lib/rley/sppf/epsilon_node.rb', line 9 def initialize(aPosition) range = { low: aPosition, high: aPosition } super(range) end |
Instance Method Details
#key ⇒ Object
20 21 22 |
# File 'lib/rley/sppf/epsilon_node.rb', line 20 def key() @key ||= to_string(0) end |
#to_string(indentation) ⇒ Object
Emit a (formatted) string representation of the node. Mainly used for diagnosis/debugging purposes.
16 17 18 |
# File 'lib/rley/sppf/epsilon_node.rb', line 16 def to_string(indentation) return "_#{range.to_string(indentation)}" end |