diff options
author | Ed Schonberg <schonberg@adacore.com> | 2017-01-23 11:29:17 +0000 |
---|---|---|
committer | Arnaud Charlet <charlet@gcc.gnu.org> | 2017-01-23 12:29:17 +0100 |
commit | ae33543ca51ec15393064ab2075fed28c33ce2d0 (patch) | |
tree | 0d42deb5fa5f86755159535db76effcdd549b3f5 /gcc/ada/scng.adb | |
parent | 13230c68da020c55d3369b489c0b49032637e242 (diff) | |
download | gcc-ae33543ca51ec15393064ab2075fed28c33ce2d0.zip gcc-ae33543ca51ec15393064ab2075fed28c33ce2d0.tar.gz gcc-ae33543ca51ec15393064ab2075fed28c33ce2d0.tar.bz2 |
scans.ads: New token At_Sign.
2017-01-23 Ed Schonberg <schonberg@adacore.com>
* scans.ads: New token At_Sign. Remove '@' from list of illegal
characters for future version of the language. '@' is legal name.
* scng.ads, scng.adb (Scan): Handle '@' appropriately.
* scn.adb (Scan_Reserved_Identifier): An occurrence of '@'
denotes a Target_Name.
* par-ch4.adb (P_Name, P_Primary): Handle Target_Name.
* sinfo.ads, sinfo.adb (N_Target_Name): New non-terminal node.
(Has_Target_Names): New flag on N_Assignment_Statement, to
indicate that RHS has occurrences of N_Target_Name.
* sem.adb: Call Analyze_Target_Name.
* sem_ch5.ads, sem_ch5.adb (Analyze_Target_Name): New subpogram.
(urrent_LHS): Global variable that denotes LHS of assignment,
used in the analysis of Target_Name nodes.
* sem_res.adb (Resolve_Target_Name): New procedure.
* exp_ch5.adb (Expand_Assign_With_Target_Names): (AI12-0125):
N is an assignment statement whose RHS contains occurences of @
that designate the value of the LHS of the assignment. If the
LHS is side-effect free the target names can be replaced with
a copy of the LHS; otherwise the semantics of the assignment
is described in terms of a procedure with an in-out parameter,
and expanded as such.
(Expand_N_Assignment_Statement): Call
Expand_Assign_With_Target_Names when needed.
* exp_util.adb (Insert_Actions): Take into account N_Target_Name.
* sprint.adb: Handle N_Target_Name.
From-SVN: r244783
Diffstat (limited to 'gcc/ada/scng.adb')
-rw-r--r-- | gcc/ada/scng.adb | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/gcc/ada/scng.adb b/gcc/ada/scng.adb index 3e2d7fa..6c9cab7 100644 --- a/gcc/ada/scng.adb +++ b/gcc/ada/scng.adb @@ -158,6 +158,7 @@ package body Scng is | Tok_And | Tok_Apostrophe | Tok_Array + | Tok_At_Sign | Tok_Asterisk | Tok_At | Tok_Body @@ -302,6 +303,7 @@ package body Scng is | Tok_Array | Tok_Asterisk | Tok_At + | Tok_At_Sign | Tok_Body | Tok_Box | Tok_Char_Literal @@ -1609,6 +1611,19 @@ package body Scng is return; end if; + when '@' => + if not Extensions_Allowed then + Error_Illegal_Character; + Scan_Ptr := Scan_Ptr + 1; + + else + -- AI12-0125-03 : @ is target_name + Accumulate_Checksum ('@'); + Scan_Ptr := Scan_Ptr + 1; + Token := Tok_At_Sign; + return; + end if; + -- Asterisk (can be multiplication operator or double asterisk which -- is the exponentiation compound delimiter). @@ -2421,8 +2436,9 @@ package body Scng is Error_Illegal_Character; -- Invalid graphic characters - - when '#' | '$' | '?' | '@' | '`' | '\' | '^' | '~' => + -- Note that '@' is handled elsewhere, because following AI12-125 + -- it denotes the target_name of an assignment. + when '#' | '$' | '?' | '`' | '\' | '^' | '~' => -- If Set_Special_Character has been called for this character, -- set Scans.Special_Character and return a Special token. |