Method: Rattler::Compiler::ParserGenerator.code_for

Defined in:
lib/rattler/compiler/parser_generator.rb

.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.

Overloads:

  • .code_for(grammar, opts) ⇒ String

    Returns the generated code.

    Parameters:

    Returns:

    • (String)

      the generated code

  • .code_for(rules, opts) ⇒ String

    Returns the generated code.

    Parameters:

    • rules (Rules)

      the parse rules

    Returns:

    • (String)

      the generated code

  • .code_for(rule, opts) ⇒ String

    Returns the generated code.

    Parameters:

    • rule (Rule)

      the parse rule

    Returns:

    • (String)

      the generated code

  • .code_for(parser, opts) ⇒ String

    Returns the generated code.

    Parameters:

    • parser (Parser)

      the parser model

    Returns:

    • (String)

      the generated code



103
104
105
# File 'lib/rattler/compiler/parser_generator.rb', line 103

def self.code_for(parser, opts={})
  ::Rattler::Compiler::RubyGenerator.code(opts) {|g| generate g, parser, opts }
end