OSDN Git Service

2007-06-11 Bob Duff <duff@adacore.com>
[pf3gnuchains/gcc-fork.git] / gcc / ada / par-tchk.adb
index 94447fb..a87d6a0 100644 (file)
@@ -6,7 +6,7 @@
 --                                                                          --
 --                                 B o d y                                  --
 --                                                                          --
---          Copyright (C) 1992-2003 Free Software Foundation, Inc.          --
+--          Copyright (C) 1992-2007, Free Software Foundation, Inc.         --
 --                                                                          --
 -- GNAT is free software;  you can  redistribute it  and/or modify it under --
 -- terms of the  GNU General Public License as published  by the Free Soft- --
@@ -24,7 +24,7 @@
 --                                                                          --
 ------------------------------------------------------------------------------
 
---  Token scan routines.
+--  Token scan routines
 
 --  Error recovery: none of the T_xxx or TF_xxx routines raise Error_Resync
 
@@ -417,26 +417,25 @@ package body Tchk is
          return;
 
       --  An interesting little kludge here. If the previous token is a
-      --  semicolon, then there is no way that we can legitimately need
-      --  another semicolon. This could only arise in an error situation
-      --  where an error has already been signalled. By simply ignoring
-      --  the request for a semicolon in this case, we avoid some spurious
-      --  missing semicolon messages.
+      --  semicolon, then there is no way that we can legitimately need another
+      --  semicolon. This could only arise in an error situation where an error
+      --  has already been signalled. By simply ignoring the request for a
+      --  semicolon in this case, we avoid some spurious missing semicolon
+      --  messages.
 
       elsif Prev_Token = Tok_Semicolon then
          return;
 
-      --  If the current token is | then this is a reasonable
-      --  place to suggest the possibility of a "C" confusion :-)
+      --  If the current token is | then this is a reasonable place to suggest
+      --  the possibility of a "C" confusion.
 
       elsif Token = Tok_Vertical_Bar then
          Error_Msg_SC ("unexpected occurrence of ""'|"", did you mean OR'?");
          Resync_Past_Semicolon;
          return;
 
-      --  Deal with pragma. If pragma is not at start of line, it is
-      --  considered misplaced otherwise we treat it as a normal
-      --  missing semicolong case.
+      --  Deal with pragma. If pragma is not at start of line, it is considered
+      --  misplaced otherwise we treat it as a normal missing semicolong case.
 
       elsif Token = Tok_Pragma
         and then not Token_Is_At_Start_Of_Line
@@ -795,17 +794,12 @@ package body Tchk is
    -----------------
 
    procedure Wrong_Token (T : Token_Type; P : Position) is
-      Missing : constant String := "missing ";
-      Image : constant String := Token_Type'Image (T);
+      Missing  : constant String := "missing ";
+      Image    : constant String := Token_Type'Image (T);
       Tok_Name : constant String := Image (5 .. Image'Length);
-      M : String (1 .. Missing'Length + Tok_Name'Length);
+      M        : constant String := Missing & Tok_Name;
 
    begin
-      --  Set M to Missing & Tok_Name.
-
-      M (1 .. Missing'Length) := Missing;
-      M (Missing'Length + 1 .. M'Last) := Tok_Name;
-
       if Token = Tok_Semicolon then
          Scan;