Fix .asciz <expr>... where an overzealous parsing wants to parse too much of the remaining text

In particular, the example was
	.asciz <cr><lf>/<SOH>/
where it tried to make a division betweem <lf> and the delimited
string /<SOH>/.
This commit is contained in:
Olaf Seibert
2015-05-10 17:32:44 +02:00
parent 2c091595e9
commit fcc85aa5f5
3 changed files with 27 additions and 1 deletions

23
parse.c
View File

@@ -863,3 +863,26 @@ EX_TREE *parse_expr(
return value;
}
/*
parse_unary_expr It parses and evaluates
an arithmetic expression but only a unary: (op)value or <expr>.
In particular, it doesn't try to divide in <lf>/SOH/.
*/
EX_TREE *parse_unary_expr(
char *cp,
int undef)
{
EX_TREE *expr;
EX_TREE *value;
expr = parse_unary(cp); /* Parse into a tree */
value = evaluate(expr, undef); /* Perform the arithmetic */
value->cp = expr->cp; /* Pointer to end of text is part of
the rootmost node */
free_tree(expr); /* Discard parse in favor of
evaluation */
return value;
}