mirror of
ssh://git.janware.com/srv/git/janware/proj/jw-python
synced 2026-01-15 09:53:32 +01:00
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 <jan@janware.com>
This commit is contained in:
parent
27e2a49d1e
commit
49e9b5ab5d
1 changed files with 1 additions and 1 deletions
|
|
@ -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.
|
||||
])
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue