Pistachio::Token::Transformer::Rule - express a transformer rule as an object
version 0.01
my $rule = Pistachio::Token::Transformer::Rule->new( type => 'Word', prec => [['Word::Reserved', 'package']], succ => [['Structure', ';']], into => 'Word::Package', ); print $rule->type # Word print $rule->into # Word::Package print $rule->value # (Undef) print join ', ', @{$rule->prec}; # Word::Reserved, package print join ', ', @{$rule->succ}; # Structure, ; $rule = Pistachio::Token::Transformer::Rule->new( type => 'Symbol', val => sub {shift =~ /^&/}, into => 'Symbol::Sub' ); print $rule->value->('&call_sub') # 1 (True) print $rule->value->('wtf&') # (False)
Joel Dalley <joeldalley@gmail.com>
This software is copyright (c) 2013 by Joel Dalley.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
To install Pistachio, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Pistachio
CPAN shell
perl -MCPAN -e shell install Pistachio
For more information on module installation, please visit the detailed CPAN module installation guide.