Allow file redirects on while statements
This commit is contained in:
parent
6f81608535
commit
86c5561ba8
|
@ -16,6 +16,24 @@ done
|
||||||
(command (command_name (word)) (word))
|
(command (command_name (word)) (word))
|
||||||
(command (command_name (word)) (word)))))
|
(command (command_name (word)) (word)))))
|
||||||
|
|
||||||
|
====================================
|
||||||
|
While statements with IO redirects
|
||||||
|
====================================
|
||||||
|
|
||||||
|
while read line; do
|
||||||
|
echo $line
|
||||||
|
done < <(cat file)
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
(program
|
||||||
|
(while_statement
|
||||||
|
(command (command_name (word)) (word))
|
||||||
|
(do_group
|
||||||
|
(command (command_name (word)) (simple_expansion (variable_name))))
|
||||||
|
(file_redirect (process_substitution
|
||||||
|
(command (command_name (word)) (word))))))
|
||||||
|
|
||||||
====================================
|
====================================
|
||||||
For statements
|
For statements
|
||||||
====================================
|
====================================
|
||||||
|
|
|
@ -78,7 +78,12 @@ module.exports = grammar({
|
||||||
while_statement: $ => seq(
|
while_statement: $ => seq(
|
||||||
'while',
|
'while',
|
||||||
$._terminated_statement,
|
$._terminated_statement,
|
||||||
$.do_group
|
$.do_group,
|
||||||
|
repeat(choice(
|
||||||
|
$.file_redirect,
|
||||||
|
$.heredoc_redirect,
|
||||||
|
$.herestring_redirect
|
||||||
|
))
|
||||||
),
|
),
|
||||||
|
|
||||||
do_group: $ => seq(
|
do_group: $ => seq(
|
||||||
|
|
Loading…
Reference in New Issue