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}
|
||||||
echo ${abc:-def}
|
echo ${abc:-def}
|
||||||
|
echo ${abc:- }
|
||||||
|
echo ${abc:
|
||||||
|
}
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
(program
|
(program
|
||||||
(command (command_name (word)) (expansion (variable_name)))
|
(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
|
Other variable expansion operators
|
||||||
|
|
|
@ -295,7 +295,7 @@ module.exports = grammar({
|
||||||
seq(
|
seq(
|
||||||
$._variable_name,
|
$._variable_name,
|
||||||
choice(':', ':?', '=', ':-', '%', '/'),
|
choice(':', ':?', '=', ':-', '%', '/'),
|
||||||
$._expression
|
optional($._expression)
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
'}'
|
'}'
|
||||||
|
|
|
@ -1084,8 +1084,16 @@
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "SYMBOL",
|
"type": "CHOICE",
|
||||||
"name": "_expression"
|
"members": [
|
||||||
|
{
|
||||||
|
"type": "SYMBOL",
|
||||||
|
"name": "_expression"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "BLANK"
|
||||||
|
}
|
||||||
|
]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue