Fix/work around a bug in parse_expr().

There was an obscure bug in parse_expr(), used to evaluate 'if df',
where it could skip past the end of the line marker.

If this happened inside an expanded macro, then after that was the
next line...
In other cases it might be worse.

Now that this is fixed, another check for line end junk can be enabled.
This commit is contained in:
Olaf Seibert
2021-01-23 20:05:50 +01:00
parent 6f1af83101
commit c587587f49
5 changed files with 67 additions and 11 deletions

View File

@@ -64,7 +64,7 @@ int check_eol(
return 1;
}
report(stack->top, "Junk at end of line ('%s')\n", cp);
report(stack->top, "Junk at end of line ('%.20s')\n", cp);
return 0;
}
@@ -1072,7 +1072,9 @@ EX_TREE *parse_unary(
get_symbol a second time. */
if (!(label = get_symbol(cp, &cp, &local))) {
cp++; /*JH: eat first char of illegal label, else endless loop on implied .WORD */
if (!EOL(*cp)) {
cp++; /*JH: eat first char of illegal label, else endless loop on implied .WORD */
}
tp = ex_err(NULL, cp); /* Not a valid label. */
return tp;
}