How do I get line numbers using pegged?

TheZipCreator thezipcreator at protonmail.com
Tue Aug 16 01:44:37 UTC 2022


On Monday, 15 August 2022 at 23:38:09 UTC, Paul Backus wrote:
> On Monday, 15 August 2022 at 22:55:30 UTC, TheZipCreator wrote:
>> [...]
>
> It looks like the parse tree in pegged stores the start and end 
> byte indices of the portion of the input text it corresponds to:
>
> https://github.com/PhilippeSigaud/Pegged/blob/v0.4.6/pegged/peg.d#L251-L252
>
> It should be possible to compute line numbers based on these 
> indices.

ah, that's what I was looking for, thanks


More information about the Digitalmars-d-learn mailing list