Class: Rattler::BackEnd::ParserGenerator::LabelGenerator

Inherits:
ExprGenerator
  • Object
show all
Includes:
PredicatePropogating, SkipPropogating, TokenPropogating
Defined in:
lib/rattler/back_end/parser_generator/label_generator.rb

Direct Known Subclasses

NestedLabelGenerator, TopLevelLabelGenerator

Class Method Summary collapse

Instance Method Summary collapse

Methods included from SkipPropogating

#gen_intermediate_skip, #gen_skip

Methods included from TokenPropogating

#gen_token

Methods included from PredicatePropogating

#gen_assert, #gen_disallow, #gen_intermediate_assert, #gen_intermediate_disallow

Methods inherited from ExprGenerator

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

Methods included from Parsers

define

Constructor Details

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

Class Method Details

.nested(*args) ⇒ Object



50
51
52
# File 'lib/rattler/back_end/parser_generator/label_generator.rb', line 50

def LabelGenerator.nested(*args)
  NestedLabelGenerator.new(*args)
end

.top_level(*args) ⇒ Object



60
61
62
# File 'lib/rattler/back_end/parser_generator/label_generator.rb', line 60

def LabelGenerator.top_level(*args)
  TopLevelLabelGenerator.new(*args)
end

Instance Method Details

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



11
12
13
# File 'lib/rattler/back_end/parser_generator/label_generator.rb', line 11

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

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



22
23
24
25
26
27
28
# File 'lib/rattler/back_end/parser_generator/label_generator.rb', line 22

def gen_direct_action(label, code, scope={})
  expr :block do
    scope = gen_capturing label.child, scope, label.label
    (@g << ' &&').newline
    @g.surround('(', ')') { @g << code.bind(scope, direct_action_args) }
  end
end

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



15
16
17
18
19
20
# File 'lib/rattler/back_end/parser_generator/label_generator.rb', line 15

def gen_dispatch_action(label, code, scope={})
  expr :block do
    scope = gen_capturing label.child, scope, label.label
    (@g << ' &&').newline << code.bind(scope, dispatch_action_args)
  end
end