Class: Rattler::BackEnd::ParserGenerator::EofGenerator

Inherits:
ExprGenerator
  • Object
show all
Defined in:
lib/rattler/back_end/parser_generator/eof_generator.rb

Direct Known Subclasses

NestedEofGenerator, TopLevelEofGenerator

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from ExprGenerator

#gen_intermediate, #gen_intermediate_assert, #gen_intermediate_disallow, #gen_intermediate_skip, #initialize

Methods included from Parsers

define

Constructor Details

This class inherits a constructor from Rattler::BackEnd::ParserGenerator::ExprGenerator

Class Method Details

.nested(*args) ⇒ Object



45
46
47
# File 'lib/rattler/back_end/parser_generator/eof_generator.rb', line 45

def EofGenerator.nested(*args)
  NestedEofGenerator.new(*args)
end

.top_level(*args) ⇒ Object



54
55
56
# File 'lib/rattler/back_end/parser_generator/eof_generator.rb', line 54

def EofGenerator.top_level(*args)
  TopLevelEofGenerator.new(*args)
end

Instance Method Details

#gen_basic(*_) ⇒ Object Also known as: gen_assert, gen_skip

:nodoc:



8
9
10
# File 'lib/rattler/back_end/parser_generator/eof_generator.rb', line 8

def gen_basic(*_)
  @g << '@scanner.eos?'
end

#gen_direct_action(eof, code, scope = {}) ⇒ Object



22
23
24
# File 'lib/rattler/back_end/parser_generator/eof_generator.rb', line 22

def gen_direct_action(eof, code, scope={})
  gen_symantic '(' + code.bind(scope, []) + ')'
end

#gen_disallow(*_) ⇒ Object



14
15
16
# File 'lib/rattler/back_end/parser_generator/eof_generator.rb', line 14

def gen_disallow(*_)
  expr { @g << '[email protected]?' }
end

#gen_dispatch_action(eof, code, scope = {}) ⇒ Object



18
19
20
# File 'lib/rattler/back_end/parser_generator/eof_generator.rb', line 18

def gen_dispatch_action(eof, code, scope={})
  gen_symantic code.bind(scope, '[]')
end

#gen_token(*_) ⇒ Object



26
27
28
# File 'lib/rattler/back_end/parser_generator/eof_generator.rb', line 26

def gen_token(*_)
  gen_symantic "''"
end