]> Cypherpunks repositories - gostls13.git/commitdiff
better recovery after syntax error
authorKen Thompson <ken@golang.org>
Fri, 4 Jul 2008 01:05:20 +0000 (18:05 -0700)
committerKen Thompson <ken@golang.org>
Fri, 4 Jul 2008 01:05:20 +0000 (18:05 -0700)
SVN=126003

src/cmd/gc/go.y

index 5f223f50562920229bcf7c98fd573565521fdc4b..e3fe87a3bcf0e9690317883297a2f2a505a85bd7 100644 (file)
@@ -148,6 +148,14 @@ xdcl:
        {
                $$ = N;
        }
+|      error '}'
+       {
+               $$ = N;
+       }
+|      error ';'
+       {
+               $$ = N;
+       }
 
 common_dcl:
        Acommon_dcl
@@ -1194,6 +1202,14 @@ Astmt:
        {
                $$ = N;
        }
+|      error ';'
+       {
+               $$ = N;
+       }
+|      error '}'
+       {
+               $$ = N;
+       }
 
 /*
  * need semi in front NO
@@ -1262,10 +1278,6 @@ Bstmt_list_r:
 stmt_list_r:
        Astmt_list_r
 |      Bstmt_list_r
-|      error ';'
-       {
-               $$ = N;
-       }
 
 expr_list_r:
        expr