Improve the change to allow parsing 9%a

If there was a later syntax error, this could incorrectly get
reported as:

Error: Unknown directive '%a'.
This commit is contained in:
Olly Betts 2022-03-04 17:00:20 +13:00
commit 8cd2cfa9d1
3 changed files with 24 additions and 3 deletions

View file

@ -573,6 +573,9 @@ int yylex(void) {
scanner_init();
}
Delete(cparse_unknown_directive);
cparse_unknown_directive = NULL;
if (next_token) {
l = next_token;
next_token = 0;
@ -951,9 +954,6 @@ int yylex(void) {
return (yylex());
} else {
Delete(cparse_unknown_directive);
cparse_unknown_directive = NULL;
/* SWIG directives */
if (strcmp(yytext, "%module") == 0)
return (MODULE);