diff options
author | Ed Schonberg <schonberg@adacore.com> | 2019-12-16 10:34:37 +0000 |
---|---|---|
committer | Pierre-Marie de Rodat <pmderodat@gcc.gnu.org> | 2019-12-16 10:34:37 +0000 |
commit | 3c08de34076ffc085e335cc9c89661945823c594 (patch) | |
tree | f6a24aff8adfefc807a1d2c3520a1f027fe13e3f /gcc/ada/scans.ads | |
parent | a517d6c19a572a4aa37569f54186883d70627686 (diff) | |
download | gcc-3c08de34076ffc085e335cc9c89661945823c594.zip gcc-3c08de34076ffc085e335cc9c89661945823c594.tar.gz gcc-3c08de34076ffc085e335cc9c89661945823c594.tar.bz2 |
[Ada] Prototype implementastion of Ada2020 Map-reduce construct
2019-12-16 Ed Schonberg <schonberg@adacore.com>
gcc/ada/
* scng.adb (Scan): In Ada2020, a left-bracket indicates the
start of an homogenous aggregate.
* par-ch4.adb (P_Reduction_Attribute_Reference): New procedure.
(P_Aggregate): Recognize Ada2020 bracket-delimited aggregates.
(P_Primary): Ditto.
* par-util.adb (Comma_Present): Return false on a right bracket
in Ada2020, indicating the end of an aggregate.
* snames.ads-tmpl: Introduce Name_Reduce and Attribute Reduce.
* sinfo.ads, sinfo.adb (Is_Homogeneous_Aggregate): New flag on
aggregates, to designate an Ada2020 array or container aggregate
that is bracket-delimited in the source.
* sem_attr.adb (Analyze_Attribute): For attribute Reduce, verify
that two arguments are present, and verify that the prefix is a
stream or an object that is iterable (array or contrainer).
(Resolve_Attribute): For attribute Reduce, resolve initial value
with the type of the context. Type-checking of element type of
prefix is performed after expansion.
* exp_attr.adb (Expand_N_Attribute_Reference): For attribute
Reduce, expand into a loop: a) If prefix is an aggregate with a
single iterated component association, use its iterator
specification to construct a loop, b) If prefix is a name, build
a loop using an element iterator loop.
* scans.ads: Add brackets tokens.
From-SVN: r279431
Diffstat (limited to 'gcc/ada/scans.ads')
-rw-r--r-- | gcc/ada/scans.ads | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/gcc/ada/scans.ads b/gcc/ada/scans.ads index abee591..530da54 100644 --- a/gcc/ada/scans.ads +++ b/gcc/ada/scans.ads @@ -87,11 +87,15 @@ package Scans is -- exception-name". This degrades error recovery slightly, and perhaps -- we could do better, but not worth the effort. + -- Ada2020 introduces square brackets as delimiters for array and + -- container aggregates. + Tok_Raise, -- RAISE Tok_Dot, -- . Namext Tok_Apostrophe, -- ' Namext + Tok_Left_Bracket, -- [ Namest Tok_Left_Paren, -- ( Namext, Consk Tok_Delta, -- DELTA Atkwd, Sterm, Consk @@ -99,6 +103,7 @@ package Scans is Tok_Range, -- RANGE Atkwd, Sterm, Consk Tok_Right_Paren, -- ) Sterm + Tok_Right_Bracket, -- ] Sterm Tok_Comma, -- , Sterm Tok_And, -- AND Logop, Sterm |