Allow for statements without in clauses
This commit is contained in:
parent
16b90823a2
commit
68e93bd898
|
@ -42,6 +42,11 @@ for a in 1 2 $(seq 5 10); do
|
||||||
echo $a
|
echo $a
|
||||||
done
|
done
|
||||||
|
|
||||||
|
for ARG; do
|
||||||
|
echo $ARG
|
||||||
|
ARG=''
|
||||||
|
done
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
(program
|
(program
|
||||||
|
@ -51,7 +56,12 @@ done
|
||||||
(word)
|
(word)
|
||||||
(command_substitution (command (command_name (word)) (word) (word)))
|
(command_substitution (command (command_name (word)) (word) (word)))
|
||||||
(do_group
|
(do_group
|
||||||
(command (command_name (word)) (simple_expansion (variable_name))))))
|
(command (command_name (word)) (simple_expansion (variable_name)))))
|
||||||
|
(for_statement
|
||||||
|
(variable_name)
|
||||||
|
(do_group
|
||||||
|
(command (command_name (word)) (simple_expansion (variable_name)))
|
||||||
|
(variable_assignment (variable_name) (raw_string)))))
|
||||||
|
|
||||||
====================================
|
====================================
|
||||||
If statements
|
If statements
|
||||||
|
|
|
@ -71,8 +71,10 @@ module.exports = grammar({
|
||||||
for_statement: $ => seq(
|
for_statement: $ => seq(
|
||||||
'for',
|
'for',
|
||||||
$._simple_variable_name,
|
$._simple_variable_name,
|
||||||
'in',
|
optional(seq(
|
||||||
repeat1($._expression),
|
'in',
|
||||||
|
repeat1($._expression)
|
||||||
|
)),
|
||||||
$._terminator,
|
$._terminator,
|
||||||
$.do_group
|
$.do_group
|
||||||
),
|
),
|
||||||
|
|
|
@ -1,9 +1,7 @@
|
||||||
examples/bash-it/plugins/available/git.plugin.bash
|
examples/bash-it/plugins/available/git.plugin.bash
|
||||||
examples/bash-it/plugins/available/extract.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
|
examples/bash-it/plugins/available/z_autoenv.plugin.bash
|
||||||
examples/bash-it/plugins/available/sshagent.plugin.bash
|
examples/bash-it/plugins/available/sshagent.plugin.bash
|
||||||
examples/bash-it/plugins/available/gif.plugin.bash
|
|
||||||
examples/bash-it/plugins/available/go.plugin.bash
|
examples/bash-it/plugins/available/go.plugin.bash
|
||||||
examples/bash-it/plugins/available/proxy.plugin.bash
|
examples/bash-it/plugins/available/proxy.plugin.bash
|
||||||
examples/bash-it/plugins/available/browser.plugin.bash
|
examples/bash-it/plugins/available/browser.plugin.bash
|
||||||
|
|
|
@ -90,15 +90,28 @@
|
||||||
"name": "_simple_variable_name"
|
"name": "_simple_variable_name"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "STRING",
|
"type": "CHOICE",
|
||||||
"value": "in"
|
"members": [
|
||||||
},
|
{
|
||||||
{
|
"type": "SEQ",
|
||||||
"type": "REPEAT1",
|
"members": [
|
||||||
"content": {
|
{
|
||||||
"type": "SYMBOL",
|
"type": "STRING",
|
||||||
"name": "_expression"
|
"value": "in"
|
||||||
}
|
},
|
||||||
|
{
|
||||||
|
"type": "REPEAT1",
|
||||||
|
"content": {
|
||||||
|
"type": "SYMBOL",
|
||||||
|
"name": "_expression"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "BLANK"
|
||||||
|
}
|
||||||
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "SYMBOL",
|
"type": "SYMBOL",
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue