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
|
(program
|
||||||
(command (command_name (word)) (concatenation (word) (word)))
|
(command (command_name (word)) (concatenation (word) (word)))
|
||||||
(command (command_name (word)) (word))
|
(command (command_name (word)) (concatenation))
|
||||||
(command (command_name (word)) (word) (word)))
|
(command (command_name (word)) (concatenation) (word)))
|
||||||
|
|
||||||
=============================
|
=============================
|
||||||
Simple variable expansions
|
Simple variable expansions
|
||||||
|
@ -142,6 +142,7 @@ Other variable expansion operators
|
||||||
===================================
|
===================================
|
||||||
|
|
||||||
cat ${BAR} ${ABC=def} ${GHI:?jkl}
|
cat ${BAR} ${ABC=def} ${GHI:?jkl}
|
||||||
|
[ "$a" != "${a#[Bc]}" ]
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
@ -150,7 +151,11 @@ cat ${BAR} ${ABC=def} ${GHI:?jkl}
|
||||||
(command_name (word))
|
(command_name (word))
|
||||||
(expansion (variable_name))
|
(expansion (variable_name))
|
||||||
(expansion (variable_name) (word))
|
(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
|
Command substitutions
|
||||||
|
|
|
@ -378,7 +378,7 @@ module.exports = grammar({
|
||||||
_literal: $ => choice(
|
_literal: $ => choice(
|
||||||
$.concatenation,
|
$.concatenation,
|
||||||
$._primary_expression,
|
$._primary_expression,
|
||||||
alias(prec(-2, $._special_characters), $.word)
|
alias(prec(-2, repeat1($._special_character)), $.word)
|
||||||
),
|
),
|
||||||
|
|
||||||
_primary_expression: $ => choice(
|
_primary_expression: $ => choice(
|
||||||
|
@ -395,18 +395,18 @@ module.exports = grammar({
|
||||||
concatenation: $ => prec(-1, seq(
|
concatenation: $ => prec(-1, seq(
|
||||||
choice(
|
choice(
|
||||||
$._primary_expression,
|
$._primary_expression,
|
||||||
$._special_characters,
|
$._special_character,
|
||||||
),
|
),
|
||||||
repeat1(prec(-1, seq(
|
repeat1(prec(-1, seq(
|
||||||
$._concat,
|
$._concat,
|
||||||
choice(
|
choice(
|
||||||
$._primary_expression,
|
$._primary_expression,
|
||||||
$._special_characters,
|
$._special_character,
|
||||||
)
|
)
|
||||||
))),
|
))),
|
||||||
)),
|
)),
|
||||||
|
|
||||||
_special_characters: $ => token(prec(-1, repeat1(choice('{', '}', '[', ']')))),
|
_special_character: $ => token(prec(-1, choice('{', '}', '[', ']'))),
|
||||||
|
|
||||||
string: $ => seq(
|
string: $ => seq(
|
||||||
'"',
|
'"',
|
||||||
|
|
|
@ -1519,8 +1519,11 @@
|
||||||
"type": "PREC",
|
"type": "PREC",
|
||||||
"value": -2,
|
"value": -2,
|
||||||
"content": {
|
"content": {
|
||||||
"type": "SYMBOL",
|
"type": "REPEAT1",
|
||||||
"name": "_special_characters"
|
"content": {
|
||||||
|
"type": "SYMBOL",
|
||||||
|
"name": "_special_character"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"named": true,
|
"named": true,
|
||||||
|
@ -1580,7 +1583,7 @@
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "SYMBOL",
|
"type": "SYMBOL",
|
||||||
"name": "_special_characters"
|
"name": "_special_character"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
@ -1605,7 +1608,7 @@
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "SYMBOL",
|
"type": "SYMBOL",
|
||||||
"name": "_special_characters"
|
"name": "_special_character"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
@ -1616,34 +1619,31 @@
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"_special_characters": {
|
"_special_character": {
|
||||||
"type": "TOKEN",
|
"type": "TOKEN",
|
||||||
"content": {
|
"content": {
|
||||||
"type": "PREC",
|
"type": "PREC",
|
||||||
"value": -1,
|
"value": -1,
|
||||||
"content": {
|
"content": {
|
||||||
"type": "REPEAT1",
|
"type": "CHOICE",
|
||||||
"content": {
|
"members": [
|
||||||
"type": "CHOICE",
|
{
|
||||||
"members": [
|
"type": "STRING",
|
||||||
{
|
"value": "{"
|
||||||
"type": "STRING",
|
},
|
||||||
"value": "{"
|
{
|
||||||
},
|
"type": "STRING",
|
||||||
{
|
"value": "}"
|
||||||
"type": "STRING",
|
},
|
||||||
"value": "}"
|
{
|
||||||
},
|
"type": "STRING",
|
||||||
{
|
"value": "["
|
||||||
"type": "STRING",
|
},
|
||||||
"value": "["
|
{
|
||||||
},
|
"type": "STRING",
|
||||||
{
|
"value": "]"
|
||||||
"type": "STRING",
|
}
|
||||||
"value": "]"
|
]
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue