Class: Dendroid::Parsing::ParseNode
- Inherits:
-
Object
- Object
- Dendroid::Parsing::ParseNode
- Defined in:
- lib/dendroid/parsing/parse_node.rb
Overview
An abstract class (i.e. a generalization) for elements forming a parse tree (forest). A parse tree is a graph data structure that represents the parsed input text into a tree-like hierarchy of elements constructed by applying syntax rules of the language at hand. A parse forest is a data structure that merges a number parse trees into one graph. Contrary to parse trees, a parse forests can represent the results of an ambiguous parsing.
Direct Known Subclasses
Instance Attribute Summary collapse
-
#range ⇒ Range
readonly
The range of indexes of the input tokens that match this node.
Instance Method Summary collapse
-
#initialize(lowerBound, upperBound) ⇒ ParseNode
constructor
A new instance of ParseNode.
Constructor Details
#initialize(lowerBound, upperBound) ⇒ ParseNode
Returns a new instance of ParseNode.
20 21 22 |
# File 'lib/dendroid/parsing/parse_node.rb', line 20 def initialize(lowerBound, upperBound) @range = valid_range(lowerBound, upperBound) end |
Instance Attribute Details
#range ⇒ Range (readonly)
Returns The range of indexes of the input tokens that match this node.
16 17 18 |
# File 'lib/dendroid/parsing/parse_node.rb', line 16 def range @range end |