Original file: pX/Common/iterator_engine.pl - fglock
TODO
- There are no tests yet for <before>, hashes, end_of_string
- It needs a 'direction' flag, in order to implement <after>.
- Quantified matches could use less stack space.
- Simplify arg list - the functions currently take 8 arguments.
- weaken self-referential things
A "rule" function gets as argument a list:
0 - the string to match 1 - an optional "continuation" 2 - the partially built match tree 3 - a leaf pointer in the match tree 4 - the grammar name 5 - pos #6 - the whole string to match 7 - argument list - <subrule($x,$y)>
it modifies argument #3 to a Match object:
bool - an "assertion" (true/false) from - string pointer for start of this match to - string pointer for next match (end+1) match - positional submatches named - named submatches capture - return'ed things state - a "continuation" or undef abort - the match was stopped by a { return } or a fail(), and it should not backtrack or whatever
A "ruleop" function gets some arguments and returns a "rule" funtion.
sub fail { return abort( sub { return { bool => \0 }; } ); };
To install Pugs::Compiler::Rule, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Pugs::Compiler::Rule
CPAN shell
perl -MCPAN -e shell install Pugs::Compiler::Rule
For more information on module installation, please visit the detailed CPAN module installation guide.