Newer
Older
command: simple_command
| shell_command (redirection)*
simple_command: (prefix)+
| (prefix)* (element)+
shell_command: '{' compound_list '}'
| '(' compound_list ')'
| rule_for
| rule_while
| rule_until
| rule_case
| rule_if
redirection: [IONUMBER] '>' WORD
| [IONUMBER] '<' WORD
| [IONUMBER] '>>' WORD
| [IONUMBER] '<<' HEREDOC
| [IONUMBER] '<<-' HEREDOC
| [IONUMBER] '>&' WORD
| [IONUMBER] '<&' WORD
| [IONUMBER] '>|' WORD
| [IONUMBER] '<>' WORD
| redirection
element: WORD
| redirection
compound_list: ('\n')* and_or ((';'|'&'|'\n') ('\n')* and_or)* [(('&'|';'|'\n') ('\n')*)]
rule_for: 'for' WORD ('\n')* ['in' (WORD)+ (';'|'\n') ('\n')*] do_group
rule_while: 'while' compound_list do_group
rule_until: 'until' compound_list do_group
rule_case: 'case' WORD ('\n')* 'in' ('\n')* [case_clause] 'esac'
rule_if: 'if' compound_list 'then' compound_list [else_clause] 'fi'
| 'elif' compound_list 'then' compound_list [else_clause]