Fix handling of escaped chars in strings

This commit is contained in:
Max Brunsfeld 2018-10-18 15:28:46 -07:00
parent ac53999dee
commit 4fb4e2960d
2 changed files with 14 additions and 1 deletions

View File

@ -306,3 +306,16 @@ a+=(foo "bar" $(baz))
(word) (word)
(string) (string)
(command_substitution (command (command_name (word))))))) (command_substitution (command (command_name (word)))))))
==============================
Escaped characters in strings
==============================
echo -ne "\033k$1\033\\" > /dev/stderr
---
(program
(redirected_statement
(command (command_name (word)) (word) (string (simple_expansion (variable_name))))
(file_redirect (word))))

View File

@ -425,7 +425,7 @@ module.exports = grammar({
'"' '"'
), ),
_string_content: $ => token(prec(-1, /([^"`$]|\\.)+/)), _string_content: $ => token(prec(-1, /([^"`$\\]|\\(.|\n))+/)),
array: $ => seq( array: $ => seq(
'(', '(',