NAME

ABNF::Generator - abstract base class for ABNF-based generators

INHERITANCE

ABNF::Generator is the root of the Honest and Liar generators

DESCRIPTION

ABNF::Generator is the abstract base class for ABNF-based generators.

Also it provides function asStrings to stringified generated sequences

METHODS

ABNF::Generator->new($grammar, $validator?)

Creates a new ABNF::Generator object.

$grammar isa ABNF::Grammar.

$validator isa ABNF::Validator.

Children classes can get acces for them by $self->{_grammar} and $self->{_validator}

$generator->_range($rule, $recursion)

Generates chain for range element.

Abstract method, most of all children must overload it.

$recursion is a structure to controle recursion depth.

$generator->_string($rule, $recursion)

Generates chain for string element.

Abstract method, most of all children must overload it

$recursion is a structure to controle recursion depth.

$generator->_literal($rule, $recursion)

Generates chain for literal element.

Abstract method, most of all children must overload it

$recursion is a structure to controle recursion depth.

$generator->_repetition($rule, $recursion)

Generates chain for repetition element.

Abstract method, most of all children must overload it

$recursion is a structure to controle recursion depth.

$generator->_reference($rule, $recursion)

Generates chain for reference element.

Abstract method, most of all children must overload it

$recursion is a structure to controle recursion depth.

$generator->_group($rule, $recursion)

Generates chain for group element.

Abstract method, most of all children must overload it

$recursion is a structure to controle recursion depth.

$generator->_choice($rule, $recursion)

Generates chain for choce element.

Abstract method, most of all children must overload it

$recursion is a structure to controle recursion depth.

$generator->_rule($rule, $recursion)

Generates chain for rule element, usually -- basic element in chain.

Abstract method, most of all children must overload it

$recursion is a structure to controle recursion depth.

$generator->_generateChain($rule, $recursion)

Generates one chain per different rule in $rule.

$rule is structure that Return from ABNF::Grammar::rule and like in Parse::ABNF.

$rule might be a command name.

$recursion is a structure to controle recursion depth.

at init it have only one key -- level == 0.

You can create new object perl call or use one.

See use example in ABNF::Generator::Honest in method _choice

$generator->generate($rule, $tail="")

Generates one sequence string for command $rule.

Using cache $self->{_cache}->{$rule} for this rule, that speeds up this call.

$rule is a command name.

$tail is a string added to result if it absent.

dies if there is no command like $rule.

$generator->withoutArguments($name, $tail="")

Return an strings starts like command $name and without arguments.

$tail is a string added to a result.

dies if there is no command like $rule.

$generator->hasCommand($name)

Return 1 if there is a $name is command, 0 otherwise

FUNCTIONS

_asStrings($generated)

Return stringification of genereted sequences from _generateChain.

Uses in generate call to stringify chains.

AUTHOR / COPYRIGHT / LICENSE

Copyright (c) 2013 Arseny Krasikov <nyaapa@cpan.org>.

This module is licensed under the same terms as Perl itself.