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
|
||||
=============================
|
||||
|
||||
echo ${}
|
||||
echo ${#}
|
||||
echo ${var1#*#}
|
||||
echo ${!abc}
|
||||
echo ${abc}
|
||||
|
@ -68,6 +70,8 @@ echo ${abc:
|
|||
---
|
||||
|
||||
(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)))
|
||||
(command (command_name (word)) (expansion (variable_name)))
|
||||
|
|
|
@ -489,7 +489,7 @@ module.exports = grammar({
|
|||
expansion: $ => seq(
|
||||
'${',
|
||||
optional(choice('#', '!')),
|
||||
choice(
|
||||
optional(choice(
|
||||
seq(
|
||||
$.variable_name,
|
||||
'=',
|
||||
|
@ -510,7 +510,7 @@ module.exports = grammar({
|
|||
':', ':?', '=', ':-', '%', '-', '#'
|
||||
))
|
||||
),
|
||||
),
|
||||
)),
|
||||
'}'
|
||||
),
|
||||
|
||||
|
|
|
@ -2137,6 +2137,9 @@
|
|||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "CHOICE",
|
||||
"members": [
|
||||
{
|
||||
"type": "CHOICE",
|
||||
"members": [
|
||||
|
@ -2265,6 +2268,11 @@
|
|||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "BLANK"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "STRING",
|
||||
"value": "}"
|
||||
|
|
|
@ -604,7 +604,7 @@
|
|||
"fields": {},
|
||||
"children": {
|
||||
"multiple": true,
|
||||
"required": true,
|
||||
"required": false,
|
||||
"types": [
|
||||
{
|
||||
"type": "_primary_expression",
|
||||
|
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue