Fix handling of delimiter characters as part of bare words
Fixes atom/atom#18387
This commit is contained in:
parent
064119630b
commit
8426c3fefd
|
@ -23,8 +23,8 @@ echo ]]] ===
|
|||
|
||||
(program
|
||||
(command (command_name (word)) (concatenation (word) (word)))
|
||||
(command (command_name (word)) (word))
|
||||
(command (command_name (word)) (word) (word)))
|
||||
(command (command_name (word)) (concatenation))
|
||||
(command (command_name (word)) (concatenation) (word)))
|
||||
|
||||
=============================
|
||||
Simple variable expansions
|
||||
|
@ -142,6 +142,7 @@ Other variable expansion operators
|
|||
===================================
|
||||
|
||||
cat ${BAR} ${ABC=def} ${GHI:?jkl}
|
||||
[ "$a" != "${a#[Bc]}" ]
|
||||
|
||||
---
|
||||
|
||||
|
@ -150,7 +151,11 @@ cat ${BAR} ${ABC=def} ${GHI:?jkl}
|
|||
(command_name (word))
|
||||
(expansion (variable_name))
|
||||
(expansion (variable_name) (word))
|
||||
(expansion (variable_name) (word))))
|
||||
(expansion (variable_name) (word)))
|
||||
(test_command
|
||||
(binary_expression
|
||||
(string (simple_expansion (variable_name)))
|
||||
(string (expansion (variable_name) (concatenation (word)))))))
|
||||
|
||||
=============================
|
||||
Command substitutions
|
||||
|
|
|
@ -378,7 +378,7 @@ module.exports = grammar({
|
|||
_literal: $ => choice(
|
||||
$.concatenation,
|
||||
$._primary_expression,
|
||||
alias(prec(-2, $._special_characters), $.word)
|
||||
alias(prec(-2, repeat1($._special_character)), $.word)
|
||||
),
|
||||
|
||||
_primary_expression: $ => choice(
|
||||
|
@ -395,18 +395,18 @@ module.exports = grammar({
|
|||
concatenation: $ => prec(-1, seq(
|
||||
choice(
|
||||
$._primary_expression,
|
||||
$._special_characters,
|
||||
$._special_character,
|
||||
),
|
||||
repeat1(prec(-1, seq(
|
||||
$._concat,
|
||||
choice(
|
||||
$._primary_expression,
|
||||
$._special_characters,
|
||||
$._special_character,
|
||||
)
|
||||
))),
|
||||
)),
|
||||
|
||||
_special_characters: $ => token(prec(-1, repeat1(choice('{', '}', '[', ']')))),
|
||||
_special_character: $ => token(prec(-1, choice('{', '}', '[', ']'))),
|
||||
|
||||
string: $ => seq(
|
||||
'"',
|
||||
|
|
|
@ -1518,9 +1518,12 @@
|
|||
"content": {
|
||||
"type": "PREC",
|
||||
"value": -2,
|
||||
"content": {
|
||||
"type": "REPEAT1",
|
||||
"content": {
|
||||
"type": "SYMBOL",
|
||||
"name": "_special_characters"
|
||||
"name": "_special_character"
|
||||
}
|
||||
}
|
||||
},
|
||||
"named": true,
|
||||
|
@ -1580,7 +1583,7 @@
|
|||
},
|
||||
{
|
||||
"type": "SYMBOL",
|
||||
"name": "_special_characters"
|
||||
"name": "_special_character"
|
||||
}
|
||||
]
|
||||
},
|
||||
|
@ -1605,7 +1608,7 @@
|
|||
},
|
||||
{
|
||||
"type": "SYMBOL",
|
||||
"name": "_special_characters"
|
||||
"name": "_special_character"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
@ -1616,13 +1619,11 @@
|
|||
]
|
||||
}
|
||||
},
|
||||
"_special_characters": {
|
||||
"_special_character": {
|
||||
"type": "TOKEN",
|
||||
"content": {
|
||||
"type": "PREC",
|
||||
"value": -1,
|
||||
"content": {
|
||||
"type": "REPEAT1",
|
||||
"content": {
|
||||
"type": "CHOICE",
|
||||
"members": [
|
||||
|
@ -1645,7 +1646,6 @@
|
|||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"string": {
|
||||
"type": "SEQ",
|
||||
|
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue