Posted 12 years ago by Barry Ahrens - Member of Technical Staff, Teledyne Scientific
Version: 4.0.0274
Avatar
Do I have an infinite loop or something in my language that I have implemented? When using the editor with the following rules, the editor hangs/locks up when I type something like

"KEYWORD1 veryveryveryveryveryverylongstringvariable , F"

As soon as I hit the "F" key, the application hangs. I have narrowed it down to the 2nd rule below. The 1st rule is NOT causing the problem. As you are experts in the parsing rules, do you see a problem in the 2nd rule?

Thanks very much!

1st rule: This works fine.......

        <!-- Flags F -->
        <ExplicitPatternGroup TokenKey="Token1" Style="Style1" LookBehind="(KEYWORD1) {WhitespaceMacro}+ " LookAhead="{NonWordMacro}" CaseSensitivity="Sensitive">
          <ExplicitPatterns>
            F0 F1 F2 F3 F4 F5 F6 
          </ExplicitPatterns>
        </ExplicitPatternGroup>  
2nd rule: This is Not OK:

    <ExplicitPatternGroup TokenKey="Token2" Style="Style2" LookBehind="(KEYWORD2) {WhitespaceMacro}+ ({WordMacro}+ {WhitespaceMacro}*)+ [,]+ {WhitespaceMacro}* " LookAhead="{NonWordMacro}" CaseSensitivity="Sensitive">
                    <ExplicitPatterns>
                        F7 F8 F9 
                    </ExplicitPatterns>
                </ExplicitPatternGroup>

Comments (1)

Posted 12 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Hi Barry,

Yes your LookBehind could cause a lot of extra backwards parsing overhead the way you have it. Whenever you start adding lots of '+' or '*' regular expressions, you add processing. And as you add multiple instances of them, you are starting to exponentially add procesing.

In your case you are allowing many levels of words and whitespaces which is probably where it is getting locked up since it is scanning those constantly. You really should simplify your LookBehind or find another way to do it, and that definitely will help.


Actipro Software Support

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

Add Comment

Please log in to a validated account to post comments.