mirror of
https://github.com/open-simh/simtools.git
synced 2026-01-15 08:02:48 +00:00
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:
parent
2c091595e9
commit
fcc85aa5f5
@ -1077,7 +1077,7 @@ static int assemble(
|
||||
cp = skipwhite(cp);
|
||||
if (*cp == '<' || *cp == '^') {
|
||||
/* A byte value */
|
||||
value = parse_expr(cp, 0);
|
||||
value = parse_unary_expr(cp, 0);
|
||||
cp = value->cp;
|
||||
store_value(stack, tr, 1, value);
|
||||
free_tree(value);
|
||||
|
||||
23
parse.c
23
parse.c
@ -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;
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user