The Author Online Book Forums are Moving

The Author Online Book Forums will soon redirect to Manning's liveBook and liveVideo. All book forum content will migrate to liveBook's discussion forum and all video forum content will migrate to liveVideo. Log in to liveBook or liveVideo with your Manning credentials to join the discussion!

Thank you for your engagement in the AoF over the years! We look forward to offering you a more enhanced forum experience.

import-bot (20211) [Avatar] Offline
#1
[Originally posted by genie]

Hello Dave,

On page 212 you're writing "The sentence method returns true or false
depending on whether or not the parser object successfully parsed the input
data"
That's not correct ( or you simplified this intentionally ? ) - the return
value from the functions generated out of grammar is the last item matched by
the subrule. Damian is writing it in his tutorial : "When a subrule in a
production matches during a parse, that match returns the scalar value of the
last item matched by the subrule".
So, $parser->sentence($_) returns :

Perl
book
Perl
book
book
book
undef

which behaves exactly as TRUE and FALSE but not the same.
import-bot (20211) [Avatar] Offline
#2
Re: Erratum on page 212 ( Parse::RecDescent )
[Originally posted by dave]

You're right, of course. The top-level parser method does return something a
bit more interesting than true of false, but you _can_ use the return value in
that way and in the next section, I go on to cover it in more detail.

Cheers,

Dave...