From a66e8f1c081687a7496fe91caa19bd50cb622fed Mon Sep 17 00:00:00 2001 From: Aadhavan Srinivasan Date: Tue, 29 Oct 2024 20:05:30 -0400 Subject: [PATCH] Concatenate every character if it is escaped --- main.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.go b/main.go index 5513aab..bc96293 100644 --- a/main.go +++ b/main.go @@ -67,7 +67,7 @@ func shuntingYard(re string) []postfixNode { } continue } - if re_runes[i] != '(' && re_runes[i] != '|' && re_runes[i] != '\\' { + if (re_runes[i] != '(' && re_runes[i] != '|' && re_runes[i] != '\\') || (i > 0 && re_runes[i-1] == '\\') { // Every character should be concatenated if it is escaped if i < len(re_runes)-1 { if re_runes[i+1] != '|' && re_runes[i+1] != '*' && re_runes[i+1] != '+' && re_runes[i+1] != '?' && re_runes[i+1] != ')' { re_postfix = append(re_postfix, CONCAT)