forked from Telodendria/Telodendria
Cope with preprocessor macro usage at the top level of the header.
This workaround allows us to parse the Routes.h properly, although it notably lacks support for multi-word unknown expressions.
This commit is contained in:
parent
a3cc06ff2a
commit
0b1b4a8b29
3 changed files with 8 additions and 3 deletions
|
@ -651,9 +651,9 @@ HeaderParse(Stream * stream, HeaderExpr * expr)
|
|||
}
|
||||
else
|
||||
{
|
||||
expr->type = HP_SYNTAX_ERROR;
|
||||
expr->data.error.msg = "Expected comment, typedef, or extern.";
|
||||
expr->data.error.lineNo = expr->state.lineNo;
|
||||
/* Cope with preprocessor macro expansions at the top level. */
|
||||
expr->type = HP_UNKNOWN;
|
||||
strncpy(expr->data.text, word, HEADER_EXPR_MAX);
|
||||
}
|
||||
|
||||
Free(word);
|
||||
|
|
|
@ -57,6 +57,7 @@ typedef enum HeaderExprType
|
|||
HP_TYPEDEF,
|
||||
HP_DECLARATION,
|
||||
HP_GLOBAL,
|
||||
HP_UNKNOWN,
|
||||
HP_SYNTAX_ERROR,
|
||||
HP_PARSE_ERROR,
|
||||
HP_EOF
|
||||
|
|
|
@ -315,6 +315,10 @@ main(int argc, char **argv)
|
|||
isDocumented = 0;
|
||||
}
|
||||
break;
|
||||
case HP_UNKNOWN:
|
||||
StreamPrintf(StreamStderr(), "Warning: Unknown expression: %s\n",
|
||||
expr.data.text);
|
||||
break;
|
||||
default:
|
||||
StreamPrintf(StreamStderr(), "Unknown header type: %d\n", expr.type);
|
||||
StreamPrintf(StreamStderr(), "This is a programming error.\n");
|
||||
|
|
Loading…
Reference in a new issue