diff options
author | charlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4> | 2009-05-06 15:08:57 +0000 |
---|---|---|
committer | charlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4> | 2009-05-06 15:08:57 +0000 |
commit | a79db2128caf19bc6aa01a90917eef6119a57981 (patch) | |
tree | 818ba69ac8fa94ec7b09ad931f8d3114dbc0ed96 /gcc/ada/sinput.adb | |
parent | b3c7348721a70eb72eedb1416615316a0d582283 (diff) | |
download | gcc-a79db2128caf19bc6aa01a90917eef6119a57981.tar.gz |
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
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@147181 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/ada/sinput.adb')
-rw-r--r-- | gcc/ada/sinput.adb | 50 |
1 files changed, 37 insertions, 13 deletions
diff --git a/gcc/ada/sinput.adb b/gcc/ada/sinput.adb index 949fcc3afa2..020e69df26d 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; |