Highlighting keywords within other words.

SyntaxEditor for WPF Forum

Posted 6 years ago by James Kester - Metafile Information Systems, Inc.
Version: 13.2.0591
Avatar

Hello, Im probably just missing something simple, but i have a set of keywords defined, and they are being highlighted properly.  However if  a word ends with a keyword its also being highlighted example:

 

keyword  "OR"   <-- being highlighted

Vendor  <-- the or at the end is being highlighted.

Order  <-- the or is NOT being highlighted.

 

thanks.

Comments (1)

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

Hi James,

You are probably missing an Identifier sort of pattern group in your lexer.  You should make an Identifier pattern group that includes anything with a letter/number (standard identifier syntax) and have it low priority in your lexical state.  That will cause things like Vendor to be consumed as an Identifier token.

Not only will that fix your problem (since all the Vendor letters will be consumed), it will also make your lexer faster.  Right now I suspect each character in "Vendor" is lexing as its own token.


Actipro Software Support

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.