Class: Rattler::Compiler::ParserGenerator::ApplyGenerator
- Inherits:
-
ExprGenerator
- Object
- ExprGenerator
- Rattler::Compiler::ParserGenerator::ApplyGenerator
show all
- Defined in:
- lib/rattler/compiler/parser_generator/apply_generator.rb
Class Method Summary
collapse
Instance Method Summary
collapse
#gen_intermediate, #gen_intermediate_assert, #gen_intermediate_disallow, #gen_token, #initialize
Class Method Details
.top_level(*args) ⇒ Object
Instance Method Details
#gen_assert(apply, scope = ParserScope.empty) ⇒ Object
12
13
14
15
16
17
18
19
20
|
# File 'lib/rattler/compiler/parser_generator/apply_generator.rb', line 12
def gen_assert(apply, scope = ParserScope.empty)
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 = ParserScope.empty) ⇒ Object
8
9
10
|
# File 'lib/rattler/compiler/parser_generator/apply_generator.rb', line 8
def gen_basic(apply, scope = ParserScope.empty)
@g << "match(:#{apply.rule_name})"
end
|
#gen_disallow(apply, scope = ParserScope.empty) ⇒ Object
22
23
24
25
26
27
28
29
30
|
# File 'lib/rattler/compiler/parser_generator/apply_generator.rb', line 22
def gen_disallow(apply, scope = ParserScope.empty)
expr :block do
lookahead do
@g.surround("#{result_name} = !", '') { gen_basic apply }
@g.newline
end
@g << result_name
end
end
|
36
37
38
|
# File 'lib/rattler/compiler/parser_generator/apply_generator.rb', line 36
def gen_intermediate_skip(apply, scope = ParserScope.empty)
gen_basic apply
end
|
#gen_skip(apply, scope = ParserScope.empty) ⇒ Object
32
33
34
|
# File 'lib/rattler/compiler/parser_generator/apply_generator.rb', line 32
def gen_skip(apply, scope = ParserScope.empty)
expr { gen_bare_skip apply }
end
|