Add support for empty expansions (#82)
Fixes https://github.com/tree-sitter/tree-sitter-bash/issues/57
This commit is contained in:
parent
38e8ba4a3d
commit
f226a4b55a
|
@ -57,6 +57,8 @@ echo $# $* $@ $!
|
||||||
Variable expansions
|
Variable expansions
|
||||||
=============================
|
=============================
|
||||||
|
|
||||||
|
echo ${}
|
||||||
|
echo ${#}
|
||||||
echo ${var1#*#}
|
echo ${var1#*#}
|
||||||
echo ${!abc}
|
echo ${!abc}
|
||||||
echo ${abc}
|
echo ${abc}
|
||||||
|
@ -68,6 +70,8 @@ echo ${abc:
|
||||||
---
|
---
|
||||||
|
|
||||||
(program
|
(program
|
||||||
|
(command (command_name (word)) (expansion))
|
||||||
|
(command (command_name (word)) (expansion))
|
||||||
(command (command_name (word)) (expansion (variable_name) (word)))
|
(command (command_name (word)) (expansion (variable_name) (word)))
|
||||||
(command (command_name (word)) (expansion (variable_name)))
|
(command (command_name (word)) (expansion (variable_name)))
|
||||||
(command (command_name (word)) (expansion (variable_name)))
|
(command (command_name (word)) (expansion (variable_name)))
|
||||||
|
|
|
@ -489,7 +489,7 @@ module.exports = grammar({
|
||||||
expansion: $ => seq(
|
expansion: $ => seq(
|
||||||
'${',
|
'${',
|
||||||
optional(choice('#', '!')),
|
optional(choice('#', '!')),
|
||||||
choice(
|
optional(choice(
|
||||||
seq(
|
seq(
|
||||||
$.variable_name,
|
$.variable_name,
|
||||||
'=',
|
'=',
|
||||||
|
@ -510,7 +510,7 @@ module.exports = grammar({
|
||||||
':', ':?', '=', ':-', '%', '-', '#'
|
':', ':?', '=', ':-', '%', '-', '#'
|
||||||
))
|
))
|
||||||
),
|
),
|
||||||
),
|
)),
|
||||||
'}'
|
'}'
|
||||||
),
|
),
|
||||||
|
|
||||||
|
|
|
@ -2137,6 +2137,9 @@
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"type": "CHOICE",
|
||||||
|
"members": [
|
||||||
{
|
{
|
||||||
"type": "CHOICE",
|
"type": "CHOICE",
|
||||||
"members": [
|
"members": [
|
||||||
|
@ -2265,6 +2268,11 @@
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"type": "BLANK"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"type": "STRING",
|
"type": "STRING",
|
||||||
"value": "}"
|
"value": "}"
|
||||||
|
|
|
@ -604,7 +604,7 @@
|
||||||
"fields": {},
|
"fields": {},
|
||||||
"children": {
|
"children": {
|
||||||
"multiple": true,
|
"multiple": true,
|
||||||
"required": true,
|
"required": false,
|
||||||
"types": [
|
"types": [
|
||||||
{
|
{
|
||||||
"type": "_primary_expression",
|
"type": "_primary_expression",
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue