Parent

Class Index [+]

Quicksearch

Treetop::Compiler::Grammar

Public Instance Methods

compile() click to toggle source
    # File lib/treetop/compiler/node_classes/grammar.rb, line 4
 4:       def compile
 5:         builder = RubyBuilder.new
 6:         
 7:         builder.module_declaration "#{grammar_name.text_value}" do
 8:           builder.in(indent_level) # account for initial indentation of grammar declaration
 9:           builder << "include Treetop::Runtime"
10:           builder.newline
11:           declaration_sequence.compile(builder)
12:         end
13:         builder.newline
14:         builder.class_declaration "#{parser_name} < Treetop::Runtime::CompiledParser" do
15:           builder << "include #{grammar_name.text_value}"
16:         end
17:       end
indent_level() click to toggle source
    # File lib/treetop/compiler/node_classes/grammar.rb, line 19
19:       def indent_level
20:         input.column_of(interval.begin) - 1
21:       end
parser_name() click to toggle source
    # File lib/treetop/compiler/node_classes/grammar.rb, line 23
23:       def parser_name
24:         grammar_name.text_value + 'Parser'
25:       end

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.