Skip to content

Commit d9b4fc6

Browse files
author
Pedro Fonseca
committed
syntax highlight fixes
1 parent 3c42f95 commit d9b4fc6

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

Zelda/ELanguage/ELSyntax.cs

+4-7
Original file line numberDiff line numberDiff line change
@@ -101,11 +101,11 @@ public ELSyntax(List<string> fields, List<string> extraFuncs)
101101
// HTML tags: <tagName args> and <//tagName>
102102
reHTML = new Regex($@"\<(?://)?(?:font|img|b|u|i)\b.*?\>", RegexOptions.IgnoreCase | RegexOptions.Singleline | RegexOptions.Compiled);
103103

104-
// literal blocks: /# literal text #/
105-
reLiteral = new Regex(@"/#.*?#/", RegexOptions.IgnoreCase | RegexOptions.Singleline | RegexOptions.Compiled);
104+
// literal blocks: /#literaltext#/ or /*literaltext/*
105+
reLiteral = new Regex(@"/#.*?#/|/\*.*?/\*", RegexOptions.IgnoreCase | RegexOptions.Singleline | RegexOptions.Compiled);
106106

107107
// escaped: chars escaped with fwd-slash, or anything between /* and /*
108-
reEscaped = new Regex(@"(/\*.*?/\*)|(?<=[^#])((?:/\r\n|/\D)+)", RegexOptions.IgnoreCase | RegexOptions.Singleline | RegexOptions.Compiled);
108+
reEscaped = new Regex(@"(?<=[^#])((?:/\r?\n|/\D)+)", RegexOptions.IgnoreCase | RegexOptions.Singleline | RegexOptions.Compiled);
109109

110110
// comment: special fields named '/' -> "[//, this is a comment]"
111111
reComment = new Regex(@"\[//+,.*?\]|^##.*$", RegexOptions.IgnoreCase | RegexOptions.Multiline | RegexOptions.Compiled);
@@ -177,10 +177,7 @@ public List<ELToken> getTokens(string expression, bool doComments = true)
177177
// escaped blocks/chars: /* text /*, // /x
178178
hits = reEscaped.Matches(expression);
179179
foreach (Match m in hits)
180-
if (!string.IsNullOrEmpty(m.Groups[1].Value))
181-
tokens.Add(new ELToken(ELTokenType.Escaped, m.Groups[1].Value, m.Groups[1].Index));
182-
else
183-
tokens.Add(new ELToken(ELTokenType.Escaped, m.Groups[2].Value, m.Groups[2].Index));
180+
tokens.Add(new ELToken(ELTokenType.Escaped, m.Groups[1].Value, m.Groups[1].Index));
184181

185182
// HTML
186183
hits = reHTML.Matches(expression);

0 commit comments

Comments
 (0)