Class: Rattler::Compiler::ParserGenerator::FailGenerator

Inherits:
ExprGenerator
  • Object
show all
Defined in:
lib/rattler/compiler/parser_generator/fail_generator.rb

Direct Known Subclasses

NestedFailGenerator, TopLevelFailGenerator

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from ExprGenerator

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

Constructor Details

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

Class Method Details

.nested(*args) ⇒ Object



42
43
44
# File 'lib/rattler/compiler/parser_generator/fail_generator.rb', line 42

def FailGenerator.nested(*args)
  NestedFailGenerator.new(*args)
end

.top_level(*args) ⇒ Object



51
52
53
# File 'lib/rattler/compiler/parser_generator/fail_generator.rb', line 51

def FailGenerator.top_level(*args)
  TopLevelFailGenerator.new(*args)
end

Instance Method Details

#gen_basic(fail, scope = ParserScope.empty) ⇒ Object

:nodoc:



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

def gen_basic(fail, scope = ParserScope.empty)
  case fail.attrs[:type]
  when :expr  then gen_fail_expr fail.message
  when :rule  then gen_fail_rule fail.message
  when :parse then gen_fail_parse fail.message
  end
end

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



16
17
18
# File 'lib/rattler/compiler/parser_generator/fail_generator.rb', line 16

def gen_skip(fail, scope = ParserScope.empty)
  gen_basic fail, scope
end