mirror of
https://github.com/cc65/cc65.git
synced 2025-01-11 11:30:13 +00:00
Fixed the bug that C keywords were not simply recognized as identifiers in preprocessing.
This commit is contained in:
parent
7a139a800e
commit
4bb4f033ea
@ -215,6 +215,12 @@ static void PPhie11 (PPExpr* Expr)
|
|||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Check for excessive expressions */
|
||||||
|
if (!TokIsPunc (&CurTok)) {
|
||||||
|
PPError ("Missing binary operator");
|
||||||
|
PPErrorSkipLine ();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -854,7 +860,7 @@ void ParsePPExprInLine (PPExpr* Expr)
|
|||||||
/* Initialize the parser status */
|
/* Initialize the parser status */
|
||||||
PPEvaluationFailed = 0;
|
PPEvaluationFailed = 0;
|
||||||
PPEvaluationEnabled = 1;
|
PPEvaluationEnabled = 1;
|
||||||
NextLineDisabled = 1;
|
PPParserRunning = 1;
|
||||||
|
|
||||||
/* Parse */
|
/* Parse */
|
||||||
PPExprInit (Expr);
|
PPExprInit (Expr);
|
||||||
@ -867,5 +873,5 @@ void ParsePPExprInLine (PPExpr* Expr)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Restore parser status */
|
/* Restore parser status */
|
||||||
NextLineDisabled = 0;
|
PPParserRunning = 0;
|
||||||
}
|
}
|
||||||
|
@ -69,7 +69,7 @@
|
|||||||
|
|
||||||
Token CurTok; /* The current token */
|
Token CurTok; /* The current token */
|
||||||
Token NextTok; /* The next token */
|
Token NextTok; /* The next token */
|
||||||
int NextLineDisabled; /* Disabled to read next line */
|
int PPParserRunning; /* Is tokenizer used by the preprocessor */
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -189,8 +189,10 @@ static int SkipWhite (void)
|
|||||||
{
|
{
|
||||||
while (1) {
|
while (1) {
|
||||||
while (CurC == '\0') {
|
while (CurC == '\0') {
|
||||||
/* If reading next line fails or is forbidden, bail out */
|
/* If reading next line fails or is disabled with directives, bail
|
||||||
if (NextLineDisabled || PreprocessNextLine () == 0) {
|
** out.
|
||||||
|
*/
|
||||||
|
if (PPParserRunning || PreprocessNextLine () == 0) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -759,11 +761,14 @@ void NextToken (void)
|
|||||||
/* Check for keywords and identifiers */
|
/* Check for keywords and identifiers */
|
||||||
if (IsSym (token)) {
|
if (IsSym (token)) {
|
||||||
|
|
||||||
/* Check for a keyword */
|
if (!PPParserRunning) {
|
||||||
if ((NextTok.Tok = FindKey (token)) != TOK_IDENT) {
|
/* Check for a keyword */
|
||||||
/* Reserved word found */
|
if ((NextTok.Tok = FindKey (token)) != TOK_IDENT) {
|
||||||
return;
|
/* Reserved word found */
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* No reserved word, check for special symbols */
|
/* No reserved word, check for special symbols */
|
||||||
if (token[0] == '_' && token[1] == '_') {
|
if (token[0] == '_' && token[1] == '_') {
|
||||||
/* Special symbols */
|
/* Special symbols */
|
||||||
|
@ -220,7 +220,7 @@ struct Token {
|
|||||||
|
|
||||||
extern Token CurTok; /* The current token */
|
extern Token CurTok; /* The current token */
|
||||||
extern Token NextTok; /* The next token */
|
extern Token NextTok; /* The next token */
|
||||||
extern int NextLineDisabled; /* Disabled to read next line */
|
extern int PPParserRunning; /* Is tokenizer used by the preprocessor */
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user