aboutsummaryrefslogtreecommitdiff
path: root/sys/cmd/rc/syntax.y
diff options
context:
space:
mode:
Diffstat (limited to 'sys/cmd/rc/syntax.y')
-rw-r--r--sys/cmd/rc/syntax.y10
1 files changed, 6 insertions, 4 deletions
diff --git a/sys/cmd/rc/syntax.y b/sys/cmd/rc/syntax.y
index 469260f..6334819 100644
--- a/sys/cmd/rc/syntax.y
+++ b/sys/cmd/rc/syntax.y
@@ -1,4 +1,4 @@
-%token Tword Twords Tif Telse Tbang
+%token Tword Twords Tif Telse Tbang Tsubshell
%token Targs Tindex
%token Tbasic Tparen Tblock
@@ -14,7 +14,7 @@
/* operator precendence: lowest first */
%left Twhile Telse
%left '\n'
-%left Tbang
+%left Tbang Tsubshell
%right '$' Tcount Tflat
%right Tindex
@@ -24,7 +24,7 @@
}
%type<tree> line cmds cmdsln body paren block ifbody assign;
%type<tree> cmd basic executable nonkeyword keyword word words wordsnl atom arg args;
-%type<tree> Tbang;
+%type<tree> Tbang Tsubshell Tindex;
%type<tree> Tword Tif Telse;
/* grammar */
@@ -71,6 +71,8 @@ cmd:
| block
| assign cmd %prec Tbang { $$ = hangchild1($1, $2, 2); }
| Tif paren nl ifbody { $$ = hangchild1($2, $1, 0); }
+| Tbang cmd { $$ = maketree1(Tbang, $2); }
+| Tsubshell cmd { $$ = maketree1(Tsubshell, $2); }
basic:
executable
@@ -103,7 +105,7 @@ nonkeyword:
//| '`' block { $$ = maketree1('`', $2); }
keyword:
- Tif|Telse
+ Tif|Telse|Tbang|Tsubshell
words:
/* empty */ { $$ = nil; }