Parent

Class Index [+]

Quicksearch

Treetop::Compiler::RubyBuilder

Attributes

level[R]
address_space[R]
ruby[R]

Public Class Methods

new() click to toggle source
    # File lib/treetop/compiler/ruby_builder.rb, line 9
 9:       def initialize
10:         @level = 0
11:         @address_space = LexicalAddressSpace.new
12:         @ruby = ""
13:       end

Public Instance Methods

<<(ruby_line) click to toggle source
    # File lib/treetop/compiler/ruby_builder.rb, line 15
15:       def <<(ruby_line)              
16:         return if ruby_line.blank?
17:         ruby << ruby_line.tabto(level) << "\n"
18:       end
accumulate(left, right) click to toggle source
    # File lib/treetop/compiler/ruby_builder.rb, line 60
60:       def accumulate(left, right)
61:         self << "#{left} << #{right}"
62:       end
assign(left, right) click to toggle source
    # File lib/treetop/compiler/ruby_builder.rb, line 48
48:       def assign(left, right)
49:         if left.instance_of? Array
50:           self << "#{left.join(', ')} = #{right.join(', ')}"
51:         else
52:           self << "#{left} = #{right}"
53:         end
54:       end
break() click to toggle source
    # File lib/treetop/compiler/ruby_builder.rb, line 86
86:       def break
87:         self << 'break'
88:       end
class_declaration(name, &block) click to toggle source
    # File lib/treetop/compiler/ruby_builder.rb, line 30
30:       def class_declaration(name, &block)
31:         self << "class #{name}"
32:         indented(&block)
33:         self << "end"
34:       end
else_(&block) click to toggle source
    # File lib/treetop/compiler/ruby_builder.rb, line 74
74:       def else_(&block)
75:         self << 'else'
76:         indented(&block)
77:         self << 'end'
78:       end
extend(var, module_name) click to toggle source
    # File lib/treetop/compiler/ruby_builder.rb, line 56
56:       def extend(var, module_name)
57:         self << "#{var}.extend(#{module_name})"
58:       end
if_(condition, &block) click to toggle source
    # File lib/treetop/compiler/ruby_builder.rb, line 69
69:       def if_(condition, &block)
70:         if__(condition, &block)
71:         self << 'end'
72:       end
if__(condition, &block) click to toggle source
    # File lib/treetop/compiler/ruby_builder.rb, line 64
64:       def if__(condition, &block)
65:         self << "if #{condition}"
66:         indented(&block)
67:       end
in(depth = 2) click to toggle source
    # File lib/treetop/compiler/ruby_builder.rb, line 90
90:       def in(depth = 2)
91:         @level += depth
92:         self
93:       end
indented(depth = 2) click to toggle source
    # File lib/treetop/compiler/ruby_builder.rb, line 24
24:       def indented(depth = 2)
25:         self.in(depth)
26:         yield
27:         self.out(depth)
28:       end
loop(&block) click to toggle source
    # File lib/treetop/compiler/ruby_builder.rb, line 80
80:       def loop(&block)
81:         self << 'loop do'
82:         indented(&block)
83:         self << 'end'
84:       end
method_declaration(name, &block) click to toggle source
    # File lib/treetop/compiler/ruby_builder.rb, line 42
42:       def method_declaration(name, &block)
43:         self << "def #{name}"
44:         indented(&block)
45:         self << "end"
46:       end
module_declaration(name, &block) click to toggle source
    # File lib/treetop/compiler/ruby_builder.rb, line 36
36:       def module_declaration(name, &block)
37:         self << "module #{name}"
38:         indented(&block)
39:         self << "end"
40:       end
newline() click to toggle source
    # File lib/treetop/compiler/ruby_builder.rb, line 20
20:       def newline
21:         ruby << "\n"
22:       end
next_address() click to toggle source
     # File lib/treetop/compiler/ruby_builder.rb, line 100
100:       def next_address
101:         address_space.next_address
102:       end
out(depth = 2) click to toggle source
    # File lib/treetop/compiler/ruby_builder.rb, line 95
95:       def out(depth = 2)
96:         @level -= depth
97:         self
98:       end
reset_addresses() click to toggle source
     # File lib/treetop/compiler/ruby_builder.rb, line 104
104:       def reset_addresses
105:         address_space.reset_addresses
106:       end

Private Instance Methods

indent() click to toggle source
     # File lib/treetop/compiler/ruby_builder.rb, line 110
110:       def indent
111:         " " * level
112:       end

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.