offsetlinenum
[email protected] ((Alexander Farber)) Sun, 19 Sep 2004 14:01:35 +0000
| Newsgroups | perl.recdescent |
|---|---|
| Message-ID | <[email protected]> |
Hi,
in the Parse/RecDescent.pm, what is the offsetlinenum used for?
I'm trying to understand, what does this in the P::RD::LineCounter mean:
sub STORE
{
my $parser = $_[0]->{parser};
$parser->{offsetlinenum} -= $parser->{lastlinenum} - $_[1];
return undef;
}
When a $thisline = 10 is called, why doesn't the STORE do
something simple, like $parser->{MyCurrentLine} = $_[1] ?
Is offsetlinenum somehow used to cache the current line number,
so that _linecount($text) is not called too often?
Regards
Alex
PS: In the AUTOLOAD() isn't the first line below redundant?
$_[0]->{lastlinenum} = $_[2]||_linecount($_[1]);
$_[0]->{lastlinenum} = _linecount($_[1]);