I've had success writing the .xml for the dynamic lexer for a couple of different file types, but I can't figure out what I'm doing wrong for .yml files.
Quick background on .yml files if you're not familiar with them... they're similar to INI files, but instead of using brackets around section names and equal signs with key/value pairs, everything is inferred from indentation:Section names must start in column 1 and end with a colon; keys must start with at least one space, end with a colon, followed by the value.
With my XML definition, comments are highlighted correctly and so are section names, but not keys (the "YmlKeyToken" definition below).
Here's a fragment of my xml (let me know if I should post more context).
Thanks in advance... I fear I'm just doing something obviously wrong but just can't see it.
Jeff
Quick background on .yml files if you're not familiar with them... they're similar to INI files, but instead of using brackets around section names and equal signs with key/value pairs, everything is inferred from indentation:
# comments start with a pound sign and terminate at the end of the line
section_name:
key: value
With my XML definition, comments are highlighted correctly and so are section names, but not keys (the "YmlKeyToken" definition below).
Here's a fragment of my xml (let me know if I should post more context).
Thanks in advance... I fear I'm just doing something obviously wrong but just can't see it.
Jeff
<SyntaxLanguage Key="Yaml" LanguageDefinitionVersion="4.0" Secure="True"
xmlns="http://ActiproSoftware/SyntaxEditor/4.0/LanguageDefinition">
<!-- Highlighting Styles -->
<Styles>
<Style Key="DefaultStyle" Name="Text" ForeColor="Black" />
<Style Key="YmlKeyStyle" ForeColor="#0000AA" />
<Style Key="SectionStyle" ForeColor="#AA0000" />
<Style Key="ValueStyle" ForeColor="#00AA00" />
<Style Key="CommentDefaultStyle" ForeColor="Gray" />
</Styles>
<!-- Macros -->
<Macros>
<!-- Redefine word macros to include hyphens -->
<Macro Key="WordMacro" Value="[a-zA-Z_0-9\-]" />
<Macro Key="NonWordMacro" Value="[^a-zA-Z_0-9\-]" />
</Macros>
<!-- States -->
<States>
<!-- Code -->
<State Key="DefaultState">
<!-- Patterns Groups -->
<PatternGroups>
<!-- Whitespace -->
<RegexPatternGroup TokenKey="WhitespaceToken" PatternValue="{WhitespaceMacro}+" IsWhitespace="True" />
<!-- Line Terminators -->
<RegexPatternGroup TokenKey="LineTerminatorToken" PatternValue="{LineTerminatorMacro}" IsWhitespace="True" />
<!-- Key -->
<RegexPatternGroup TokenKey="YmlKeyToken" PatternValue="^ {NonWordMacro}+ {WordMacro}+ {WhitespaceMacro}*" LookAhead="\: {WhitespaceMacro}* {WordMacro}+" Style="YmlKeyStyle" />
<!-- Section -->
<RegexPatternGroup TokenKey="YmlSectionToken" PatternValue="^ {WordMacro}+ {WhitespaceMacro}* \: {WhitespaceMacro}* {LineTerminatorMacro}" Style="SectionStyle" />
</PatternGroups>
<ChildStates>
<ChildState Key="CommentState" />
</ChildStates>
</State>