Add support for exclude of a point
Parameter value ranges support the exclude of a point as well as range, so add the syntax to support that case. Internally it is handled as a degenerate range, but the parse and initial elaboration need to know about it.
This commit is contained in:
parent
30570adf31
commit
2576543bb5
|
|
@ -98,7 +98,16 @@ void Module::elaborate_parm_item_(perm_string name, const param_expr_t&cur,
|
|||
tmp->low_expr = 0;
|
||||
}
|
||||
|
||||
if (range->high_expr) {
|
||||
if (range->high_expr && range->high_expr==range->low_expr) {
|
||||
// Detect the special case of a "point"
|
||||
// range. These are called out by setting the high
|
||||
// and low expression ranges to the same
|
||||
// expression. The exclude_flags should be false
|
||||
// in this case
|
||||
ivl_assert(*range->high_expr, tmp->low_open_flag==false && tmp->high_open_flag==false);
|
||||
tmp->high_expr = tmp->low_expr;
|
||||
|
||||
} else if (range->high_expr) {
|
||||
tmp->high_expr = elab_and_eval(des, scope, range->high_expr, -1);
|
||||
ivl_assert(*range->high_expr, tmp->high_expr);
|
||||
} else {
|
||||
|
|
|
|||
8
parse.y
8
parse.y
|
|
@ -323,10 +323,15 @@ static PECallFunction*make_call_function(perm_string tn, PExpr*arg1, PExpr*arg2)
|
|||
%left K_POW
|
||||
%left UNARY_PREC
|
||||
|
||||
|
||||
/* to resolve dangling else ambiguity. */
|
||||
%nonassoc less_than_K_else
|
||||
%nonassoc K_else
|
||||
|
||||
/* to resolve exclude (... ambiguity */
|
||||
%nonassoc '('
|
||||
%nonassoc K_exclude
|
||||
|
||||
%%
|
||||
|
||||
/* A degenerate source file can be completely empty. */
|
||||
|
|
@ -2432,7 +2437,8 @@ parameter_value_range
|
|||
{ $$ = pform_parameter_value_range($1, true, $3, false, $5); }
|
||||
| from_exclude '(' value_range_expression ':' value_range_expression ')'
|
||||
{ $$ = pform_parameter_value_range($1, true, $3, true, $5); }
|
||||
/* | K_exclude expression */
|
||||
| K_exclude expression
|
||||
{ $$ = pform_parameter_value_range(true, false, $2, false, $2); }
|
||||
;
|
||||
|
||||
value_range_expression
|
||||
|
|
|
|||
Loading…
Reference in New Issue