The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Pistachio::Token::Transformer::Rule - express a transformer rule as an object

VERSION

version 0.01

SYNOPSIS

 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)

AUTHOR

Joel Dalley <joeldalley@gmail.com>

COPYRIGHT AND LICENSE

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.