Look behind Macro problem

SyntaxEditor for Windows Forms Forum

Posted 12 years ago by Matt Whitfield
Version: 4.0.0238
Hello - just another question

I am trying to modify the SQL XML language definition

I have replaced the SystemVariableToken RegexPatternGroup with an explicit list of system variables - so that, @@TEST, for example, is not recognised as a system variable

However, @@TEST then gets recognised as a single @ and then a VariableToken @@

I wanted to create a lookBehind macro that would stop the VariableToken from allowing things that start with @@ from being highlighted as a variable.

So I tried LookBehind="(?<!@@)" in the VariableToken declaration in the XML - but this complained about the < character in XML. So I tried LookBehind="(?&lt;!@@)". This let the XML be loaded, but as soon as an '@' was typed in the document, would raise an ApplicationException with the message 'Op code not implemented: 12'.

So - can anyone help me modify the following XML so that variable tokens do not match on items with two @@ at the start?

                <!-- System Variables -->
                <ExplicitPatternGroup  TokenKey="SystemVariableToken" Style="SystemVariableStyle" LookAhead="{NonWordMacro}|\z">
                <!-- Variables -->
                <RegexPatternGroup TokenKey="VariableToken" Style="VariableStyle" PatternValue="@ {WordMacro}+" LookAhead="{NonWordMacro}|\z" LookBehind="(?&lt;!@@)" />

Comments (2)

Posted 12 years ago by Actipro Software Support - Cleveland, OH, USA
You'd probably want something like LookBehind="[^@]|\A"

Please note you don't need the normal lookbehind syntax in the LookBehind attribute since it adds that for you.

Actipro Software Support

Posted 12 years ago by Matt Whitfield
thanks - that did the trick!
The latest build of this product (v2018.1 build 0341) was released 3 months ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.