diff options
author | Bob Duff <duff@adacore.com> | 2022-06-21 09:50:06 -0400 |
---|---|---|
committer | Pierre-Marie de Rodat <derodat@adacore.com> | 2022-07-12 12:24:11 +0000 |
commit | 2148f2996ae76a7773eb7d8e30c02bd036ec7b3c (patch) | |
tree | 7aaa816d7c8d7e80b59386ddc2efda9f4ad8e39a /gcc/ada/scans.ads | |
parent | fe6f256d5ba85a588493a489af1bdbe8087e368a (diff) | |
download | gcc-2148f2996ae76a7773eb7d8e30c02bd036ec7b3c.zip gcc-2148f2996ae76a7773eb7d8e30c02bd036ec7b3c.tar.gz gcc-2148f2996ae76a7773eb7d8e30c02bd036ec7b3c.tar.bz2 |
[Ada] Clean up scanner
This patch removes some obsolete code in the scanner and related files,
and corrects some comments. Tok_Special is used only by the
preprocessor, and uses only the two characters '#' and '$'.
It might be simpler to have a single flag indicating we're scanning for
preprocessing, instead of the Special_Characters array and the
End_Of_Line_Is_Token flag, but that's for another day.
gcc/ada/
* scans.ads: Fix obsolete comments about Tok_Special, and give
Special_Character a predicate assuring it is one of the two
characters used in preprocessing.
* scng.ads: Clean up comments.
* scng.adb: Clean up handling of Tok_Special. Remove comment
about '@' (target_name), which doesn't seem very helpful.
Set_Special_Character will now blow up if given anything other
than '#' and '$', because of the predicate on Special_Character;
it's not clear why it used to say "when others => null;".
Remove Comment_Is_Token, which is not used.
* scn.ads: Remove commented-out use clause. Remove redundant
comment.
* ali-util.adb: Use "is null" for do-nothing procedures.
* gprep.adb (Post_Scan): Use "is null".
Diffstat (limited to 'gcc/ada/scans.ads')
-rw-r--r-- | gcc/ada/scans.ads | 19 |
1 files changed, 6 insertions, 13 deletions
diff --git a/gcc/ada/scans.ads b/gcc/ada/scans.ads index d73dae4..dbe9e5a 100644 --- a/gcc/ada/scans.ads +++ b/gcc/ada/scans.ads @@ -210,15 +210,11 @@ package Scans is Tok_End_Of_Line, -- Represents an end of line. Not used during normal compilation scans - -- where end of line is ignored. Active for preprocessor scanning and - -- also when scanning project files (where it is needed because of ???) + -- where end of line is ignored. Active for preprocessor scanning. Tok_Special, - -- AI12-0125-03 : target name as abbreviation for LHS - - -- Otherwise used only in preprocessor scanning (to represent one of - -- the characters '#', '$', '?', '@', '`', '\', '^', '~', or '_'. The - -- character value itself is stored in Scans.Special_Character. + -- Special character used by the preprocessor. The character itself is + -- stored in Special_Character below. No_Token); -- No_Token is used for initializing Token values to indicate that @@ -466,12 +462,9 @@ package Scans is -- character found (i.e. a character that does not fit in Character or -- Wide_Character). - Special_Character : Character; - -- AI12-0125-03 : '@' as target name is handled elsewhere. - -- Valid only when Token = Tok_Special. Returns one of the characters - -- '#', '$', '?', '`', '\', '^', '~', or '_'. - -- - -- Why only this set? What about wide characters??? + subtype Special_Preprocessor_Character is Character with + Predicate => Special_Preprocessor_Character in '#' | '$'; + Special_Character : Special_Preprocessor_Character; Comment_Id : Name_Id := No_Name; -- Valid only when Token = Tok_Comment. Store the string that follows |