Posted 18 years ago
by Steven Liu
I am trying to define a simple language that only contains #IF and #ENDIF pre-processor directives, nothing else. the xml file is:
FYI, I define EndIfState in a way that will not consume \n char.
SyntaxEditor cannot load that file. As I was trying to narrow down to the cause, I found that it will load if I make 2 undesirable changes to EndIfSate:
1. Change LookAhead="ENDIF{NonWordMacro}" to LookAhead="ENDIF"
2. Change EndScope's CaseSensitivity="AutoCorrect" to CaseSensitivity="Insensitive"
the modifed EndIfState is:Would you shed some light on this? Thanks.
Steven
<SyntaxLanguage Key="TEST" LanguageDefinitionVersion="3.0" Secure="True" xmlns="http://ActiproSoftware/SyntaxEditor/3.0/LanguageDefinition">
<Styles>
<Style Key="IfWordStyle" ForeColor="Blue" BackColor="Default" Bold="False" Italic="False" Underline="False" />
</Styles>
<States>
<State Key="DefaultState">
<ChildStates>
<ChildState Key="IfState" />
<ChildState Key="EndIfState" />
</ChildStates>
</State>
<State Key="IfState">
<Scopes>
<Scope>
<ExplicitPatternGroup Type="StartScope" TokenKey="IfStartToken" Style="IfWordStyle" PatternValue="#IF" LookAhead="{NonWordMacro}" CaseSensitivity="AutoCorrect" />
<RegexPatternGroup Type="EndScope" TokenKey="IfStartToken2" Style="DefaultStyle" PatternValue="\n" CaseSensitivity="Insensitive" />
</Scope>
</Scopes>
</State>
<State Key="EndIfState">
<Scopes>
<Scope>
<ExplicitPatternGroup Type="StartScope" TokenKey="IfEndToken" Style="IfWordStyle" PatternValue="#" LookAhead="ENDIF{NonWordMacro}" CaseSensitivity="AutoCorrect" />
<RegexPatternGroup Type="EndScope" TokenKey="IfEndToken2" Style="IfWordStyle" PatternValue="ENDIF" LookAhead="{NonWordMacro}" CaseSensitivity="AutoCorrect" />
</Scope>
</Scopes>
</State>
</States>
</SyntaxLanguage>
SyntaxEditor cannot load that file. As I was trying to narrow down to the cause, I found that it will load if I make 2 undesirable changes to EndIfSate:
1. Change LookAhead="ENDIF{NonWordMacro}" to LookAhead="ENDIF"
2. Change EndScope's CaseSensitivity="AutoCorrect" to CaseSensitivity="Insensitive"
the modifed EndIfState is:
<State Key="EndIfState">
<Scopes>
<Scope>
<ExplicitPatternGroup Type="StartScope" TokenKey="IfEndToken" Style="IfWordStyle" PatternValue="#" LookAhead="ENDIF" CaseSensitivity="AutoCorrect" />
<RegexPatternGroup Type="EndScope" TokenKey="IfEndToken2" Style="IfWordStyle" PatternValue="ENDIF" LookAhead="{NonWordMacro}" CaseSensitivity="Insensitive" />
</Scope>
</Scopes>
</State>
Steven