Merge pull request #2971 from tlgkccampbell/fix-slash-scanning

Fix scanning of /* when CComments is disabled
This commit is contained in:
Bob Andrews authored and GitHub committed 2026-08-20 15:43:22 +02:00
commit a68dbdbda2
2 files changed
+18 -4

No files matched your search

+4 -4
View File
@@ -1389,15 +1389,13 @@ CharAgain:
case '/':
NextChar ();
if (C != '*') {
CurTok.Tok = TOK_DIV;
} else if (CComments) {
if (C == '*' && CComments) {
/* Remember the position, then skip the '*' */
Collection LineInfos = STATIC_COLLECTION_INITIALIZER;
GetFullLineInfo (&LineInfos);
NextChar ();
do {
while (C != '*') {
while (C != '*') {
if (C == EOF) {
LIError (&LineInfos, "Unterminated comment");
ReleaseFullLineInfo (&LineInfos);
@@ -1412,6 +1410,8 @@ CharAgain:
ReleaseFullLineInfo (&LineInfos);
DoneCollection (&LineInfos);
goto Again;
} else {
CurTok.Tok = TOK_DIV;
}
return;
+14
View File
@@ -0,0 +1,14 @@
.export _main
; both expressions are valid with c_comments disabled
.feature c_comments -
.org $0002
.assert 8 / * = 4, error, "8 / * should evaluate to 4"
.assert 8/* = 4, error, "8/* should evaluate to 4"
.reloc
_main:
lda #0
tax
rts