Posted 20 years ago
by Steven Liu
I defined a SectionState which looks ahead to either the next SECTION keyword or document end to close its scope. The following LookAhead pattern allows to exclude multiple blank lines in the section:
The complete syntax definition is:
Most of the time it works.
However, if you have following document (line numbers showed):Position cursor at line 3, type: a=1<ENTER>
the content divider should moved to line 3, but it remains at line 1.
It can be fixed by selecting "Reparse Document".
Then, if line 3 is deleted, content divider of "SECTION s1" disappears.
Again it can be fixed by selecting "Reparse Document".
Steven
PatternValue="\n" LookAhead="[ \t\n]*((SECTION)|(\z))"
<SyntaxLanguage Key="MYTEST" LanguageDefinitionVersion="2.0" Secure="True" xmlns="http://ActiproSoftware/SyntaxEditor/2.0/LanguageDefinition">
<Styles>
<Style Key="SectionWordStyle" ForeColor="Blue" BackColor="Default" Bold="False" Italic="False" Underline="False" />
</Styles>
<States>
<State Key="DefaultState">
<ChildStates>
<ChildState Key="SectionState" />
</ChildStates>
</State>
<State Key="SectionState" >
<Scopes>
<Scope>
<ExplicitPatternGroup Type="StartScope" Token="SectionStartToken" Style="SectionWordStyle" PatternValue="SECTION" LookAhead="{NonWordMacro}" CaseSensitivity="AutoCorrect" />
<RegexPatternGroup Type="EndScope" Token="SectionEndToken" Style="DefaultStyle" PatternValue="\n" LookAhead="[ \t\n]*((SECTION)|(\z))" CaseSensitivity="Insensitive" IsContentDivider="True" />
</Scope>
</Scopes>
</State>
</States>
</SyntaxLanguage>
However, if you have following document (line numbers showed):
1 SECTION s1
2
3
4 SECTION s2
5
the content divider should moved to line 3, but it remains at line 1.
It can be fixed by selecting "Reparse Document".
Then, if line 3 is deleted, content divider of "SECTION s1" disappears.
Again it can be fixed by selecting "Reparse Document".
Steven