With Avalon Edit, I'm looking for a way to provide a highlighting format while inside something that is already formatted.
That is, I'd like to highlight thing inside quotes, but within those quotes I have another syntax that can be added that starts with ${
and ends with }
.
By default, it seems that the syntax highlighting stops once it enters a 'begin' and doesn't look for any others until the end is reached.
<Span color="ParamName">
<Begin>"</Begin>
<End>(?=:)</End>
</Span>
<Span color="Variable" multiline="false">
<Begin>\${</Begin>
<End>}</End>
</Span>
So here the ${
syntax is only colorized if it is not within a ParamName
("
). is there a way to allow my Variable highlighting to work even if it is in a ParamName
(yes ParamName
is from JSON formatting, I'd like my highlighting to work no matter where it shows in the JSON syntax)?
Full Highlighter code:
<Keywords color="Digits" >
<Word>true</Word>
<Word>false</Word>
</Keywords>
<Span color="Value" multiline="true">
<Begin>
(?<=:)\040?"[^"]*
</Begin>
<End>"</End>
</Span>
<Span color="ParamName">
<Begin>"</Begin>
<End>(?=:)</End>
</Span>
<Span color="Variable" multiline="false">
<Begin>\${</Begin>
<End>}</End>
</Span>
<Rule color="Digits">\b0[xX][0-9a-fA-F]+|(\b\d+(\.[0-9]+)?|\.[0-9]+)([eE][+-]?[0-9]+)?</Rule>
A <Span>
switches to another <RuleSet>
that is active within the span. By default, that's an empty rule set, so nothing else is active.
If you want a rule to apply within a span, move it to the nested ruleset:
<Span color="ParamName">
<Begin>"</Begin>
<End>(?=:)</End>
<RuleSet>
<Span color="Variable" multiline="false">
<Begin>\${</Begin>
<End>}</End>
</Span>
</RuleSet>
</Span>