ABNF::Generator - abstract base class for ABNF-based generators
ABNF::Generator is the root of the Honest and Liar generators
ABNF::Generator is the abstract base class for ABNF-based generators.
Also it provides function asStrings to stringified generated sequences
new
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}
_range
Generates chain for range element.
Abstract method, most of all children must overload it.
$recursion is a structure to controle recursion depth.
_string
Generates chain for string element.
Abstract method, most of all children must overload it
_literal
Generates chain for literal element.
_repetition
Generates chain for repetition element.
_reference
Generates chain for reference element.
_group
Generates chain for group element.
_choice
Generates chain for choce element.
_rule
Generates chain for rule element, usually -- basic element in chain.
_generateChain
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.
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
generate
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.
withoutArguments
Return an strings starts like command $name and without arguments.
$tail is a string added to a result.
hasCommand
Return 1 if there is a $name is command, 0 otherwise
_asStrings
Return stringification of genereted sequences from _generateChain.
Uses in generate call to stringify chains.
Copyright (c) 2013 Arseny Krasikov <nyaapa@cpan.org>.
This module is licensed under the same terms as Perl itself.
To install ABNF::Grammar, copy and paste the appropriate command in to your terminal.
cpanm
cpanm ABNF::Grammar
CPAN shell
perl -MCPAN -e shell install ABNF::Grammar
For more information on module installation, please visit the detailed CPAN module installation guide.