Get LineNumber from LLParseData

SyntaxEditor for WPF Forum

Posted 10 years ago by SvenG - VIPA
Version: 11.2.0552

Hi guys,

I need to know the lineNumber of each AstNodeBase in my ParseData.
Like it is done it the ParseData.Errors List. There I have the possibility to get extended information via PositionRange.StartPosition.DisplayLine.
Unfortunately the AstNodeBase only gives me the int offsets.

Is there something similiar for the ParseData or can i at least somehow calculate the line number based on the offsets ?

Thanks and regards


Comments (2)

Answer - Posted 10 years ago by Actipro Software Support - Cleveland, OH, USA

Hi Sven,

If you are using hte LL(*) Parser Framework, then the source ITextSnapshot should also be available in the parse data.  That has methods like OffsetToPosition that you can use to conver the offset to a TextPosition.

Actipro Software Support

Posted 10 years ago by SvenG - VIPA

Perfect ! Exactly what I needed...

Thank you very much !

The latest build of this product (v24.1.2) was released 2 months ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.