|
Perl6::Tokener - It's a Perl 6 tokener. It tokenises Perl 6. |
Perl6::Tokener - It's a Perl 6 tokener. It tokenises Perl 6.
use Perl6::Tokener;
my $t = new Perl6::Tokener(file=>"foo.pl", buffer => $code);
while ($t->{buffer}) {
my ($type, $token) = $t->toke();
...
}
I don't think there's really much I need to say about this. It isn't perfect, but I'm working on it. The synopsis pretty much gives you all you need to know to drive the thing, and, bluntly, if you're futzing with tokenising Perl 6, you're already beyond the need for most kinds of documentation. So have fun.
Oh, one thing - when you're parsing, you probably want to discard the
type of everything called operator or term and just use the token
value. Oh, and white space will return undef for token and type, so
don't try using this in a while loop.
{ doesn't do what it ought. This is going to suck.
Simon Cozens, simon@cpan.org
|
Perl6::Tokener - It's a Perl 6 tokener. It tokenises Perl 6. |