Class: Rattler::BackEnd::ParserGenerator::ApplyGenerator
- Inherits:
-
ExprGenerator
- Object
- ExprGenerator
- Rattler::BackEnd::ParserGenerator::ApplyGenerator
show all
- Defined in:
- lib/rattler/back_end/parser_generator/apply_generator.rb
Class Method Summary
collapse
Instance Method Summary
collapse
#gen_intermediate, #gen_intermediate_assert, #gen_intermediate_disallow, #gen_token, #initialize
Methods included from Parsers
define
Class Method Details
.top_level(*args) ⇒ Object
Instance Method Details
#gen_assert(apply, scope = {}) ⇒ Object
12
13
14
15
16
17
18
19
20
|
# File 'lib/rattler/back_end/parser_generator/apply_generator.rb', line 12
def gen_assert(apply, scope={})
expr :block do
lookahead do
@g.surround("#{result_name} = (", ')') { gen_bare_skip apply }
@g.newline
end
@g << result_name
end
end
|
#gen_basic(apply, scope = {}) ⇒ Object
8
9
10
|
# File 'lib/rattler/back_end/parser_generator/apply_generator.rb', line 8
def gen_basic(apply, scope={})
@g << "match(:#{apply.rule_name})"
end
|
#gen_direct_action(apply, code, scope = {}) ⇒ Object
39
40
41
42
43
44
|
# File 'lib/rattler/back_end/parser_generator/apply_generator.rb', line 39
def gen_direct_action(apply, code, scope={})
expr do
gen_capture { gen_basic apply }
@g << ' && (' << code.bind(scope, direct_action_args) << ')'
end
end
|
#gen_disallow(apply, scope = {}) ⇒ Object
22
23
24
25
26
27
28
29
30
|
# File 'lib/rattler/back_end/parser_generator/apply_generator.rb', line 22
def gen_disallow(apply, scope={})
expr :block do
lookahead do
@g.surround("#{result_name} = !", '') { gen_basic apply }
@g.newline
end
@g << result_name
end
end
|
#gen_dispatch_action(apply, code, scope = {}) ⇒ Object
32
33
34
35
36
37
|
# File 'lib/rattler/back_end/parser_generator/apply_generator.rb', line 32
def gen_dispatch_action(apply, code, scope={})
expr do
gen_capture { gen_basic apply }
@g << ' && ' << code.bind(scope, dispatch_action_args)
end
end
|
50
51
52
|
# File 'lib/rattler/back_end/parser_generator/apply_generator.rb', line 50
def gen_intermediate_skip(apply, scope={})
gen_basic apply
end
|
#gen_skip(apply, scope = {}) ⇒ Object
46
47
48
|
# File 'lib/rattler/back_end/parser_generator/apply_generator.rb', line 46
def gen_skip(apply, scope={})
expr { gen_bare_skip apply }
end
|