我正在修改C#中的AvalonEdit代码,以创建另一种语法高亮显示。 我想为LOG文件创建自己的样式,突出显示的代码如下所示:
前蓝色时间和绿色后面的文字(信息),橙色(警告),红色(错误)。 对于单行日志,没有问题,但对于多行。所以我将RuleSet更改为Spans:
<SyntaxDefinition name="LOG" extensions=".log" xmlns="http://icsharpcode.net/sharpdevelop/syntaxdefinition/2008">
<Color name="Time" foreground="#38a1d4" />
<Color name="Info" foreground="#69b26a" />
<Color name="Warning" foreground="#e1b561" />
<Color name="Error" foreground="#db5e5e" />
<RuleSet>
<Rule color="Time">\d\d:\d\d:\d\d</Rule>
<Rule color="Time">\d\d:\d\d:\d\d</Rule>
<Span color="Info" multiline="true">
<Begin>\[I\]:</Begin>
<End>[\s\S](?=\n\d\d:\d\d:\d\d)</End>
</Span>
<Span color="Warning" multiline="true">
<Begin>\[W\]:</Begin>
<End>[\s\S](?=\n\d\d:\d\d:\d\d)</End>
</Span>
<Span color="Error" multiline="true">
<Begin>\[E\]:</Begin>
<End>[\s\S](?=\n\d\d:\d\d:\d\d)</End>
</Span>
</RuleSet>
</SyntaxDefinition>
但为什么End Span不能用于我的多线?