[PCT] Q: Is there some kind of line number functionality already implemented?
Patrick R. Michaud
pmichaud at pobox.com
Wed Aug 12 15:01:17 UTC 2009
On Wed, Aug 12, 2009 at 10:46:21AM -0400, Austin Hastings wrote:
> acking around, I can't find anything that seems to do the "at line
> number so-and-so" job in the PCT code. It seems likely that I just
> haven't chosen the right name to search for, though.
>
> Can someone point me at the name / sample invocation of the
> "what-line-is-this-node-at" code?
CodeString objects supply a ".lineof" method for this.
And I think that PGE (or perhaps PCT) automatically promotes
the target string into a CodeString. So from a Match object,
one can typically do:
.local pmc orig
orig = match.'orig'()
$I0 = orig.'lineof'(1000) # get line number for position 1000
Pm
More information about the parrot-dev
mailing list