Improve error recovery.
This commit is contained in:
@@ -853,26 +853,23 @@ static void OneLine (void)
|
|||||||
Seg = ActiveSeg;
|
Seg = ActiveSeg;
|
||||||
PC = GetPC ();
|
PC = GetPC ();
|
||||||
|
|
||||||
/* Define the label */
|
|
||||||
SymDef (Sym, GenCurrentPC (), ADDR_SIZE_DEFAULT, SF_LABEL);
|
|
||||||
|
|
||||||
/* Skip the colon. If NoColonLabels is enabled, allow labels
|
/* Skip the colon. If NoColonLabels is enabled, allow labels
|
||||||
** without a colon if there is no whitespace before the
|
** without a colon if there is no whitespace before the
|
||||||
** identifier.
|
** identifier.
|
||||||
*/
|
*/
|
||||||
if (CurTok.Tok != TOK_COLON) {
|
if (CurTok.Tok != TOK_COLON) {
|
||||||
if (HadWS || !NoColonLabels) {
|
if (HadWS || !NoColonLabels) {
|
||||||
Error ("Expected ':' after identifier to form a label");
|
ErrorSkip ("Expected ':' after identifier to form a label");
|
||||||
/* Try some smart error recovery */
|
goto Done;
|
||||||
if (CurTok.Tok == TOK_NAMESPACE) {
|
|
||||||
NextTok ();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
/* Skip the colon */
|
/* Skip the colon */
|
||||||
NextTok ();
|
NextTok ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Define the label */
|
||||||
|
SymDef (Sym, GenCurrentPC (), ADDR_SIZE_DEFAULT, SF_LABEL);
|
||||||
|
|
||||||
/* If we come here, a new identifier may be waiting, which may
|
/* If we come here, a new identifier may be waiting, which may
|
||||||
** be a macro or instruction.
|
** be a macro or instruction.
|
||||||
*/
|
*/
|
||||||
@@ -907,8 +904,8 @@ static void OneLine (void)
|
|||||||
} else if (PCAssignment && (CurTok.Tok == TOK_STAR || CurTok.Tok == TOK_PC)) {
|
} else if (PCAssignment && (CurTok.Tok == TOK_STAR || CurTok.Tok == TOK_PC)) {
|
||||||
NextTok ();
|
NextTok ();
|
||||||
if (CurTok.Tok != TOK_EQ) {
|
if (CurTok.Tok != TOK_EQ) {
|
||||||
Error ("'=' expected");
|
ErrorSkip ("'=' expected");
|
||||||
SkipUntilSep ();
|
goto Done;
|
||||||
} else {
|
} else {
|
||||||
/* Skip the equal sign */
|
/* Skip the equal sign */
|
||||||
NextTok ();
|
NextTok ();
|
||||||
@@ -938,6 +935,7 @@ static void OneLine (void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Done:
|
||||||
/* Line separator must come here */
|
/* Line separator must come here */
|
||||||
ConsumeSep ();
|
ConsumeSep ();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user