NAME
ABNF-Grammar - validator and generator for ABNF grammars.
ABNF::Grammar - class for inner representation ABNF-grammar.
VERSION
This document describes ABNF::Grammar version 0.08
SYNOPSIS
use ABNF::Grammar qw(Grammar);
use ABNF::Generator qw(asStrings);
use ABNF::Generator::Honest qw(Honest);
use ABNF::Generator::Liar qw(Liar);
use ABNF::Validator qw(Validator);
my $grammar = Grammar->new("smtp.bnf", qw(ehlo helo mail rcpt data rset vrfy noop quit data data-terminate)); my $valid = Validator->new($grammar); my $liar = Liar->new($grammar, $valid); my $honest = Honest->new($grammar, $valid);
$valid->validate("vrfy", "string");
my @strings = $liar->withoutArguments("vrfy");
my $string = $liar->unExistedCommand("vrfy");
my $string = $liar->endlessCommand("vrfy");
my $string = $liar->generate("helo");
my $string = $honest->generate("helo");
DESCRIPTION
This module parses IETF ABNF (STD 68, RFC 5234, 4234, 2234) grammars via Parse::ABNF and provides tools to :
verify validity of string
generate valid messages
generate invalid messages
METHODS
ABNF::Grammar->new
($fname, @commands)
Creates a new ABNF::Grammar object.
Read ABNF rules from file with $fname.
@commands consists of main command names for generation and validation.
ABNF::Grammar->fromString
($content, @commands)
Creates a new ABNF::Grammar object.
Get ABNF rules from string $rule
@commands consists of main command names for generation and validation.
$grammar->rule
($name)
Return rule form $name with name $name.
Result structure is identical to Parse::ABNF structure.
For debug only.
Do not modify result structure.
$grammar->rules
()
Return all rules.
Result structures is identical to Parse::ABNF structure.
For debug only.
Do not modify result structure.
$grammar->replaceRule
($rule, $value)
Replace $rule with $value.
For debug use only.
dies if there is no rule like $rule.
$grammar->replaceBasicRule
($rule, $value)
Replace $rule with $value.
For debug use only.
dies if there is no rule like $rule.
$grammar->hasCommand
($name)
Return 1 if $name is command, 0 otherwise.
$grammar->commands
()
Return all grammar commands as arrayref.
FUNCTIONS
splitRule
($rule)
In scalar context return prefix only, in list -- prefix and arguments rules.
$rule is structure that returns from rule
and like in Parse::ABNF.
Grammar
()
Return __PACKAGE__ to reduce class name :3
DEPENDENCIES
BUG REPORTS
Please report bugs in this module via <nyaapa@cpan.org>
SEE ALSO
ABNF RFC
Abnf parser
Validator base
Cool guy from monks with idea how to validate
AUTHOR / COPYRIGHT / LICENSE
Copyright (c) 2013 Arseny Krasikov <nyaapa@cpan.org>.
This module is licensed under the same terms as Perl itself.