]> gcc.gnu.org Git - gcc.git/commitdiff
[Ada] Ada2020: parsing of qualified exprs with new agg syntax
authorBob Duff <duff@adacore.com>
Wed, 1 Jul 2020 20:22:46 +0000 (16:22 -0400)
committerPierre-Marie de Rodat <derodat@adacore.com>
Fri, 16 Oct 2020 07:34:53 +0000 (03:34 -0400)
gcc/ada/

* par-ch4.adb (P_Name): Allow Tok_Left_Bracket in two places to
call P_Qualified_Expression. We don't need to modify other
places that call P_Qualified_Expression, because a
qualified_expression is a name in Ada 2012 and higher, so P_Name
is the right place.  The parser already parses aggregates with
brackets; we just need to allow that in qualified expressions.

gcc/ada/par-ch4.adb

index 9815ca1522a489051d59fda49aab879dd77350ea..e4ce02fa3aff3074baf022041de99e315b451031 100644 (file)
@@ -281,9 +281,10 @@ package body Ch4 is
          goto Scan_Name_Extension;
       end if;
 
-      --  We have scanned out a qualified simple name, check for name extension
-      --  Note that we know there is no dot here at this stage, so the only
-      --  possible cases of name extension are apostrophe and left paren.
+      --  We have scanned out a qualified simple name, check for name
+      --  extension.  Note that we know there is no dot here at this stage,
+      --  so the only possible cases of name extension are apostrophe followed
+      --  by '(' or '['.
 
       if Token = Tok_Apostrophe then
          Save_Scan_State (Scan_State); -- at apostrophe
@@ -291,7 +292,9 @@ package body Ch4 is
 
          --  Qualified expression in Ada 2012 mode (treated as a name)
 
-         if Ada_Version >= Ada_2012 and then Token = Tok_Left_Paren then
+         if Ada_Version >= Ada_2012
+           and then Token in Tok_Left_Paren | Tok_Left_Bracket
+         then
             goto Scan_Name_Extension_Apostrophe;
 
          --  If left paren not in Ada 2012, then it is not part of the name,
@@ -445,7 +448,9 @@ package body Ch4 is
          begin
             --  Check for qualified expression case in Ada 2012 mode
 
-            if Ada_Version >= Ada_2012 and then Token = Tok_Left_Paren then
+            if Ada_Version >= Ada_2012
+              and then Token in Tok_Left_Paren | Tok_Left_Bracket
+            then
                Name_Node := P_Qualified_Expression (Name_Node);
                goto Scan_Name_Extension;
 
This page took 0.066626 seconds and 5 git commands to generate.