From 49e9b5ab5d5aed41f7adf138496fd6c14c6f47aa Mon Sep 17 00:00:00 2001 From: Jan Lindemann Date: Fri, 4 Jul 2025 08:59:58 +0200 Subject: [PATCH] algo.ShuntingYard.tokenize(): Allow mixed quotes "A string which contains 'single quotes'" or 'a string containing "double quotes"' is not tokenized as quoted. Fix that. Signed-off-by: Jan Lindemann --- tools/python/jwutils/algo/ShuntingYard.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/python/jwutils/algo/ShuntingYard.py b/tools/python/jwutils/algo/ShuntingYard.py index c641b09..dc20e6e 100644 --- a/tools/python/jwutils/algo/ShuntingYard.py +++ b/tools/python/jwutils/algo/ShuntingYard.py @@ -88,7 +88,7 @@ class ShuntingYard(object): # export scanner = re.Scanner([ (regex, lambda scanner,token:(KEYW, token)), - (r"('|\")[^'\"]*('|\")", lambda scanner,token:(QUOTED, token[1:-1])), + (r"\"[^\"]*\"|'[^']*'", lambda scanner,token:(QUOTED, token[1:-1])), (r"[^\s()]+", lambda scanner,token:(ARG, token)), (r"\s+", None), # None == skip token. ])