Module: Rattler::Compiler::ParserGenerator::OneOrMoreGenerating

Includes:
PredicatePropogating
Defined in:
lib/rattler/compiler/parser_generator/one_or_more_generating.rb

Instance Method Summary collapse

Methods included from PredicatePropogating

#gen_assert, #gen_disallow, #gen_intermediate_assert, #gen_intermediate_disallow

Instance Method Details

#gen_skip(one_or_more, scope = ParserScope.empty) ⇒ Object



8
9
10
11
12
13
14
15
16
# File 'lib/rattler/compiler/parser_generator/one_or_more_generating.rb', line 8

def gen_skip(one_or_more, scope = ParserScope.empty)
  expr :block do
    (@g << "#{result_name} = false").newline
    @g << 'while '
    generate one_or_more.child, :intermediate_skip, scope
    @g.block('') { @g << "#{result_name} = true" }.newline
    @g << result_name
  end
end