1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

Correct parser to ignore escaped quotes when not in quotes already

Related to #8481
This commit is contained in:
James Cammarata 2014-08-11 09:34:14 -05:00
parent e66e4adedc
commit 9f34ea54f5

View file

@ -26,9 +26,9 @@ def _get_quote_state(token, quote_char):
for idx, cur_char in enumerate(token):
if idx > 0:
prev_char = token[idx-1]
if cur_char in '"\'':
if cur_char in '"\'' and prev_char != '\\':
if quote_char:
if cur_char == quote_char and prev_char != '\\':
if cur_char == quote_char:
quote_char = None
else:
quote_char = cur_char