NAME
Pistachio::Token::Transformer::Rule - express a token transformer rule as an object
VERSION
version 0.10
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) 2014 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.