- struct expression *e = expr_parse (lexer, ds, type);
- if (e != NULL)
- pool_add_subpool (pool, e->expr_pool);
- return e;
+ struct expression *e = expr_create (ds);
+ union any_node *n = parse_or (lexer, e);
+ if (!n)
+ {
+ expr_free (e);
+ return NULL;
+ }
+
+ atom_type actual_type = expr_node_returns (n);
+ if (actual_type != OP_number && actual_type != OP_boolean)
+ {
+ msg (SE, _("This command tries to create a new variable %s by assigning a "
+ "string value to it, but this is not supported. Use "
+ "the STRING command to create the new variable with the "
+ "correct width before assigning to it, e.g. STRING %s(A20)."),
+ new_var_name, new_var_name);
+ expr_free (e);
+ return NULL;
+ }
+
+ return finish_expression (expr_optimize (n, e), e);