mirror of
https://github.com/open-simh/simtools.git
synced 2026-01-27 12:41:46 +00:00
Make operand parsing error messages more helpful
and add a test that is supposed to exercise them all.
This commit is contained in:
15
parse.c
15
parse.c
@@ -211,7 +211,7 @@ int get_mode(
|
||||
mode->offset = parse_expr(cp, 0);
|
||||
if (endp)
|
||||
*endp = mode->offset->cp;
|
||||
return TRUE;
|
||||
return expr_ok(mode->offset);
|
||||
}
|
||||
|
||||
/* Check for -(Rn) */
|
||||
@@ -281,6 +281,9 @@ int get_mode(
|
||||
|
||||
mode->offset = parse_expr(cp, 0);
|
||||
|
||||
if (!expr_ok(mode->offset))
|
||||
return FALSE;
|
||||
|
||||
cp = skipwhite(mode->offset->cp);
|
||||
|
||||
if (*cp == '(') {
|
||||
@@ -1177,3 +1180,13 @@ EX_TREE *parse_unary_expr(
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
/*
|
||||
* expr_ok Returns TRUE if there was a valid expression parsed.
|
||||
*/
|
||||
|
||||
int expr_ok(
|
||||
EX_TREE *expr)
|
||||
{
|
||||
return expr != NULL && expr->type != EX_ERR;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user