summaryrefslogtreecommitdiff
path: root/parse/gram.y
diff options
context:
space:
mode:
authorS. Gilles <sgilles@math.umd.edu>2018-03-13 10:53:55 -0400
committerS. Gilles <sgilles@math.umd.edu>2018-03-13 10:53:55 -0400
commit599feae2daa1392f20e1dc807c58bcd74c20b45e (patch)
treea358d75af648afa2aa08a465c374ef32210c48ab /parse/gram.y
parent5e1154d69efc86f5fe3831b047e3531d9cfd3478 (diff)
parent2c113af58d9f63bc4f720adbb6aa8ac2cae52781 (diff)
downloadmc-599feae2daa1392f20e1dc807c58bcd74c20b45e.tar.gz
Merge branch 'autoexpr' into libmath
Diffstat (limited to 'parse/gram.y')
-rw-r--r--parse/gram.y15
1 files changed, 6 insertions, 9 deletions
diff --git a/parse/gram.y b/parse/gram.y
index 8fb448b..9d9ddef 100644
--- a/parse/gram.y
+++ b/parse/gram.y
@@ -148,7 +148,7 @@ static void setupinit(Node *n);
%type<node> littok literal lorexpr landexpr borexpr strlit bandexpr
%type<node> cmpexpr addexpr mulexpr shiftexpr prefixexpr ternexpr
%type<node> postfixexpr funclit seqlit tuplit name block stmt label
-%type<node> use fnparam declbody declcore typedeclcore autodecl structent
+%type<node> use fnparam declbody declcore typedeclcore structent
%type<node> arrayelt structelt tuphead ifstmt forstmt whilestmt
%type<node> matchstmt elifs optexprln loopcond optexpr match
@@ -420,8 +420,8 @@ pkgtydef: attrs tydef {
}
;
-declbody: autodecl Tasn expr {$$ = $1; $1->decl.init = $3;}
- | autodecl
+declbody: declcore Tasn expr {$$ = $1; $1->decl.init = $3;}
+ | declcore
;
declcore: name {$$ = mkdecl($1->loc, $1, mktyvar($1->loc));}
@@ -432,10 +432,6 @@ typedeclcore
: name Tcolon type {$$ = mkdecl($1->loc, $1, $3);}
;
-autodecl: Tauto declcore {$$ = $2; $$->decl.isauto = 1;}
- | declcore
- ;
-
name : Tident {$$ = mkname($1->loc, $1->id);}
| Tident Tdot Tident {
$$ = mknsname($3->loc, $1->id, $3->id);
@@ -771,7 +767,8 @@ shiftexpr
shiftop : Tbsl | Tbsr;
prefixexpr
- : Tinc prefixexpr {$$ = mkexpr($1->loc, Opreinc, $2, NULL);}
+ : Tauto prefixexpr {$$ = mkexpr($1->loc, Oauto, $2, NULL);}
+ | Tinc prefixexpr {$$ = mkexpr($1->loc, Opreinc, $2, NULL);}
| Tdec prefixexpr {$$ = mkexpr($1->loc, Opredec, $2, NULL);}
| Tband prefixexpr {$$ = mkexpr($1->loc, Oaddr, $2, NULL);}
| Tlnot prefixexpr {$$ = mkexpr($1->loc, Olnot, $2, NULL);}
@@ -930,7 +927,7 @@ params : fnparam {
| /* empty */ {$$.nl = NULL; $$.nn = 0;}
;
-fnparam : autodecl {$$ = $1;}
+fnparam : declcore {$$ = $1;}
| Tgap { $$ = mkpseudodecl($1->loc, mktyvar($1->loc)); }
| Tgap Tcolon type { $$ = mkpseudodecl($1->loc, $3); }
;