From e35f4fb48fc180568dff523d2cb68ea9bb519c44 Mon Sep 17 00:00:00 2001 From: Spiro Trikaliotis Date: Tue, 15 Feb 2022 21:46:07 +0100 Subject: [PATCH] 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. --- src/ca65/expr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ca65/expr.c b/src/ca65/expr.c index aad4d9ae5..74133d533 100644 --- a/src/ca65/expr.c +++ b/src/ca65/expr.c @@ -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;