OSDN Git Service

2001-03-30 Alexandre Petit-Bianco <apbianco@redhat.com>
authorapbianco <apbianco@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 4 Apr 2001 17:56:25 +0000 (17:56 +0000)
committerapbianco <apbianco@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 4 Apr 2001 17:56:25 +0000 (17:56 +0000)
* parse-scan.y (array_type:): Rewritten.
(type_declaration:): `empty_statement' replaces `SC_TK.'
(class_member_declaration:): `empty statement' added.
(method_body:): Simplified.
(static_initializer:): Likewise.
(primary_no_new_array:): Use `type_literals.'
(type_literals:): New rule.
(dims:): Set and update `bracket_count.'
Fixes PR java/1074. Fixes PR java/2412.

(http://gcc.gnu.org/ml/gcc-bugs/2001-03/msg00835.html,
 http://gcc.gnu.org/ml/gcc-bugs/2000-12/msg00384.html,
 http://gcc.gnu.org/ml/gcc-patches/2001-04/msg00258.html)

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@41089 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/java/ChangeLog
gcc/java/parse-scan.y

index 4ae779c..b50e456 100644 (file)
        lang_printable_name call in a scratch buffer, so it 
        won't be clobbered by the second call.
 
+2001-03-30  Alexandre Petit-Bianco  <apbianco@redhat.com>
+
+       * parse-scan.y (array_type:): Rewritten.
+       (type_declaration:): `empty_statement' replaces `SC_TK.'
+       (class_member_declaration:): `empty statement' added.
+       (method_body:): Simplified.
+       (static_initializer:): Likewise.
+       (primary_no_new_array:): Use `type_literals.'
+       (type_literals:): New rule.
+       (dims:): Set and update `bracket_count.'
+       Fixes PR java/1074. Fixes PR java/2412.
+
 2001-03-28  Hans Boehm  <boehm@acm.org>
 
        * boehm.c (PROCEDURE_OBJECT_DESCRIPTOR): Set to use `build_int_2.'
index 20522da..28d7946 100644 (file)
@@ -242,14 +242,15 @@ interface_type:
 ;
 
 array_type:
-       primitive_type OSB_TK CSB_TK
-|      name OSB_TK CSB_TK
+       primitive_type dims
                {
-                 $$ = concat ("[", $1, NULL);
+                 while (bracket_count-- > 0) 
+                   $$ = concat ("[", $1, NULL);
                }
-|      array_type OSB_TK CSB_TK
-               {       
-                 $$ = concat ("[", $1, NULL);
+|      name dims
+               {
+                 while (bracket_count-- > 0) 
+                   $$ = concat ("[", $1, NULL);
                }
 ;
 
@@ -316,7 +317,7 @@ type_import_on_demand_declaration:
 type_declaration:
        class_declaration
 |      interface_declaration
-|      SC_TK
+|      empty_statement
 ;
 
 /* 19.7 Shortened from the original:
@@ -393,6 +394,7 @@ class_member_declaration:
 |      method_declaration
 |      class_declaration       /* Added, JDK1.1 inner classes */
 |      interface_declaration   /* Added, JDK1.1 inner classes */
+|      empty_statement
 ;
 
 /* 19.8.2 Productions from 8.3: Field Declarations  */
@@ -513,14 +515,12 @@ class_type_list:
 
 method_body:
        block
-|      block SC_TK
 |      SC_TK
 ;
 
 /* 19.8.4 Productions from 8.5: Static Initializers  */
 static_initializer:
        static block
-|      static block SC_TK      /* Shouldn't be here. FIXME */
 ;
 
 static:                                /* Test lval.sub_token here */
@@ -892,14 +892,7 @@ primary_no_new_array:
 |      field_access
 |      method_invocation
 |      array_access
-       /* type DOT_TK CLASS_TK doens't work. So we split the rule
-          'type' into its components. Missing is something for array,
-          which will complete the reference_type part. FIXME */
-|      name DOT_TK CLASS_TK           /* Added, JDK1.1 class literals */
-               { USE_ABSORBER; }
-|      primitive_type DOT_TK CLASS_TK /* Added, JDK1.1 class literals */
-               { USE_ABSORBER; }
-|      VOID_TK DOT_TK CLASS_TK        /* Added, JDK1.1 class literals */
+|      type_literals
         /* Added, JDK1.1 inner classes. Documentation is wrong
            refering to a 'ClassName' (class_name) rule that doesn't
            exist. Used name instead.  */
@@ -907,6 +900,17 @@ primary_no_new_array:
                { USE_ABSORBER; }
 ;
 
+type_literals:
+       name DOT_TK CLASS_TK
+               { USE_ABSORBER; }
+|      array_type DOT_TK CLASS_TK
+               { USE_ABSORBER; }
+|      primitive_type DOT_TK CLASS_TK
+               { USE_ABSORBER; }
+|      VOID_TK DOT_TK CLASS_TK
+               { USE_ABSORBER; }
+;
+
 class_instance_creation_expression:
        NEW_TK class_type OP_TK argument_list CP_TK
 |      NEW_TK class_type OP_TK CP_TK
@@ -960,7 +964,9 @@ dim_expr:
 
 dims:                          
        OSB_TK CSB_TK
+               { bracket_count = 1; }
 |      dims OSB_TK CSB_TK
+               { bracket_count++; }
 ;
 
 field_access: