From f36578624c3d883b29776148cd0e305910be5270 Mon Sep 17 00:00:00 2001 From: andrewCodeDev Date: Thu, 5 Sep 2024 23:41:44 -0700 Subject: [PATCH] fixing escaped special chars --- fluent.zig | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/fluent.zig b/fluent.zig index 53dbcab..903e240 100644 --- a/fluent.zig +++ b/fluent.zig @@ -2767,17 +2767,20 @@ fn ParseRegexTreeDepth(comptime sq: []const RegexSymbol) type { if (s.escaped and isCharFunction(s.char)) { break :outer RegexUnit(BindCharFunction(s.char, s.negated), q); } else { - switch (s.char) { - '.' => break :outer RegexUnit(anyRegex, q), - '^' => { - if (q != null) @compileError("Symbol '^' cannot have a quantifier."); - break :outer RegexUnit(startsWithRegex, null); - }, - '$' => { - if (q != null) @compileError("Symbol '$' cannot have a quantifier."); - break :outer RegexUnit(endsWithRegex, null); - }, - else => {}, + + if (!s.escaped) { + switch (s.char) { + '.' => break :outer RegexUnit(anyRegex, q), + '^' => { + if (q != null) @compileError("Symbol '^' cannot have a quantifier."); + break :outer RegexUnit(startsWithRegex, null); + }, + '$' => { + if (q != null) @compileError("Symbol '$' cannot have a quantifier."); + break :outer RegexUnit(endsWithRegex, null); + }, + else => {}, + } } }