Class: Treetop::Compiler::InlineModule

Inherits:
Runtime::SyntaxNode show all
Includes:
InlineModuleMixin
Defined in:
lib/gems/treetop-1.2.4/lib/treetop/compiler/node_classes/inline_module.rb

Instance Attribute Summary

Attributes included from InlineModuleMixin

#module_name

Attributes inherited from Runtime::SyntaxNode

#elements, #input, #interval, #parent

Instance Method Summary collapse

Methods inherited from Runtime::SyntaxNode

#empty?, #extension_modules, #initialize, #inspect, #nonterminal?, #terminal?, #text_value

Constructor Details

This class inherits a constructor from Treetop::Runtime::SyntaxNode

Instance Method Details

#compile(index, rule, builder) ⇒ Object



15
16
17
18
19
20
# File 'lib/gems/treetop-1.2.4/lib/treetop/compiler/node_classes/inline_module.rb', line 15

def compile(index, rule, builder)
  super
  builder.module_declaration(module_name) do
    builder << ruby_code.gsub(/\A\n/, '').rstrip
  end
end

#ruby_codeObject



22
23
24
# File 'lib/gems/treetop-1.2.4/lib/treetop/compiler/node_classes/inline_module.rb', line 22

def ruby_code
  elements[1].text_value
end