newlines and no newlines
[email protected] ("Cortland D. Starrett")
| Newsgroups | perl.recdescent |
|---|---|
| Message-ID | <[email protected]> |
RecDescent is nice. I come from antlr land and do not miss the
compile step...
The following grammar parses fine with no intermixed newlines.
It fails with newlines. E.g.:
c t a b int B # parses
c t a
b int B # does not
I do not understand why the second fails. Insight?
(These were "create table"s, but slimmed for simplicity.)
Thank you,
Cortland Starrett
#!/usr/bin/perl -sw
use Parse::RecDescent;
$::RD_AUTOACTION = q{ print "$item[0]\n"; };
$grammar = q {
s : c
c : ct 'a' m
ct: 'c t'
m : 'b' t 'B'
t : 'int'
};
$parse = new Parse::RecDescent ($grammar);
while (<>)
{
my $tree = $parse->s($_);
}