1
0
mirror of https://github.com/cc65/cc65.git synced 2024-12-25 02:29:52 +00:00

Invalid flagged errors if token is missing

A missing factor in an expression causes an expected but missing token
to be skipped, leading to invalid flagged errors in the following line:

l = 3 +
lda     #$00

An error should be output for line 1, but not for line 2. Actually, both
are flagged as errors:

test.s(1): Error: Syntax error
test.s(2): Error: Unexpected trailing garbage characters

This patch (as proposed in issue #1634 by kugelfuhr) fixes this.
This commit is contained in:
Spiro Trikaliotis 2022-02-15 21:46:07 +01:00 committed by mrdudz
parent 3b964c9674
commit e35f4fb48f

View File

@ -1226,11 +1226,11 @@ static ExprNode* Factor (void)
SB_GetLen (&CurTok.SVal) == 1) {
/* A character constant */
N = GenLiteralExpr (TgtTranslateChar (SB_At (&CurTok.SVal, 0)));
NextTok ();
} else {
N = GenLiteral0 (); /* Dummy */
Error ("Syntax error");
}
NextTok ();
break;
}
return N;