Class Index [+]

Quicksearch

Treetop::Compiler::CharacterClass

Public Instance Methods

compile(address, builder, parent_expression = nil) click to toggle source
    # File lib/treetop/compiler/node_classes/character_class.rb, line 4
 4:       def compile(address, builder, parent_expression = nil)
 5:         super
 6:         
 7:         builder.if__ "has_terminal?(#{grounded_regexp(text_value)}, true, index)" do
 8:           if address == 0 || decorated?
 9:             assign_result "instantiate_node(#{node_class_name},input, index...(index + 1))"
10:             extend_result_with_inline_module
11:           else
12:             assign_lazily_instantiated_node
13:           end
14:           builder << "@index += 1"
15:         end
16:         builder.else_ do
17:           # "terminal_parse_failure(#{single_quote(characters)})"
18:           assign_result 'nil'
19:         end
20:       end
grounded_regexp(string) click to toggle source
    # File lib/treetop/compiler/node_classes/character_class.rb, line 22
22:       def grounded_regexp(string)
23:         # Double any backslashes, then backslash any single-quotes:
24:         "'\\G#{string.gsub(/\\/) { '\\\\' }.gsub(/'/) { "\\'"}}'"
25:       end

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.