Many moons back, Dave McD wrote: > I have built a parser which is working very well > except for the line numbers being printed in error > messages are negative numbers. It looks like if you > add the TOTAL line count for the $text to this, then > you get the correct line # + 1. Seems like a bug. > Maybe I can get around it by initializing the starting > line # with the total line count when I first call the > parser as an extra argument? > > Also, I looked at your implementation of the TIE'ed > subroutine to the $thisline variable in RecDescent.pm, > and its seems really inefficient to have to compute > the line number by counting lines for the remaining > $text at the parse point, and subtracting the total > lines for the intial $text. On long input files, if I > use the $thisline variable in my grammer, it slows the > parse down by like 5-10X. Is there not some way to > carry a running total of newlines seen as the parse > proceeds, similar to how $text is localized per rule?
Almost certainly. I'm now building my next parser generator (Parse::FastDescent) which I hope will be decidely more efficient in this (and many other) respects. Damian