Issue causing a crash / red cross in the Syntax Editor

SyntaxEditor for Windows Forms Forum

Posted 12 years ago by Joris Koster - Paragon Decision Technology
Version: 3.1.0222
Platform: Services
Environment: Windows XP (32-bit)
Avatar
Recently we made some minor changes to our language definition, but we found it had some unforeseen consequences. We changed something to the scope definition, that fixed one of our own issues. The steps to reproduce the crash is below. We've tried to isolate the problem in the smallest language def possible.

1) Open the C# Sample Editor application
2) Load the following custom language:

<SyntaxLanguage Key="MyLanguage" LanguageDefinitionVersion="3.0" Secure="False" xmlns="http://ActiproSoftware/SyntaxEditor/3.0/LanguageDefinition" >

    <!-- Macros -->
    <Macros>
        <Macro Key="IdentifierMacro" Value="({AlphaMacro}|\_)({WordMacro})*" />
    </Macros>

    <!-- Highlighting Styles -->
    <Styles>
        <Style Key="ReservedWordStyle" Name="Keyword" ForeColor="Blue" BackColor="Default" Bold="False" Italic="False" Underline="False" />
        <Style Key="StringStyle" Name="String" ForeColor="Gray" BackColor="Default" Bold="False" Italic="True" Underline="False" />
        <Style Key="CommentStyle" Name="Comment" ForeColor="Green" BackColor="Default" Bold="False" Italic="True" Underline="False" />
        <Style Key="PunctuatorStyle" Name="Punctuator" ForeColor="Black" BackColor="Default" Bold="False" Italic="False" Underline="False" />
        <Style Key="IdentifierStyle"  Name="Identifier" ForeColor="Black" BackColor="Default" Bold="False" Italic="False" Underline="False" />
    </Styles>

    <!-- States -->
    <States>

        <!-- Code -->
        <State Key="DefaultState">
            <Scopes>
                <Scope BracketHighlight="True">
                    <ExplicitPatternGroup Type="StartScope" TokenKey="BracketStartToken" TokenID="22" Style="PunctuatorStyle" PatternValue="(" />
                    <ExplicitPatternGroup Type="EndScope" TokenKey="BracketEndToken" TokenID="23" Style="PunctuatorStyle" PatternValue=")" />
                </Scope>
                <Scope>
                    <ExplicitPatternGroup Type="StartScope" TokenKey="IfStartToken" TokenID="12" Style="ReservedWordStyle" PatternValue="if" LookAhead="{NonWordMacro}" />
                    <RegexPatternGroup Type="EndScope" TokenKey="EndIfStartToken" TokenID="13" Style="ReservedWordStyle" PatternValue="endif" IsWhitespace="True" />
                </Scope>
            </Scopes>
            <!-- Patterns Groups -->
            <PatternGroups>
                <!-- Identifiers -->
                <RegexPatternGroup TokenKey="IdentifierToken" TokenID="36" Style="IdentifierStyle" PatternValue="(?!(endif)\b)({IdentifierMacro})" />
              <!-- Whitespace -->
                <RegexPatternGroup TokenKey="DefaultToken" TokenID="0" PatternValue="({LineTerminatorWhitespaceMacro})+" IsWhitespace="True" />
            </PatternGroups>
            <!-- Child States -->
            <ChildStates>
                <ChildState Key="DefaultState" />
                <ChildState Key="StringState" />
                <ChildState Key="SingleLineCommentState" />
            </ChildStates>
        </State>
        
        <!-- Strings -->
        <State Key="StringState" ID="4" TokenKey="StringDefaultToken" TokenID="25" Style="StringStyle">
            <!-- Scopes -->
            <Scopes>
                <Scope>
                    <ExplicitPatternGroup Type="StartScope" TokenKey="StringStartToken" TokenID="24" PatternValue="&quot;" />
                    <RegexPatternGroup Type="EndScope" TokenKey="StringEndToken" TokenID="26" PatternValue="[\&quot;\n]" />
                </Scope>
            </Scopes>
        </State>

        <!-- Comments -->
        <State Key="SingleLineCommentState" ID="6" TokenKey="CommentDefaultToken" TokenID="39" Style="CommentStyle">
            <!-- Scopes -->
            <Scopes>
                <Scope>
                    <ExplicitPatternGroup Type="StartScope" TokenKey="CommentStartToken" TokenID="38" PatternValue="!" />
                    <RegexPatternGroup Type="EndScope" TokenKey="CommentEndToken" TokenID="41" PatternValue="{LineTerminatorMacro}" IsWhitespace="True" />
                </Scope>
            </Scopes>
        </State>
        
    </States>

    <!-- Example Text -->
    <ExampleText>
        <![CDATA[
if 1 

    Func1(Func2(""));

endif;
        ]]>
    </ExampleText>

</SyntaxLanguage>
3) Insert an exclamation mark ('!') in front of the 'if' token
4) Move the caret in front of the 'endif' token
5) Insert another exclamation mark ('!')

As you can see, the idea is to comment out the if condition on the code block. We found that changing the code block to 'Func1(Func2())' does not cause any problem.

Joris

Comments (3)

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

Quick update... It's not happening in v4.0, only in v3.1. Still trying to figure out what the reason is.


Actipro Software Support

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

I think I've narrowed down the issue and can provide you with a build to try out if you'd like. If you'd like one, please email our support address.


Actipro Software Support

Posted 12 years ago by Joris Koster - Paragon Decision Technology
Avatar
Great! I've send you an email. Thanks for the fast response and solution.
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.