Class: Rattler::Compiler::ParserGenerator::NodeActionGenerator
- Inherits:
-
ExprGenerator
- Object
- ExprGenerator
- Rattler::Compiler::ParserGenerator::NodeActionGenerator
show all
- Defined in:
- lib/rattler/compiler/parser_generator/node_action_generator.rb
Class Method Summary
collapse
Instance Method Summary
collapse
#gen_intermediate, #gen_intermediate_assert, #gen_intermediate_disallow, #gen_intermediate_skip, #initialize
Class Method Details
.top_level(*args) ⇒ Object
Instance Method Details
#gen_assert(action, scope = ParserScope.empty) ⇒ Object
12
13
14
|
# File 'lib/rattler/compiler/parser_generator/node_action_generator.rb', line 12
def gen_assert(action, scope = ParserScope.empty)
expr { @g.suffix(' && true') { gen_basic action, scope } }
end
|
#gen_basic(action, scope = ParserScope.empty) ⇒ Object
8
9
10
|
# File 'lib/rattler/compiler/parser_generator/node_action_generator.rb', line 8
def gen_basic(action, scope = ParserScope.empty)
@g << action.bindable_code.bind(scope)
end
|
#gen_disallow(action, scope = ParserScope.empty) ⇒ Object
16
17
18
19
|
# File 'lib/rattler/compiler/parser_generator/node_action_generator.rb', line 16
def gen_disallow(action, scope = ParserScope.empty)
@g << '!'
gen_basic action, scope
end
|
#gen_skip(action, scope = ParserScope.empty) ⇒ Object
25
26
27
|
# File 'lib/rattler/compiler/parser_generator/node_action_generator.rb', line 25
def gen_skip(action, scope = ParserScope.empty)
expr { @g.suffix('; true') { gen_basic action, scope } }
end
|
#gen_token(action, scope = ParserScope.empty) ⇒ Object
21
22
23
|
# File 'lib/rattler/compiler/parser_generator/node_action_generator.rb', line 21
def gen_token(action, scope = ParserScope.empty)
@g.suffix('.to_s') { gen_basic action, scope }
end
|