Class: Rley::Notation::ASTNode
- Inherits:
-
Object
- Object
- Rley::Notation::ASTNode
- Defined in:
- lib/rley/notation/ast_node.rb
Overview
Abstract class. Instances of its subclasses represent nodes of an abstract syntax tree that is the product of the parse of an input text.
Direct Known Subclasses
Instance Attribute Summary collapse
- #annotation ⇒ Hash
-
#position ⇒ Rley::Lexical::Position
readonly
Position of the entry in the input stream.
- #repetition ⇒ Symbol
Instance Method Summary collapse
-
#accept(_visitor) ⇒ Object
Abstract method (must be overriden in subclasses).
-
#done! ⇒ Object
Notification that the parsing has successfully completed.
-
#initialize(aPosition) ⇒ ASTNode
constructor
A new instance of ASTNode.
Constructor Details
#initialize(aPosition) ⇒ ASTNode
Returns a new instance of ASTNode.
19 20 21 22 23 |
# File 'lib/rley/notation/ast_node.rb', line 19 def initialize(aPosition) @position = aPosition @repetition = :exactly_one @annotation = {} end |
Instance Attribute Details
#annotation ⇒ Hash
16 17 18 |
# File 'lib/rley/notation/ast_node.rb', line 16 def annotation @annotation end |
#position ⇒ Rley::Lexical::Position (readonly)
Returns Position of the entry in the input stream.
10 11 12 |
# File 'lib/rley/notation/ast_node.rb', line 10 def position @position end |
#repetition ⇒ Symbol
13 14 15 |
# File 'lib/rley/notation/ast_node.rb', line 13 def repetition @repetition end |
Instance Method Details
#accept(_visitor) ⇒ Object
Abstract method (must be overriden in subclasses). Part of the 'visitee' role in Visitor design pattern.
39 40 41 |
# File 'lib/rley/notation/ast_node.rb', line 39 def accept(_visitor) raise NotImplementedError end |
#done! ⇒ Object
Notification that the parsing has successfully completed
32 33 34 |
# File 'lib/rley/notation/ast_node.rb', line 32 def done! # Default: do nothing ... end |