aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/scng.ads
diff options
context:
space:
mode:
authorBob Duff <duff@adacore.com>2022-06-21 09:50:06 -0400
committerPierre-Marie de Rodat <derodat@adacore.com>2022-07-12 12:24:11 +0000
commit2148f2996ae76a7773eb7d8e30c02bd036ec7b3c (patch)
tree7aaa816d7c8d7e80b59386ddc2efda9f4ad8e39a /gcc/ada/scng.ads
parentfe6f256d5ba85a588493a489af1bdbe8087e368a (diff)
downloadgcc-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/scng.ads')
-rw-r--r--gcc/ada/scng.ads26
1 files changed, 10 insertions, 16 deletions
diff --git a/gcc/ada/scng.ads b/gcc/ada/scng.ads
index 9399997..fcce36b 100644
--- a/gcc/ada/scng.ads
+++ b/gcc/ada/scng.ads
@@ -23,11 +23,11 @@
-- --
------------------------------------------------------------------------------
--- This package contains a generic lexical analyzer. This is used for scanning
--- Ada source files or text files with an Ada-like syntax, such as project
--- files. It is instantiated in Scn and Prj.Err.
+-- This is a generic lexical analyzer, used for scanning Ada source files, and
+-- also for preprocessor files.
with Casing; use Casing;
+with Scans; use Scans;
with Styleg;
with Types; use Types;
@@ -68,33 +68,27 @@ package Scng is
-- Scan scans out the next token, and advances the scan state accordingly
-- (see package Scan_State for details). If the scan encounters an illegal
-- token, then an error message is issued pointing to the bad character,
- -- and Scan returns a reasonable substitute token of some kind.
- -- For tokens Char_Literal, Identifier, Real_Literal, Integer_Literal,
- -- String_Literal and Operator_Symbol, Post_Scan is called after scanning.
+ -- and Scan returns a reasonable substitute token. For tokens Char_Literal,
+ -- Identifier, Real_Literal, Integer_Literal, String_Literal and
+ -- Operator_Symbol, Post_Scan is called after scanning.
function Determine_Token_Casing return Casing_Type;
pragma Inline (Determine_Token_Casing);
-- Determines the casing style of the current token, which is
-- either a keyword or an identifier. See also package Casing.
- procedure Set_Special_Character (C : Character);
- -- Indicate that one of the following character '#', '$', '?', '`',
- -- '\', '^', '_' or '~', when found is a Special token.
- -- AI12-0125-03 : target name (ES) is not in this list because '@' is
- -- handled as a special token as abbreviation of LHS of assignment.
+ procedure Set_Special_Character (C : Special_Preprocessor_Character);
+ -- Called when the preprocessor is active to indicate that Scan should
+ -- return a Special token for C.
procedure Reset_Special_Characters;
- -- Indicate that there is no characters that are Special tokens., which
+ -- Indicate that there are no characters that are Special tokens, which
-- is the default.
procedure Set_End_Of_Line_As_Token (Value : Boolean);
-- Indicate if End_Of_Line is a token or not.
-- By default, End_Of_Line is not a token.
- procedure Set_Comment_As_Token (Value : Boolean);
- -- Indicate if a comment is a token or not.
- -- By default, a comment is not a token.
-
function Set_Start_Column return Column_Number;
-- This routine is called with Scan_Ptr pointing to the first character
-- of a line. On exit, Scan_Ptr is advanced to the first non-blank