Merge pull request #2971 from tlgkccampbell/fix-slash-scanning
Fix scanning of /* when CComments is disabled
This commit is contained in:
2 files changed
+18
-4
No files matched your search
+4
-4
@@ -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;
|
||||
|
||||
|
||||
@@ -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
|
||||
Reference in new issue
Block a user