diff options
author | Robert Dewar <dewar@adacore.com> | 2007-06-06 12:40:24 +0200 |
---|---|---|
committer | Arnaud Charlet <charlet@gcc.gnu.org> | 2007-06-06 12:40:24 +0200 |
commit | af1a7c88790c042e3bf59ae3863f197b397fd561 (patch) | |
tree | 6b78faa291a7b8ecccf2f5ac6f2861d44e453f1b /gcc/ada/par-ch4.adb | |
parent | f92f17e6e943377eb2e7b43f5de31ceda409c6cc (diff) | |
download | gcc-af1a7c88790c042e3bf59ae3863f197b397fd561.zip gcc-af1a7c88790c042e3bf59ae3863f197b397fd561.tar.gz gcc-af1a7c88790c042e3bf59ae3863f197b397fd561.tar.bz2 |
par-ch4.adb: (P_Name): Recover from literal used as name
2007-04-20 Robert Dewar <dewar@adacore.com>
* par-ch4.adb: (P_Name): Recover from literal used as name
From-SVN: r125440
Diffstat (limited to 'gcc/ada/par-ch4.adb')
-rw-r--r-- | gcc/ada/par-ch4.adb | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/gcc/ada/par-ch4.adb b/gcc/ada/par-ch4.adb index 220c065..074e4db 100644 --- a/gcc/ada/par-ch4.adb +++ b/gcc/ada/par-ch4.adb @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 1992-2006, 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- -- @@ -190,9 +190,24 @@ package body Ch4 is Attr_Name : Name_Id := No_Name; -- kill junk warning begin + -- Case of not a name + if Token not in Token_Class_Name then - Error_Msg_AP ("name expected"); - raise Error_Resync; + + -- If it looks like start of expression, complain and scan expression + + if Token in Token_Class_Literal + or else Token = Tok_Left_Paren + then + Error_Msg_SC ("name expected"); + return P_Expression; + + -- Otherwise some other junk, not much we can do + + else + Error_Msg_AP ("name expected"); + raise Error_Resync; + end if; end if; -- Loop through designators in qualified name @@ -1555,7 +1570,6 @@ package body Ch4 is else return Node1; end if; - end P_Expression; -- This function is identical to the normal P_Expression, except that it |