Allow `!` operator in variable expansions

Fixes #21
This commit is contained in:
Max Brunsfeld 2018-08-06 10:42:48 -07:00
parent 08cf72b615
commit 3a9b32284e
5 changed files with 20530 additions and 20500 deletions

View File

@ -56,6 +56,7 @@ echo $# $* $@
Variable expansions Variable expansions
============================= =============================
echo ${!abc}
echo ${abc} echo ${abc}
echo ${abc:-def} echo ${abc:-def}
echo ${abc:- } echo ${abc:- }
@ -65,6 +66,7 @@ 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)))
(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)))

View File

@ -437,7 +437,7 @@ module.exports = grammar({
expansion: $ => seq( expansion: $ => seq(
'${', '${',
optional('#'), optional(choice('#', '!')),
choice( choice(
seq( seq(
$.variable_name, $.variable_name,

View File

@ -9,7 +9,6 @@ examples/bash-it/completion/available/docker-compose.completion.bash
examples/bash-it/completion/available/jboss7.completion.bash examples/bash-it/completion/available/jboss7.completion.bash
examples/bash-it/completion/available/gh.completion.bash examples/bash-it/completion/available/gh.completion.bash
examples/bash-it/completion/available/bundler.completion.bash examples/bash-it/completion/available/bundler.completion.bash
examples/bash-it/completion/available/gradle.completion.bash
examples/bash-it/completion/available/drush.completion.bash examples/bash-it/completion/available/drush.completion.bash
examples/bash-it/completion/available/hub.completion.bash examples/bash-it/completion/available/hub.completion.bash
examples/bash-it/completion/available/docker-machine.completion.bash examples/bash-it/completion/available/docker-machine.completion.bash
@ -17,7 +16,6 @@ examples/bash-it/completion/available/git.completion.bash
examples/bash-it/completion/available/vagrant.completion.bash examples/bash-it/completion/available/vagrant.completion.bash
examples/bash-it/completion/available/defaults.completion.bash examples/bash-it/completion/available/defaults.completion.bash
examples/bash-it/completion/available/packer.completion.bash examples/bash-it/completion/available/packer.completion.bash
examples/bash-it/completion/available/salt.completion.bash
examples/bash-it/completion/available/vault.completion.bash examples/bash-it/completion/available/vault.completion.bash
examples/bash-it/completion/available/docker.completion.bash examples/bash-it/completion/available/docker.completion.bash
examples/bash-it/completion/available/tmux.completion.bash examples/bash-it/completion/available/tmux.completion.bash
@ -26,14 +24,12 @@ examples/bash-it/completion/available/apm.completion.bash
examples/bash-it/completion/available/git_flow.completion.bash examples/bash-it/completion/available/git_flow.completion.bash
examples/bash-it/lib/preexec.bash examples/bash-it/lib/preexec.bash
examples/bash-it/lib/composure.bash examples/bash-it/lib/composure.bash
examples/bash-it/lib/search.bash
examples/bash-it/test_lib/bats-support/src/lang.bash examples/bash-it/test_lib/bats-support/src/lang.bash
examples/bash-it/test_lib/bats-support/src/output.bash examples/bash-it/test_lib/bats-support/src/output.bash
examples/bash-it/test_lib/bats-assert/src/assert.bash examples/bash-it/test_lib/bats-assert/src/assert.bash
examples/bash-it/themes/hawaii50/hawaii50.theme.bash examples/bash-it/themes/hawaii50/hawaii50.theme.bash
examples/bash-it/themes/dulcie/dulcie.theme.bash examples/bash-it/themes/dulcie/dulcie.theme.bash
examples/bash-it/themes/colors.theme.bash examples/bash-it/themes/colors.theme.bash
examples/bash-it/themes/rana/rana.theme.bash
examples/bash-it/themes/morris/morris.theme.bash examples/bash-it/themes/morris/morris.theme.bash
examples/bash-it/themes/powerline/powerline.base.bash examples/bash-it/themes/powerline/powerline.base.bash
examples/bash-it/themes/base.theme.bash examples/bash-it/themes/base.theme.bash

13
src/grammar.json vendored
View File

@ -1774,8 +1774,17 @@
"type": "CHOICE", "type": "CHOICE",
"members": [ "members": [
{ {
"type": "STRING", "type": "CHOICE",
"value": "#" "members": [
{
"type": "STRING",
"value": "#"
},
{
"type": "STRING",
"value": "!"
}
]
}, },
{ {
"type": "BLANK" "type": "BLANK"

41009
src/parser.c vendored

File diff suppressed because it is too large Load Diff