Class: Treetop::Compiler::DeclarationSequence
- Inherits:
-
Runtime::SyntaxNode
- Object
- Runtime::SyntaxNode
- Treetop::Compiler::DeclarationSequence
- Defined in:
- lib/treetop/compiler/node_classes/declaration_sequence.rb
Instance Attribute Summary
Attributes inherited from Runtime::SyntaxNode
Instance Method Summary collapse
Methods inherited from Runtime::SyntaxNode
#<=>, #dot_id, #elements, #empty?, #extension_modules, #initialize, #inspect, #inspect_children, #inspect_self, #nonterminal?, #terminal?, #text_value, #write_dot, #write_dot_file
Constructor Details
This class inherits a constructor from Treetop::Runtime::SyntaxNode
Instance Method Details
#compile(builder) ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/treetop/compiler/node_classes/declaration_sequence.rb', line 5 def compile(builder) unless rules.empty? builder.method_declaration("root") do builder << "@root ||= :#{rules.first.name}" end builder.newline end declarations.each do |declaration| declaration.compile(builder) builder.newline end end |
#rules ⇒ Object
19 20 21 |
# File 'lib/treetop/compiler/node_classes/declaration_sequence.rb', line 19 def rules declarations.select { |declaration| declaration.instance_of?(ParsingRule) } end |