|
NAMEPugs::Compiler::Rule - Compiler for Perl 6 regexesVERSIONThis document describes Pugs::Compiler::Rule 0.28 released on 31 Oct, 2007.SYNOPSISUn-named rules are objects:use Pugs::Compiler::Rule; my $rule = Pugs::Compiler::Rule->compile( '((.).).' ); my $match = $rule->match( 'abc' ); if ($match) { # true print $match; # "abc" print $match->from; # 0 print $match->to; # 3 print $match->[0]; # "ab" print $match->[0][0]; # "a" } Named rules are methods in a Grammar: package MyGrammar; use Pugs::Compiler::Rule; use base 'Pugs::Grammar::Base'; Pugs::Compiler::Rule->install( rule => '((.).).' ); my $match = MyGrammar->rule( 'abc' ); Rules may have parameters: $grammar->install(subrule => $source, { signature => $sig } ); $grammar->install(rule => q{ <subrule: param1, param2> }); where $grammar is normally a Perl 5 package. DESCRIPTIONThis module provides an pure Perl 5 implementation for Perl 6 regexes, which does not depend on the Haskell Pugs.It is a front-end to several other modules: Front-end Modules
Runtime Classes
Grammars
Code Emitters
INHERITANCEPugs::Compiler::Rule isa Pugs::Compiler::Regex METHODSThis class (i.e. Pugs::Compiler::Rule) is a subclass of Pugs::Compiler::Regex and thus owns all the methods of its base class. See Pugs::Compiler::Regex for the detailed docs.
CAVEATSThis is an experimental development version. The API is still in flux.The set of implemented features depend on the "ratchet" switch. AUTHORSThe Pugs Team "<perl6-compiler@perl.org>".Please join us on irc.freenode.net "#perl6" if you'd like to participate. SEE ALSO
COPYRIGHTCopyright 2006, 2007 by Flavio Soibelmann Glock and others.This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See <http://www.perl.com/perl/misc/Artistic.html>
Visit the GSP FreeBSD Man Page Interface. |