From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 16289 invoked by alias); 19 Jan 2003 13:15:19 -0000 Mailing-List: contact gcc-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-owner@gcc.gnu.org Received: (qmail 16250 invoked from network); 19 Jan 2003 13:15:19 -0000 Received: from unknown (HELO nile.gnat.com) (205.232.38.5) by 172.16.49.205 with SMTP; 19 Jan 2003 13:15:19 -0000 Received: by nile.gnat.com (Postfix, from userid 338) id 26D77F2D53; Sun, 19 Jan 2003 08:15:15 -0500 (EST) To: phil@jaj.com, tilps@hotmail.com Subject: Re: new parser: error recovery needs work Cc: gcc@gcc.gnu.org Message-Id: <20030119131515.26D77F2D53@nile.gnat.com> Date: Sun, 19 Jan 2003 17:31:00 -0000 From: dewar@gnat.com (Robert Dewar) X-SW-Source: 2003-01/txt/msg00895.txt.bz2 > (I think i heard something about carat errors being on > the way, A little note here. I assume carat error means errors where there is a pointer to the column of the error. What we found very useful in GNAT was to define the following routines: procedure Error_Msg_AP (Msg : String); -- Output a message just after the previous token. This routine can be -- called only from the parser, since it references Prev_Token_Ptr. procedure Error_Msg_BC (Msg : String); -- Output a message just before the current token. Note that the important -- difference between this and the previous routine is that the BC case -- posts a flag on the current line, whereas AP can post a flag at the -- end of the preceding line. This routine can be called only from the -- parser, since it references Token_Ptr. procedure Error_Msg_SC (Msg : String); -- Output a message at the start of the current token, unless we are at -- the end of file, in which case we always output the message after the -- last real token in the file. This routine can be called only from the -- parser, since it references Token_Ptr. procedure Error_Msg_SP (Msg : String); -- Output a message at the start of the previous token. This routine can -- be called only from the parser, since it references Prev_Token_Ptr. This allows very precise placement of the message pointers. One danger of message pointers is that if they are not exactly right, they can obfuscate rather than clarify the error.