1
0
mirror of https://github.com/cc65/cc65.git synced 2024-12-23 04:30:10 +00:00

Improve error recovery

git-svn-id: svn://svn.cc65.org/cc65/trunk@2002 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
cuz 2003-03-06 12:12:25 +00:00
parent 0ae6ab57ae
commit e925aa27ee

View File

@ -1084,6 +1084,9 @@ static unsigned ParseStructInit (type* Type, int AllowFlexibleMembers)
unsigned StructSize; unsigned StructSize;
unsigned Size; unsigned Size;
static const token_t EndTokens[] = { TOK_RCURLY, TOK_SEMI };
/* Consume the opening curly brace */ /* Consume the opening curly brace */
ConsumeLCurly (); ConsumeLCurly ();
@ -1099,7 +1102,12 @@ static unsigned ParseStructInit (type* Type, int AllowFlexibleMembers)
Tab = Entry->V.S.SymTab; Tab = Entry->V.S.SymTab;
if (Tab == 0) { if (Tab == 0) {
Error ("Cannot initialize variables with incomplete type"); Error ("Cannot initialize variables with incomplete type");
/* Returning here will cause lots of errors, but recovery is difficult */ /* Try error recovery */
SkipTokens (EndTokens, sizeof(EndTokens)/sizeof(EndTokens[0]));
if (CurTok.Tok == TOK_RCURLY) {
NextToken ();
}
/* Nothing initialized */
return 0; return 0;
} }