summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKen Thompson <ken@golang.org>2008-07-03 18:05:20 -0700
committerKen Thompson <ken@golang.org>2008-07-03 18:05:20 -0700
commit9835b2ba9fe2569eaf93a62d7b421c60b75a22f2 (patch)
treee5428d5ea97849854de3ebea6e1aebf97d23fbc8
parent67c6565c8142790c2708bbeb52f72c0170998dfc (diff)
downloadgolang-9835b2ba9fe2569eaf93a62d7b421c60b75a22f2.tar.gz
better recovery after syntax error
SVN=126003
-rw-r--r--src/cmd/gc/go.y20
1 files changed, 16 insertions, 4 deletions
diff --git a/src/cmd/gc/go.y b/src/cmd/gc/go.y
index 5f223f505..e3fe87a3b 100644
--- a/src/cmd/gc/go.y
+++ b/src/cmd/gc/go.y
@@ -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