Handle empty default value during variable expansion (#1)
* Handle empty default value during variable expansion * Make expression after colon optional As suggested by @maxbrunsfeld
This commit is contained in:
parent
bda693990e
commit
741cfce4b4
|
@ -28,12 +28,17 @@ Variable expansions
|
|||
|
||||
echo ${abc}
|
||||
echo ${abc:-def}
|
||||
echo ${abc:- }
|
||||
echo ${abc:
|
||||
}
|
||||
|
||||
---
|
||||
|
||||
(program
|
||||
(command (command_name (word)) (expansion (variable_name)))
|
||||
(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))))
|
||||
|
||||
===================================
|
||||
Other variable expansion operators
|
||||
|
|
|
@ -295,7 +295,7 @@ module.exports = grammar({
|
|||
seq(
|
||||
$._variable_name,
|
||||
choice(':', ':?', '=', ':-', '%', '/'),
|
||||
$._expression
|
||||
optional($._expression)
|
||||
)
|
||||
),
|
||||
'}'
|
||||
|
|
|
@ -1084,8 +1084,16 @@
|
|||
]
|
||||
},
|
||||
{
|
||||
"type": "SYMBOL",
|
||||
"name": "_expression"
|
||||
"type": "CHOICE",
|
||||
"members": [
|
||||
{
|
||||
"type": "SYMBOL",
|
||||
"name": "_expression"
|
||||
},
|
||||
{
|
||||
"type": "BLANK"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue