Class: Rattler::BackEnd::ParserGenerator::AssertGenerator

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

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from ExprGenerator

#gen_intermediate_disallow, #initialize

Methods included from Parsers

define

Constructor Details

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

Class Method Details

.nested(*args) ⇒ Object



63
64
65
# File 'lib/rattler/back_end/parser_generator/assert_generator.rb', line 63

def AssertGenerator.nested(*args)
  NestedAssertGenerator.new(*args)
end

.top_level(*args) ⇒ Object



73
74
75
# File 'lib/rattler/back_end/parser_generator/assert_generator.rb', line 73

def AssertGenerator.top_level(*args)
  TopLevelAssertGenerator.new(*args)
end

Instance Method Details

#gen_assert(assert, scope = {}) ⇒ Object



12
13
14
# File 'lib/rattler/back_end/parser_generator/assert_generator.rb', line 12

def gen_assert(assert, scope={})
  gen_basic assert, scope
end

#gen_basic(assert, scope = {}) ⇒ Object

:nodoc:



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

def gen_basic(assert, scope={})
  generate assert.child, :assert, scope
end

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



28
29
30
# File 'lib/rattler/back_end/parser_generator/assert_generator.rb', line 28

def gen_direct_action(assert, code, scope={})
  expr(:block) { gen_action assert, "(#{code.bind scope, []})", scope }
end

#gen_disallow(assert, scope = {}) ⇒ Object



16
17
18
# File 'lib/rattler/back_end/parser_generator/assert_generator.rb', line 16

def gen_disallow(assert, scope={})
  @g << 'false'
end

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



24
25
26
# File 'lib/rattler/back_end/parser_generator/assert_generator.rb', line 24

def gen_dispatch_action(assert, code, scope={})
  expr(:block) { gen_action assert, code.bind(scope, '[]'), scope }
end

#gen_intermediate(assert, scope = {}) ⇒ Object



36
37
38
# File 'lib/rattler/back_end/parser_generator/assert_generator.rb', line 36

def gen_intermediate(assert, scope={})
  generate assert.child, :intermediate_assert, scope
end

#gen_intermediate_assert(assert, scope = {}) ⇒ Object



40
41
42
# File 'lib/rattler/back_end/parser_generator/assert_generator.rb', line 40

def gen_intermediate_assert(assert, scope={})
  gen_intermediate assert, scope
end

#gen_intermediate_skip(assert, scope = {}) ⇒ Object



44
45
46
# File 'lib/rattler/back_end/parser_generator/assert_generator.rb', line 44

def gen_intermediate_skip(assert, scope={})
  gen_intermediate assert, scope
end

#gen_skip(assert, scope = {}) ⇒ Object



20
21
22
# File 'lib/rattler/back_end/parser_generator/assert_generator.rb', line 20

def gen_skip(assert, scope={})
  gen_basic assert, scope
end

#gen_token(assert, scope = {}) ⇒ Object



32
33
34
# File 'lib/rattler/back_end/parser_generator/assert_generator.rb', line 32

def gen_token(assert, scope={})
  expr(:block) { gen_action assert, "''", scope }
end