An integer written together with a next token

SyntaxEditor for WPF Forum

Posted 4 years ago by Yury Asheshov
Version: 15.1.0623
Avatar

The following string

Action 1000 ms;

can be parsed with standard dynamic lexer without any problems.

Some lazy peaple wrote in some files this (no space between 1000 and ms)

Action 1000ms;

This is kind of problem and my parser has an error. As far as I understood I need change the lexer. Now my integer definition is Regex: {Digit}+, LookAheadPattern: {NonWord}|\z. I believe that this is the problem of LookAheadPattern. I tried some variants without any success and hope that you can help me.

Comments (1)

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

Hi Yury,

Yes your LookAheadPattern is saying a non-word character or document end must come after the digits in order to match.  Since "m" is a "word" character, the LookAheadPattern will fail in the latter scenario.

You could try making it something more like:

{NonWord}|\z|(ms)

That may do the trick.


Actipro Software Support

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

Add Comment

Please log in to a validated account to post comments.