GetWordTextRange identifies ':' instead of assignment operator ':='

SyntaxEditor for WPF Forum

Posted 8 years ago by Xinen Lee
Version: 16.1.0624
Avatar

Hi, 

We are using the LLParser, and have defined in our Lexer to identify ":=" as assignment, and ":" as colon. However,

 

with an offset before the ':' character (e.g. caret "|" at "|:="), snapshot.GetWordTextRange or GetWordText returns only ":"

with an offset before the '=' character (e.g. caret "|" at ":|="), snapshot.GetWordTextRange or GetWordText returns ":="

 

We would expect ":=" to be returned in both cases since it was identified as a token - is this an Actipro issue?

 

Thanks

Comments (1)

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

Hi Xinen,

There is an IWordBreakFinder service on the language whose default implementation is DefaultWordBreakFinder if no custom one is specified.  The default word break finder doesn't examine tokens, mainly because a single token (like a comment) could contain multiple "words" so token examination isn't reliable.

You can create a class that inherits DefaultWordBreakFinder and register that as an IWordBreakFinder service on your language.  Then it will be used in place of the default one.  You can override the results of the various methods to achieve the results you want.  GetWordTextRange calls FindCurrentWordEnd first and then FindCurrentWordStart to determine the word's range.


Actipro Software Support

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

Add Comment

Please log in to a validated account to post comments.