in reply to RecDescent Parser problem: how to ignore new lines?

PRD does <skip:'\s*'> by default, and \s includes \n. Your problem is not actually in PRD or your grammar, but in what you feed to your parser.

Change

while (<DATA>) { chomp; $parse->Para($_); }

to

my $text = do { local $/; <DATA> }; $parse->Para($text);

and change

/.*$/

to

/[^\n]+/

Replies are listed 'Best First'.
Re^2: RecDescent Parser problem: how to ignore new lines?
by Hanken (Acolyte) on Jun 05, 2008 at 09:57 UTC
    Hey, ikegami! That works and thanks for your informative hint!
    Actually, when I use 'chomp', I should have noticed that new line symbol (\n) has been chopped. :)