On Thu, Mar 13, 2003 at 12:54:38PM +0100, Rafael Garcia-Suarez wrote:
> Fergal Daly <fergal@esatclear.ie> wrote:
> > Yes, Perl's syntax error stuff sucks, it's often completely wrong about the
> > line number, especially when a big if/else is involved. I suspect it's a big
> > job to fix that although, I have no idea how to go about it,
>
> Use another parser generator than yacc ?
if if .. else line-numbers problem isn't the parser's fault anyway.
Perl will print the correct line number in something like
if ($p) {
;
} elsif ( hi! I'm a syntax error) {
;
}
but not in
if ($p) {
;
} elsif ( die "dying" ) {
;
}
That's because Perl keeps the line numbers only in STATEOP's.
I see no other solution than bloating the produced code with
nextstates - just for that.
That would be really stupid.
And even if every elsif ( .. ) will become elsif ( { .. } )
some people will say it still sucks and give examples:
1,
2,
3,
warn "add three lines ";
Regards
Adi