Class: SrlRuby::ASTBuilder
- Inherits:
-
Rley::ParseRep::ASTBaseBuilder
- Object
- Rley::ParseRep::ASTBaseBuilder
- SrlRuby::ASTBuilder
- Defined in:
- lib/srl_ruby/ast_builder.rb
Overview
The purpose of a ASTBuilder is to build piece by piece an AST (Abstract Syntax Tree) from a sequence of input tokens and visit events produced by walking over a GFGParsing object. Uses the Builder GoF pattern. The Builder pattern creates a complex object (say, a parse tree) from simpler objects (terminal and non-terminal nodes) and using a step by step approach.
Constant Summary collapse
- Terminal2NodeClass =
{}.freeze
Instance Attribute Summary collapse
-
#options ⇒ Object
readonly
Returns the value of attribute options.
Instance Method Summary collapse
-
#done! ⇒ Object
Notification that the parse tree construction is complete.
-
#initialize(theTokens) ⇒ ASTBuilder
constructor
Create a new AST builder instance.
Constructor Details
#initialize(theTokens) ⇒ ASTBuilder
Create a new AST builder instance.
19 20 21 22 |
# File 'lib/srl_ruby/ast_builder.rb', line 19 def initialize(theTokens) super(theTokens) @options = [] end |
Instance Attribute Details
#options ⇒ Object (readonly)
Returns the value of attribute options.
15 16 17 |
# File 'lib/srl_ruby/ast_builder.rb', line 15 def @options end |
Instance Method Details
#done! ⇒ Object
Notification that the parse tree construction is complete.
25 26 27 28 |
# File 'lib/srl_ruby/ast_builder.rb', line 25 def done! super end |