diff options
Diffstat (limited to 'sys/cmd/rc/syntax.y')
-rw-r--r-- | sys/cmd/rc/syntax.y | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/sys/cmd/rc/syntax.y b/sys/cmd/rc/syntax.y index 2e7e1da..f3c9f29 100644 --- a/sys/cmd/rc/syntax.y +++ b/sys/cmd/rc/syntax.y @@ -27,7 +27,7 @@ %type<tree> line cmds cmdsln body paren block ifbody assign epilog redir; %type<tree> cmd basic executable nonkeyword keyword word words wordsnl atom; %type<tree> Tfor Tin Twhile Tif Telse Tswitch Ttwiddle Tbang Tsubshell Tfunc; -%type<tree> Tword Tredir Tpipe; +%type<tree> Tword Tredir Tpipe Tdup; /* grammar */ @@ -107,11 +107,14 @@ executable: nonkeyword: Tword -| '$' atom { $$ = maketree1('$', $2); } -| '(' wordsnl ')' { $$ = $2; } -| Tcount atom { $$ = maketree1(Tcount, $2); } -| Tjoin atom { $$ = maketree1(Tjoin, $2); } -//| '`' block { $$ = maketree1('`', $2); } +| '$' atom { $$ = maketree1('$', $2); } +| '$' atom Tindex words ')' { $$ = maketree2(Tindex, $2, $4); } +| '(' wordsnl ')' { $$ = $2; } +| Tcount atom { $$ = maketree1(Tcount, $2); } +| Tjoin atom { $$ = maketree1(Tjoin, $2); } +| '`' block { $$ = maketree1('`', $2); } +//| '(' words ')' { $$ = maketree1(Tparen, $2); } +//| Tredir block { $$ = hangchild1($1, $2, 0); $$->type = Tpipefd; } keyword: Tin|Tfor|Twhile|Tif|Telse|Tswitch|Tbang|Tsubshell|Tfunc |