Module: Rattler::BackEnd::ParserGenerator
- Included in:
- Optimizer::JoinMatchCapturingSequence
- Defined in:
- lib/rattler/back_end/parser_generator.rb,
lib/rattler/back_end/parser_generator/nested.rb,
lib/rattler/back_end/parser_generator/top_level.rb,
lib/rattler/back_end/parser_generator/group_match.rb,
lib/rattler/back_end/parser_generator/eof_generator.rb,
lib/rattler/back_end/parser_generator/expr_generator.rb,
lib/rattler/back_end/parser_generator/fail_generator.rb,
lib/rattler/back_end/parser_generator/list_generator.rb,
lib/rattler/back_end/parser_generator/rule_generator.rb,
lib/rattler/back_end/parser_generator/skip_generator.rb,
lib/rattler/back_end/parser_generator/sub_generating.rb,
lib/rattler/back_end/parser_generator/apply_generator.rb,
lib/rattler/back_end/parser_generator/label_generator.rb,
lib/rattler/back_end/parser_generator/match_generator.rb,
lib/rattler/back_end/parser_generator/token_generator.rb,
lib/rattler/back_end/parser_generator/assert_generator.rb,
lib/rattler/back_end/parser_generator/choice_generator.rb,
lib/rattler/back_end/parser_generator/gen_method_names.rb,
lib/rattler/back_end/parser_generator/list0_generating.rb,
lib/rattler/back_end/parser_generator/list1_generating.rb,
lib/rattler/back_end/parser_generator/repeat_generator.rb,
lib/rattler/back_end/parser_generator/skip_propogating.rb,
lib/rattler/back_end/parser_generator/token_propogating.rb,
lib/rattler/back_end/parser_generator/disallow_generator.rb,
lib/rattler/back_end/parser_generator/e_symbol_generator.rb,
lib/rattler/back_end/parser_generator/rule_set_generator.rb,
lib/rattler/back_end/parser_generator/sequence_generator.rb,
lib/rattler/back_end/parser_generator/optional_generating.rb,
lib/rattler/back_end/parser_generator/delegating_generator.rb,
lib/rattler/back_end/parser_generator/group_match_generator.rb,
lib/rattler/back_end/parser_generator/predicate_propogating.rb,
lib/rattler/back_end/parser_generator/general_list_generator.rb,
lib/rattler/back_end/parser_generator/one_or_more_generating.rb,
lib/rattler/back_end/parser_generator/direct_action_generator.rb,
lib/rattler/back_end/parser_generator/zero_or_more_generating.rb,
lib/rattler/back_end/parser_generator/back_reference_generator.rb,
lib/rattler/back_end/parser_generator/general_repeat_generator.rb,
lib/rattler/back_end/parser_generator/dispatch_action_generator.rb
Overview
A ParserGenerator
generates ruby parsing code from parser models.
Defined Under Namespace
Modules: List0Generating, List1Generating, Nested, NestedSubGenerating, OneOrMoreGenerating, OptionalGenerating, PredicatePropogating, SkipPropogating, SubGenerating, TokenPropogating, TopLevel, TopLevelSubGenerating, ZeroOrMoreGenerating Classes: ApplyGenerator, AssertGenerator, BackReferenceGenerator, ChoiceGenerator, DelegatingGenerator, DirectActionGenerator, DisallowGenerator, DispatchActionGenerator, ESymbolGenerator, EofGenerator, ExprGenerator, FailGenerator, GeneralListGenerator, GeneralRepeatGenerator, GroupMatch, GroupMatchGenerator, LabelGenerator, ListGenerator, MatchGenerator, NestedApplyGenerator, NestedAssertGenerator, NestedBackReferenceGenerator, NestedChoiceGenerator, NestedDirectActionGenerator, NestedDisallowGenerator, NestedDispatchActionGenerator, NestedESymbolGenerator, NestedEofGenerator, NestedFailGenerator, NestedGeneralListGenerator, NestedGeneralRepeatGenerator, NestedGroupMatchGenerator, NestedLabelGenerator, NestedListGenerator, NestedMatchGenerator, NestedRepeatGenerator, NestedSequenceGenerator, NestedSkipGenerator, NestedTokenGenerator, RepeatGenerator, RuleGenerator, RuleSetGenerator, SequenceGenerator, SkipGenerator, TokenGenerator, TopLevelApplyGenerator, TopLevelAssertGenerator, TopLevelBackReferenceGenerator, TopLevelChoiceGenerator, TopLevelDirectActionGenerator, TopLevelDisallowGenerator, TopLevelDispatchActionGenerator, TopLevelESymbolGenerator, TopLevelEofGenerator, TopLevelFailGenerator, TopLevelGeneralListGenerator, TopLevelGeneralRepeatGenerator, TopLevelGenerator, TopLevelGroupMatchGenerator, TopLevelLabelGenerator, TopLevelListGenerator, TopLevelMatchGenerator, TopLevelRepeatGenerator, TopLevelSequenceGenerator, TopLevelSkipGenerator, TopLevelTokenGenerator
Constant Summary collapse
- GEN_METHOD_TYPES =
%w{ basic assert disallow dispatch_action direct_action token skip intermediate intermediate_assert intermediate_disallow intermediate_skip }
- GEN_METHOD_NAMES =
GEN_METHOD_TYPES.map {|_| :"gen_#{_}" }
Class Method Summary collapse
-
.code_for(parser, opts = {}) ⇒ Object
Generate parsing code for
parser
using a new RubyGenerator with the given options and return the generated code. -
.generate(g, parser, opts = {}) ⇒ Object
Generate parsing code for a parser model using a ruby generator
g
.
Class Method Details
.code_for(grammar, opts) ⇒ String .code_for(rules, opts) ⇒ String .code_for(rule, opts) ⇒ String .code_for(parser, opts) ⇒ String
Generate parsing code for parser
using a new RubyGenerator with the given options and return the generated code.
108 109 110 |
# File 'lib/rattler/back_end/parser_generator.rb', line 108 def self.code_for(parser, opts={}) ::Rattler::BackEnd::RubyGenerator.code(opts) {|g| generate g, parser, opts } end |
.generate(g, grammar) ⇒ Object .generate(g, rules) ⇒ Object .generate(g, rule) ⇒ Object .generate(g, parser) ⇒ Object
Generate parsing code for a parser model using a ruby generator g
.
81 82 83 84 85 86 87 |
# File 'lib/rattler/back_end/parser_generator.rb', line 81 def self.generate(g, parser, opts={}) unless opts[:no_optimize] parser = ::Rattler::BackEnd::Optimizer.optimize(parser, opts) end RuleSetGenerator.new(g).generate(parser, opts) g end |