Get LineNumber from LLParseData

SyntaxEditor for WPF Forum

Posted 6 years ago by SvenG - VIPA
Version: 11.2.0552
Avatar

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

Sven 

Comments (2)

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

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 6 years ago by SvenG - VIPA
Avatar

Perfect ! Exactly what I needed...

Thank you very much !

The latest build of this product (v2019.1 build 0683) was released 1 month ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.