Allow ;; at end of line of case item

This commit is contained in:
Max Brunsfeld 2018-03-01 14:04:29 -08:00
parent 27b4b7835e
commit c7484ad85f
6 changed files with 41123 additions and 23182 deletions

View File

@ -109,8 +109,7 @@ case "opt" in
;;
b)
echo b
;;
echo b;;
esac
case "$Z" in

View File

@ -133,16 +133,22 @@ module.exports = grammar({
$._expression,
repeat(seq('|', $._expression)),
')',
repeat($._terminated_statement),
';;'
optional(seq(
repeat($._terminated_statement),
optional($._statement)
)),
prec(1, ';;')
),
last_case_item: $ => seq(
$._expression,
repeat(seq('|', $._expression)),
')',
repeat($._terminated_statement),
optional(';;')
optional(seq(
repeat($._terminated_statement),
optional($._statement)
)),
optional(prec(1, ';;'))
),
function_definition: $ => seq(

View File

@ -1,7 +1,5 @@
examples/bash-it/plugins/available/git.plugin.bash
examples/bash-it/plugins/available/fasd.plugin.bash
examples/bash-it/plugins/available/fzf.plugin.bash
examples/bash-it/plugins/available/z.plugin.bash
examples/bash-it/plugins/available/extract.plugin.bash
examples/bash-it/plugins/available/less-pretty-cat.plugin.bash
examples/bash-it/plugins/available/z_autoenv.plugin.bash
@ -38,7 +36,6 @@ examples/bash-it/completion/available/projects.completion.bash
examples/bash-it/completion/available/virsh.completion.bash
examples/bash-it/completion/available/apm.completion.bash
examples/bash-it/completion/available/git_flow.completion.bash
examples/bash-it/lib/helpers.bash
examples/bash-it/lib/preexec.bash
examples/bash-it/lib/composure.bash
examples/bash-it/lib/search.bash
@ -53,7 +50,6 @@ examples/bash-it/themes/dulcie/dulcie.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/atomic/atomic.theme.bash
examples/bash-it/themes/powerline/powerline.base.bash
examples/bash-it/themes/base.theme.bash
examples/bash-it/themes/brainy/brainy.theme.bash

View File

@ -2,5 +2,4 @@
tree-sitter parse $(find examples/bash-it -name '*.bash' -or -name '*.sh') -q -t \
| egrep 'ERROR|undefined' \
| cut -d' ' -f1 \
> script/known-failures.txt
| tee >(cut -d' ' -f1 > script/known-failures.txt)

86
src/grammar.json vendored
View File

@ -348,15 +348,44 @@
"value": ")"
},
{
"type": "REPEAT",
"content": {
"type": "SYMBOL",
"name": "_terminated_statement"
}
"type": "CHOICE",
"members": [
{
"type": "SEQ",
"members": [
{
"type": "REPEAT",
"content": {
"type": "SYMBOL",
"name": "_terminated_statement"
}
},
{
"type": "CHOICE",
"members": [
{
"type": "SYMBOL",
"name": "_statement"
},
{
"type": "BLANK"
}
]
}
]
},
{
"type": "BLANK"
}
]
},
{
"type": "STRING",
"value": ";;"
"type": "PREC",
"value": 1,
"content": {
"type": "STRING",
"value": ";;"
}
}
]
},
@ -388,18 +417,47 @@
"value": ")"
},
{
"type": "REPEAT",
"content": {
"type": "SYMBOL",
"name": "_terminated_statement"
}
"type": "CHOICE",
"members": [
{
"type": "SEQ",
"members": [
{
"type": "REPEAT",
"content": {
"type": "SYMBOL",
"name": "_terminated_statement"
}
},
{
"type": "CHOICE",
"members": [
{
"type": "SYMBOL",
"name": "_statement"
},
{
"type": "BLANK"
}
]
}
]
},
{
"type": "BLANK"
}
]
},
{
"type": "CHOICE",
"members": [
{
"type": "STRING",
"value": ";;"
"type": "PREC",
"value": 1,
"content": {
"type": "STRING",
"value": ";;"
}
},
{
"type": "BLANK"

64195
src/parser.c vendored

File diff suppressed because it is too large Load Diff