aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/scng.adb
diff options
context:
space:
mode:
authorArnaud Charlet <charlet@gcc.gnu.org>2011-08-05 17:17:37 +0200
committerArnaud Charlet <charlet@gcc.gnu.org>2011-08-05 17:17:37 +0200
commita2773bd3e6fd84714d9568ebc9e15bc46dcd1c6f (patch)
treeba708f88b444bcbc812ada1c70ff45ef811962f8 /gcc/ada/scng.adb
parentaca0b0b315f6e5a0ee60981fd4b0cbc9a7f59096 (diff)
downloadgcc-a2773bd3e6fd84714d9568ebc9e15bc46dcd1c6f.zip
gcc-a2773bd3e6fd84714d9568ebc9e15bc46dcd1c6f.tar.gz
gcc-a2773bd3e6fd84714d9568ebc9e15bc46dcd1c6f.tar.bz2
[multiple changes]
2011-08-05 Thomas Quinot <quinot@adacore.com> * sem_ch11.adb: Add comment. 2011-08-05 Robert Dewar <dewar@adacore.com> * exp_util.adb: Minor comment fix. 2011-08-05 Robert Dewar <dewar@adacore.com> * scng.adb (Error_Unterminated_String): Improve flag position when comma present. 2011-08-05 Matthew Heaney <heaney@adacore.com> * Makefile.rtl, impunit.adb: Added a-cbmutr.ad[sb] (bounded multiway tree containers). * a-cbmutr.ads, a-cbmutr.adb: This is the new Ada 2012 unit for bounded multiway tree containers. 2011-08-05 Robert Dewar <dewar@adacore.com> * styleg.adb (Check_Comment): Implement comment spacing of 1 or 2 * stylesw.adb: Implement -gnatyC to control comment spacing * stylesw.ads (Style_Check_Comments_Spacing): New switch (set by -gnatyc/C). * usage.adb: Add line for -gnatyC. 2011-08-05 Robert Dewar <dewar@adacore.com> * gnat_ugn.texi: Document -gnatyC for J505-006 * vms_data.ads: Implement COMMENTS1/COMMENTS2 (retaining COMMENTS as a synonym for COMMENTS2). From-SVN: r177453
Diffstat (limited to 'gcc/ada/scng.adb')
-rw-r--r--gcc/ada/scng.adb29
1 files changed, 29 insertions, 0 deletions
diff --git a/gcc/ada/scng.adb b/gcc/ada/scng.adb
index f0bc9de..2935bdb 100644
--- a/gcc/ada/scng.adb
+++ b/gcc/ada/scng.adb
@@ -919,6 +919,9 @@ package body Scng is
Err : Boolean;
-- Error flag for Scan_Wide call
+ String_Start : Source_Ptr;
+ -- Point to first character of string
+
procedure Error_Bad_String_Char;
-- Signal bad character in string/character literal. On entry
-- Scan_Ptr points to the improper character encountered during the
@@ -966,6 +969,8 @@ package body Scng is
-------------------------------
procedure Error_Unterminated_String is
+ S : Source_Ptr;
+
begin
-- An interesting little refinement. Consider the following
-- examples:
@@ -973,6 +978,7 @@ package body Scng is
-- A := "this is an unterminated string;
-- A := "this is an unterminated string &
-- P(A, "this is a parameter that didn't get terminated);
+ -- P("this is a parameter that didn't get terminated, A);
-- We fiddle a little to do slightly better placement in these
-- cases also if there is white space at the end of the line we
@@ -1012,6 +1018,8 @@ package body Scng is
return;
end if;
+ -- Backup over semicolon or right-paren/semicolon sequence
+
if Source (Scan_Ptr - 1) = ';' then
Scan_Ptr := Scan_Ptr - 1;
Unstore_String_Char;
@@ -1022,6 +1030,25 @@ package body Scng is
end if;
end if;
+ -- See if there is a comma in the string, if so, guess that
+ -- the first comma terminates the string.
+
+ S := String_Start;
+ while S < Scan_Ptr loop
+ if Source (S) = ',' then
+ while Scan_Ptr > S loop
+ Scan_Ptr := Scan_Ptr - 1;
+ Unstore_String_Char;
+ end loop;
+
+ exit;
+ end if;
+
+ S := S + 1;
+ end loop;
+
+ -- Now we have adjusted the scan pointer, give message
+
Error_Msg_S -- CODEFIX
("missing string quote");
end Error_Unterminated_String;
@@ -1161,6 +1188,8 @@ package body Scng is
-- quote). The latter case is an error detected by the character
-- literal circuit.
+ String_Start := Scan_Ptr;
+
Delimiter := Source (Scan_Ptr);
Accumulate_Checksum (Delimiter);