commit 9154b20cebe240270ce525ee39324835523005b9
parent 0ef10dfb7ab1749c28bf650567de7b39d97a8d36
Author: tjg <tjg>
Date: Mon, 27 Nov 2000 12:44:52 +0000
remove all equals hacks!
Diffstat:
1 file changed, 7 insertions(+), 9 deletions(-)
diff --git a/parse.y b/parse.y
@@ -7,13 +7,11 @@
%{
#include "rc.h"
-extern int mbassign;
-
static Node *star, *nolist;
Node *parsetree; /* not using yylval because bison declares it as an auto */
%}
-%token ANDAND BACKBACK BANG CASE COUNT DUP ELSE END EQUALS FLAT FN FOR IF IN
+%token ANDAND BACKBACK BANG CASE COUNT DUP ELSE END FLAT FN FOR IF IN
%token OROR PIPE REDIR SREDIR SUB SUBSHELL SWITCH TWIDDLE WHILE WORD HUH
%left WHILE ')' ELSE
@@ -58,8 +56,8 @@ cmdsa : cmd ';'
| cmd '&' { $$ = ($1 != NULL ? mk(nNowait,$1) : $1); }
/* a line is a single command, or a command terminated by ; or & followed by a line (recursive) */
-line : cmd { mbassign = TRUE; }
- | cmdsa line { mbassign = TRUE; $$ = ($1 != NULL ? mk(nBody,$1,$2) : $2); }
+line : cmd
+ | cmdsa line { $$ = ($1 != NULL ? mk(nBody,$1,$2) : $2); }
/* a body is like a line, only commands may also be terminated by newline */
body : cmd
@@ -72,7 +70,7 @@ brace : '{' body '}' { $$ = $2; }
paren : '(' body ')' { $$ = $2; }
-assign : first EQUALS { mbassign = 2; } word { mbassign = 1; $$ = mk(nAssign,$1,$4); }
+assign : first '=' word { $$ = mk(nAssign,$1,$3); }
epilog : { $$ = NULL; }
| redir epilog { $$ = mk(nEpilog,$1,$2); }
@@ -125,8 +123,8 @@ simple : first
first : comword
| first '^' sword { $$ = mk(nConcat,$1,$3); }
-sword : comword { if (mbassign) --mbassign; }
- | keyword { if (mbassign) --mbassign; $$ = mk(nWord,$1, NULL); }
+sword : comword
+ | keyword { $$ = mk(nWord,$1, NULL); }
word : sword
| word '^' sword { $$ = mk(nConcat,$1,$3); }
@@ -141,7 +139,7 @@ comword : '$' sword { $$ = mk(nVar,$2); }
| BACKBACK word sword { $$ = mk(nBackq,$2,$3); }
| '(' nlwords ')' { $$ = $2; }
| REDIR brace { $$ = mk(nNmpipe,$1.type,$1.fd,$2); }
- | WORD { $$ = ($1.w[0] == '\'') ? mk(nQword, $1.w+1, NULL) : mk(nWord,$1.w, $1.m); }
+ | WORD { $$ = ($1.w[0] == '\'') ? mk(nQword, $1.w+1, NULL) : mk(nWord,$1.w, $1.m); }
keyword : FOR { $$ = "for"; }
| IN { $$ = "in"; }