Class: Rattler::BackEnd::ParserGenerator::GroupMatchGenerator

Inherits:
ExprGenerator
  • Object
show all
Includes:
PredicatePropogating, SkipPropogating, TokenPropogating
Defined in:
lib/rattler/back_end/parser_generator/group_match_generator.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods included from SkipPropogating

#gen_intermediate_skip, #gen_skip

Methods included from TokenPropogating

#gen_token

Methods included from PredicatePropogating

#gen_assert, #gen_disallow, #gen_intermediate_assert, #gen_intermediate_disallow

Methods inherited from ExprGenerator

#gen_intermediate, #gen_intermediate_assert, #gen_intermediate_disallow, #gen_intermediate_skip, #gen_token, #initialize

Methods included from Parsers

define

Constructor Details

This class inherits a constructor from Rattler::BackEnd::ParserGenerator::ExprGenerator

Class Method Details

.nested(*args) ⇒ Object



55
56
57
# File 'lib/rattler/back_end/parser_generator/group_match_generator.rb', line 55

def GroupMatchGenerator.nested(*args)
  NestedGroupMatchGenerator.new(*args)
end

.top_level(*args) ⇒ Object



65
66
67
# File 'lib/rattler/back_end/parser_generator/group_match_generator.rb', line 65

def GroupMatchGenerator.top_level(*args)
  TopLevelGroupMatchGenerator.new(*args)
end

Instance Method Details

#gen_basic(group_match, scope = {}) ⇒ Object



11
12
13
# File 'lib/rattler/back_end/parser_generator/group_match_generator.rb', line 11

def gen_basic(group_match, scope={})
  expr(:block) { gen_capture group_match, result_expr(group_match) }
end

#gen_direct_action(group_match, code, scope = {}) ⇒ Object



22
23
24
25
26
# File 'lib/rattler/back_end/parser_generator/group_match_generator.rb', line 22

def gen_direct_action(group_match, code, scope={})
  expr :block do
    gen_capture group_match, "(#{code.bind(scope, group_exprs(group_match))})"
  end
end

#gen_dispatch_action(group_match, code, scope = {}) ⇒ Object



15
16
17
18
19
20
# File 'lib/rattler/back_end/parser_generator/group_match_generator.rb', line 15

def gen_dispatch_action(group_match, code, scope={})
  expr :block do
    gen_capture group_match,
      code.bind(scope, "[#{group_exprs(group_match).join ', '}]")
  end
end