diff options
author | Alexandre Petit-Bianco <apbianco@cygnus.com> | 2000-10-10 17:54:59 +0000 |
---|---|---|
committer | Alexandre Petit-Bianco <apbianco@gcc.gnu.org> | 2000-10-10 10:54:59 -0700 |
commit | 29f8b71838fd23a668b760b55b36e9df835c5860 (patch) | |
tree | 29e47287ccecef100ce0b62cbd6d9692d2e0680c /gcc/java/parse.y | |
parent | 8ccaefbd44f90700f0366d4c037c8fc778ffae99 (diff) | |
download | gcc-29f8b71838fd23a668b760b55b36e9df835c5860.zip gcc-29f8b71838fd23a668b760b55b36e9df835c5860.tar.gz gcc-29f8b71838fd23a668b760b55b36e9df835c5860.tar.bz2 |
[multiple changes]
2000-10-07 Alexandre Petit-Bianco <apbianco@cygnus.com>
Patch contributed by Corey Minyard.
* decl.c (check_local_named_variable): New function.
(tree check_local_unnamed_variable): Likewise.
(find_local_variable): Splitted. Call check_local_{un}named_variable.
2000-08-11 Alexandre Petit-Bianco <apbianco@cygnus.com>
* parse.y (variable_declarator_id:): Better error message.
(expression_statement:): Use YYNOT_TWICE.
(cast_expression:): Likewise.
(assignment:): Likewise.
(http://gcc.gnu.org/ml/gcc-patches/2000-10/msg00286.html)
From-SVN: r36827
Diffstat (limited to 'gcc/java/parse.y')
-rw-r--r-- | gcc/java/parse.y | 25 |
1 files changed, 14 insertions, 11 deletions
diff --git a/gcc/java/parse.y b/gcc/java/parse.y index 5db2edc..e66d2f5 100644 --- a/gcc/java/parse.y +++ b/gcc/java/parse.y @@ -971,7 +971,15 @@ variable_declarator_id: | identifier error {yyerror ("Invalid declaration"); DRECOVER(vdi);} | variable_declarator_id OSB_TK error - {yyerror ("']' expected"); DRECOVER(vdi);} + { + tree node = java_lval.node; + if (node && (TREE_CODE (node) == INTEGER_CST + || TREE_CODE (node) == EXPR_WITH_FILE_LOCATION)) + yyerror ("Can't specify array dimension in a declaration"); + else + yyerror ("']' expected"); + DRECOVER(vdi); + } | variable_declarator_id CSB_TK error {yyerror ("Unbalanced ']'"); DRECOVER(vdi);} ; @@ -1465,20 +1473,17 @@ expression_statement: } | error SC_TK { - if (ctxp->prevent_ese != lineno) - yyerror ("Invalid expression statement"); + YYNOT_TWICE yyerror ("Invalid expression statement"); DRECOVER (expr_stmt); } | error OCB_TK { - if (ctxp->prevent_ese != lineno) - yyerror ("Invalid expression statement"); + YYNOT_TWICE yyerror ("Invalid expression statement"); DRECOVER (expr_stmt); } | error CCB_TK { - if (ctxp->prevent_ese != lineno) - yyerror ("Invalid expression statement"); + YYNOT_TWICE yyerror ("Invalid expression statement"); DRECOVER (expr_stmt); } | this_or_super OP_TK error @@ -2342,8 +2347,7 @@ cast_expression: /* Error handling here is potentially weak */ {yyerror ("']' expected, invalid type expression");} | OP_TK error { - if (ctxp->prevent_ese != lineno) - yyerror ("Invalid type expression"); RECOVER; + YYNOT_TWICE yyerror ("Invalid type expression"); RECOVER; RECOVER; } | OP_TK primitive_type dims CP_TK error @@ -2560,8 +2564,7 @@ assignment: { $$ = build_assignment ($2.token, $2.location, $1, $3); } | left_hand_side assignment_operator error { - if (ctxp->prevent_ese != lineno) - yyerror ("Missing term"); + YYNOT_TWICE yyerror ("Missing term"); DRECOVER (assign); } ; |