in reply to Parse::Lex error message

I assume your problem is occuring at:

$lexer->every (sub { print $_[0]->name, "\t"; print $_[0]->text, "\n"; });

I'm not overly familiar with Parse::Lex - what's getting passed (or should be getting passed) to sub{} in $lexer->every()?

Replies are listed 'Best First'.
Re: Re: Parse::Lex error message
by cgraf (Beadle) on Jan 27, 2004 at 16:53 UTC
    Parse::Lex passes a Parse::Token object to the sub. You can print the name of the token that has been matched using the "name" method. However, the method can not be executed since a token object is not passed for some some reason. On shorter strings the lexer works, but with the long string in the example it fails.