Stories
Slash Boxes
Comments
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

Ovid (2709)

Ovid
  (email not shown publicly)
http://publius-ovidius.livejournal.com/
AOL IM: ovidperl (Add Buddy, Send Message)

Stuff with the Perl Foundation. A couple of patches in the Perl core. A few CPAN modules. That about sums it up.

Journal of Ovid (2709)

Friday January 27, 2006
03:18 PM

HOP::Lexer 0.02

[ #28499 ]

I've uploaded a new version of HOP::Lexer. In "Higher Order Perl", the lexer assumes that you'll be passing an iterator as the first argument to make_lexer. That means if you're trying to lex a single block of text, you have to do this:

my @text  = $text;
my $iter  = sub { shift @text };
my $lexer = make_lexer( $iter, @tokens );

However, lexing a single block of text was common enough that I provided this:

my $lexer = string_lexer( $string, @tokens );

I thought about overloading make_lexer to check if the first argument was a subref or a scalar, but I felt that this might cause strange bugs if people didn't know the difference. I'm probably overly paranoid.

For more information about using a lexer, see my perl.com article.

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
 Full
 Abbreviated
 Hidden
More | Login | Reply
Loading... please wait.