Module: Rattler::BackEnd::ParserGenerator::ListGenerating
- Included in:
- List1Generator, ListGenerator
- Defined in:
- lib/rattler/back_end/parser_generator/list_generating.rb
Instance Method Summary collapse
-
#gen_basic(list, scope = {}) ⇒ Object
:nodoc:.
- #gen_direct_action(list, code, scope = {}) ⇒ Object
- #gen_dispatch_action(list, code, scope = {}) ⇒ Object
Instance Method Details
#gen_basic(list, scope = {}) ⇒ Object
:nodoc:
7 8 9 10 11 12 13 |
# File 'lib/rattler/back_end/parser_generator/list_generating.rb', line 7 def gen_basic(list, scope={}) if list.capturing? expr(:block) { gen_capturing list, scope } else gen_skip list, scope end end |
#gen_direct_action(list, code, scope = {}) ⇒ Object
23 24 25 26 27 28 29 |
# File 'lib/rattler/back_end/parser_generator/list_generating.rb', line 23 def gen_direct_action(list, code, scope={}) expr :block do gen_capturing list, scope do |a| '(' + code.bind(scope, ["select_captures(#{a})"]) + ')' end end end |
#gen_dispatch_action(list, code, scope = {}) ⇒ Object
15 16 17 18 19 20 21 |
# File 'lib/rattler/back_end/parser_generator/list_generating.rb', line 15 def gen_dispatch_action(list, code, scope={}) expr :block do gen_capturing list, scope do |a| code.bind scope, "select_captures(#{a})" end end end |