public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* Error handling in the new C++ parser
@ 2002-12-29 11:59 Andi Kleen
  2002-12-30 13:51 ` Mark Mitchell
  0 siblings, 1 reply; 2+ messages in thread
From: Andi Kleen @ 2002-12-29 11:59 UTC (permalink / raw)
  To: gcc


Hi,

I looked at the new C++ parser in mainline and noticed there are lots 
of unchecked cp_parser_require() in parser.c. Sometimes it checks 
later using cp_parser_error_occurred(), but in many other cases
it doesn't.

There seems to be no effort to skip to a sychronizing token
(like ';' or ')') after a normal syntax error, like the old bison
parser did.  I expect it will just become hopelessly confused in this 
case then.

Can someone please expand a bit on how the syntax error recovery 
is supposed to work ? 

Thanks,

-Andi

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Error handling in the new C++ parser
  2002-12-29 11:59 Error handling in the new C++ parser Andi Kleen
@ 2002-12-30 13:51 ` Mark Mitchell
  0 siblings, 0 replies; 2+ messages in thread
From: Mark Mitchell @ 2002-12-30 13:51 UTC (permalink / raw)
  To: Andi Kleen, gcc

> There seems to be no effort to skip to a sychronizing token
> (like ';' or ')') after a normal syntax error, like the old bison
> parser did.

It does that when it wants to do that.

There's no need to attempt immediately recovery after missing one
required token; we can wait util it's convenient.

Look for functions with names like cp_parser_skip* to find places where
we skip ahead until something sensible shows up.

I'm sure the error recovery can be improved, but it does OK most of
the time.

-- 
Mark Mitchell                mark@codesourcery.com
CodeSourcery, LLC            http://www.codesourcery.com

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2002-12-30 19:30 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-12-29 11:59 Error handling in the new C++ parser Andi Kleen
2002-12-30 13:51 ` Mark Mitchell

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).