diff --git a/Wave/Utilities/SyntaxHighlighting/YamlLanguage.cs b/Wave/Utilities/SyntaxHighlighting/YamlLanguage.cs index 129aab1..4449630 100644 --- a/Wave/Utilities/SyntaxHighlighting/YamlLanguage.cs +++ b/Wave/Utilities/SyntaxHighlighting/YamlLanguage.cs @@ -11,17 +11,16 @@ public class YamlLanguage : ILanguage { public string CssClassName => "yml"; public IList Rules { get; } = [ - new LanguageRule(@"(?:\w+):", new Dictionary { - {0, ColorCode.Common.ScopeName.XmlAttribute} + new LanguageRule(@"(?m)^\s*(#.*)$", new Dictionary { + {1, ColorCode.Common.ScopeName.Comment} }), - new LanguageRule(@"#(?:.*)\b", new Dictionary { - {0, ColorCode.Common.ScopeName.Comment} + new LanguageRule(@"(?s)^(.+)(\-\-\-)", new Dictionary { + {1, ColorCode.Common.ScopeName.XmlCDataSection} }), - new LanguageRule("[^\\\\]\"(?:.*?)[^\\\\]\"", new Dictionary { - {0, ColorCode.Common.ScopeName.String} - }), - new LanguageRule(@"\-(?:\s\w.+)\b", new Dictionary { - {0, ColorCode.Common.ScopeName.XmlAttributeValue} + new LanguageRule("""(?m)^\s*(.+:|\- .+)( ".*")?( .+)?""", new Dictionary { + {1, ColorCode.Common.ScopeName.XmlAttributeValue}, + {2, ColorCode.Common.ScopeName.String}, + {3, ColorCode.Common.ScopeName.XmlAttribute} }) ];