mirror of
https://github.com/cc65/cc65.git
synced 2024-11-18 15:05:14 +00:00
Fix .endmacro in a .define in a macro body
This commit is contained in:
parent
a299ef4210
commit
e87325033d
@ -391,6 +391,7 @@ void MacDef (unsigned Style)
|
||||
Macro* M;
|
||||
TokNode* N;
|
||||
int HaveParams;
|
||||
int DefineActive = 0;
|
||||
|
||||
/* We expect a macro name here */
|
||||
if (CurTok.Tok != TOK_IDENT) {
|
||||
@ -491,8 +492,8 @@ void MacDef (unsigned Style)
|
||||
while (1) {
|
||||
/* Check for end of macro */
|
||||
if (Style == MAC_STYLE_CLASSIC) {
|
||||
/* In classic macros, only .endmacro is allowed */
|
||||
if (CurTok.Tok == TOK_ENDMACRO) {
|
||||
/* In classic macros, only .endmacro is allowed, but ignore it if it is in a .define */
|
||||
if (CurTok.Tok == TOK_ENDMACRO && !DefineActive) {
|
||||
/* Done */
|
||||
break;
|
||||
}
|
||||
@ -573,6 +574,13 @@ void MacDef (unsigned Style)
|
||||
}
|
||||
++M->TokCount;
|
||||
|
||||
/* Mark if .define has been read until end of line has been reached */
|
||||
if (CurTok.Tok == TOK_DEFINE) {
|
||||
DefineActive = 1;
|
||||
} else if (TokIsSep(CurTok.Tok)) {
|
||||
DefineActive = 0;
|
||||
}
|
||||
|
||||
/* Read the next token */
|
||||
NextTok ();
|
||||
}
|
||||
@ -582,7 +590,7 @@ void MacDef (unsigned Style)
|
||||
NextTok ();
|
||||
}
|
||||
|
||||
/* Reset the Incomplete flag now that parsing is done */
|
||||
/* Reset the Incomplete flag now that parsing is done */
|
||||
M->Incomplete = 0;
|
||||
|
||||
Done:
|
||||
|
Loading…
Reference in New Issue
Block a user