aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/sinput.adb
diff options
context:
space:
mode:
authorRobert Dewar <dewar@adacore.com>2009-05-06 15:08:57 +0000
committerArnaud Charlet <charlet@gcc.gnu.org>2009-05-06 17:08:57 +0200
commite0bf7d650ca008463f43269a57cc2cf602bca20b (patch)
tree818ba69ac8fa94ec7b09ad931f8d3114dbc0ed96 /gcc/ada/sinput.adb
parent9419a9fdc8150067898eb5ad6347c3b55d4817e1 (diff)
downloadgcc-e0bf7d650ca008463f43269a57cc2cf602bca20b.zip
gcc-e0bf7d650ca008463f43269a57cc2cf602bca20b.tar.gz
gcc-e0bf7d650ca008463f43269a57cc2cf602bca20b.tar.bz2
sinput.adb (Expr_Last_Char): Fix some copy-paste errors for paren skipping.
2009-05-06 Robert Dewar <dewar@adacore.com> * sinput.adb (Expr_Last_Char): Fix some copy-paste errors for paren skipping. (Expr_First_Char): Add ??? comment that paren skipping needs work (Expr_Last_Char): Add ??? comment that paren skipping needs work * exp_attr.adb: Add processing for Compiler_Version * sem_attr.adb: New attribute Compiler_Version * snames.ads-tmpl: Add entries for Compiler_Version attribute * gnat_rm.texi: Document Compiler_Version attribute From-SVN: r147181
Diffstat (limited to 'gcc/ada/sinput.adb')
-rw-r--r--gcc/ada/sinput.adb50
1 files changed, 37 insertions, 13 deletions
diff --git a/gcc/ada/sinput.adb b/gcc/ada/sinput.adb
index 949fcc3..020e69d 100644
--- a/gcc/ada/sinput.adb
+++ b/gcc/ada/sinput.adb
@@ -317,6 +317,11 @@ package body Sinput is
Loc := Sloc (N);
+ -- Skip past parens
+
+ -- This is not right, it does not deal with skipping comments
+ -- and probably also has wide character problems ???
+
if Count > 0 then
declare
SFI : constant Source_File_Index :=
@@ -408,7 +413,7 @@ package body Sinput is
N_Conditional_Expression =>
raise Program_Error;
- -- Cases where the Sloc points to the start of the tokem, but we
+ -- Cases where the Sloc points to the start of the token, but we
-- still need to handle the sequence of left parentheses.
when N_Identifier |
@@ -425,25 +430,44 @@ package body Sinput is
Loc := Sloc (N);
- if Count > 0 then
- declare
- SFI : constant Source_File_Index :=
- Get_Source_File_Index (Loc);
- Src : constant Source_Buffer_Ptr := Source_Text (SFI);
- Fst : constant Source_Ptr := Source_Last (SFI);
+ -- Now we have two tasks, first we are pointing to the start
+ -- of the token below, second, we need to skip parentheses.
- begin
+ -- Skipping to the end of a token is not easy, we can't just
+ -- skip to a space, since we may have e.g. X*YAR+Z, and if we
+ -- are finding the end of the subexpression X*YAR, we don't
+ -- want to skip past the +Z. Also we have to worry about
+ -- skipping comments, and about wide characters ???
+
+ declare
+ SFI : constant Source_File_Index :=
+ Get_Source_File_Index (Loc);
+ Src : constant Source_Buffer_Ptr := Source_Text (SFI);
+ Lst : constant Source_Ptr := Source_Last (SFI);
+
+ begin
+ -- Scan through first blank character, to get to the end
+ -- of this token. As noted above that's not really right???
+
+ loop
+ exit when Loc = Lst or else Src (Loc + 1) <= ' ';
+ Loc := Loc + 1;
+ end loop;
+
+ -- Skip past parens, but this also ignores comments ???
+
+ if Count > 0 then
for J in 1 .. Count loop
loop
- exit when Loc = Fst;
- Loc := Loc - 1;
+ exit when Loc = Lst;
+ Loc := Loc + 1;
exit when Src (Loc) >= ' ';
end loop;
- exit when Src (Loc) /= '(';
+ exit when Src (Loc) /= ')';
end loop;
- end;
- end if;
+ end if;
+ end;
return Loc;
end case;