Module: Rattler::Compiler::ParserGenerator::ZeroOrMoreGenerating

Defined in:
lib/rattler/compiler/parser_generator/zero_or_more_generating.rb

Instance Method Summary collapse

Instance Method Details

#gen_assert(zero_or_more, scope = ParserScope.empty) ⇒ Object

:nodoc:



7
8
9
# File 'lib/rattler/compiler/parser_generator/zero_or_more_generating.rb', line 7

def gen_assert(zero_or_more, scope = ParserScope.empty)
  @g << 'true'
end

#gen_disallow(zero_or_more, scope = ParserScope.empty) ⇒ Object



11
12
13
# File 'lib/rattler/compiler/parser_generator/zero_or_more_generating.rb', line 11

def gen_disallow(zero_or_more, scope = ParserScope.empty)
  @g << 'false'
end

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



15
16
17
18
19
20
21
22
# File 'lib/rattler/compiler/parser_generator/zero_or_more_generating.rb', line 15

def gen_skip(zero_or_more, scope = ParserScope.empty)
  expr :block do
    @g << 'while '
    generate zero_or_more.child, :intermediate_skip, scope
    (@g << '; end').newline
    @g << 'true'
  end
end