Don't mark lone backslashes as escape sequences
This commit is contained in:
parent
98fdcad2a0
commit
71fe2fd68b
|
@ -57,9 +57,7 @@ ENV KEY "expansions: $FOO ${BAR}"
|
|||
(env_instruction
|
||||
(env_pair
|
||||
(unquoted_string)
|
||||
(double_quoted_string
|
||||
(double_quoted_escape_sequence)
|
||||
(double_quoted_escape_sequence))))
|
||||
(double_quoted_string)))
|
||||
(env_instruction
|
||||
(env_pair
|
||||
(unquoted_string)
|
||||
|
@ -106,9 +104,7 @@ ENV KEY 'not escape sequences: \a \n'
|
|||
(env_instruction
|
||||
(env_pair
|
||||
(unquoted_string)
|
||||
(single_quoted_string
|
||||
(single_quoted_escape_sequence)
|
||||
(single_quoted_escape_sequence)))))
|
||||
(single_quoted_string))))
|
||||
|
||||
==========================
|
||||
Unquoted strings
|
||||
|
|
10
grammar.js
10
grammar.js
|
@ -391,6 +391,7 @@ module.exports = grammar({
|
|||
choice(
|
||||
token.immediate(/[^"\n\\\$]+/),
|
||||
$.double_quoted_escape_sequence,
|
||||
"\\",
|
||||
$._immediate_expansion
|
||||
)
|
||||
),
|
||||
|
@ -404,7 +405,8 @@ module.exports = grammar({
|
|||
repeat(
|
||||
choice(
|
||||
token.immediate(/[^'\n\\]+/),
|
||||
$.single_quoted_escape_sequence
|
||||
$.single_quoted_escape_sequence,
|
||||
"\\",
|
||||
)
|
||||
),
|
||||
"'"
|
||||
|
@ -422,16 +424,14 @@ module.exports = grammar({
|
|||
double_quoted_escape_sequence: ($) => token.immediate(
|
||||
choice(
|
||||
"\\\\",
|
||||
"\\\"",
|
||||
"\\"
|
||||
"\\\""
|
||||
)
|
||||
),
|
||||
|
||||
single_quoted_escape_sequence: ($) => token.immediate(
|
||||
choice(
|
||||
"\\\\",
|
||||
"\\'",
|
||||
"\\"
|
||||
"\\'"
|
||||
)
|
||||
),
|
||||
|
||||
|
|
Loading…
Reference in a new issue