Skip to content

Commit f365786

Browse files
committed
fixing escaped special chars
1 parent 68e0c33 commit f365786

1 file changed

Lines changed: 14 additions & 11 deletions

File tree

fluent.zig

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2767,17 +2767,20 @@ fn ParseRegexTreeDepth(comptime sq: []const RegexSymbol) type {
27672767
if (s.escaped and isCharFunction(s.char)) {
27682768
break :outer RegexUnit(BindCharFunction(s.char, s.negated), q);
27692769
} else {
2770-
switch (s.char) {
2771-
'.' => break :outer RegexUnit(anyRegex, q),
2772-
'^' => {
2773-
if (q != null) @compileError("Symbol '^' cannot have a quantifier.");
2774-
break :outer RegexUnit(startsWithRegex, null);
2775-
},
2776-
'$' => {
2777-
if (q != null) @compileError("Symbol '$' cannot have a quantifier.");
2778-
break :outer RegexUnit(endsWithRegex, null);
2779-
},
2780-
else => {},
2770+
2771+
if (!s.escaped) {
2772+
switch (s.char) {
2773+
'.' => break :outer RegexUnit(anyRegex, q),
2774+
'^' => {
2775+
if (q != null) @compileError("Symbol '^' cannot have a quantifier.");
2776+
break :outer RegexUnit(startsWithRegex, null);
2777+
},
2778+
'$' => {
2779+
if (q != null) @compileError("Symbol '$' cannot have a quantifier.");
2780+
break :outer RegexUnit(endsWithRegex, null);
2781+
},
2782+
else => {},
2783+
}
27812784
}
27822785
}
27832786

0 commit comments

Comments
 (0)