summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
56b7d23)
Usually, a '-' followed by a sequence of digits is treated as a single
(negative) number. When parsing affine expressions, negative numbers
are allowed without a preceding '+'. However, if "-0" is parsed as '0'
then there is no way of distinguishing between "-0" and "0" and so "-0"
was not allowed in affine expressions.
We now treat "-0" as two tokens, so that it can be used in affine expressions.
The flip side is that "-0" can no longer be used where a single integer
is expected.
Signed-off-by: Sven Verdoolaege <skimo@kotnet.org>
}
}
if (c == '-' || isdigit(c)) {
}
}
if (c == '-' || isdigit(c)) {
tok = isl_token_new(s->ctx, line, col, old_line != line);
if (!tok)
return NULL;
tok = isl_token_new(s->ctx, line, col, old_line != line);
if (!tok)
return NULL;
isl_stream_ungetc(s, c);
isl_stream_push_char(s, '\0');
isl_int_read(tok->u.v, s->buffer);
isl_stream_ungetc(s, c);
isl_stream_push_char(s, '\0');
isl_int_read(tok->u.v, s->buffer);
+ if (minus && isl_int_is_zero(tok->u.v)) {
+ tok->col++;
+ tok->on_new_line = 0;
+ isl_stream_push_token(s, tok);
+ tok = isl_token_new(s->ctx, line, col, old_line != line);
+ if (!tok)
+ return NULL;
+ tok->type = (enum isl_token_type) '-';
+ }
return tok;
}
if (isalpha(c) || c == '_') {
return tok;
}
if (isalpha(c) || c == '_') {
str2 = "[N, M] -> { [i] : N = 2 and 4i <= 2 + M and 4i >= -1 + M }";
test_parse_map_equal(ctx, str, str2);
str2 = "[N, M] -> { [i] : N = 2 and 4i <= 2 + M and 4i >= -1 + M }";
test_parse_map_equal(ctx, str, str2);
+ str = "{ [x] : x >= 0 }";
+ str2 = "{ [x] : x-0 >= 0 }";
+ test_parse_map_equal(ctx, str, str2);
+
test_parse_pwqp(ctx, "{ [i] -> i + [ (i + [i/3])/2 ] }");
test_parse_map(ctx, "{ S1[i] -> [([i/10]),i%10] : 0 <= i <= 45 }");
}
test_parse_pwqp(ctx, "{ [i] -> i + [ (i + [i/3])/2 ] }");
test_parse_map(ctx, "{ S1[i] -> [([i/10]),i%10] : 0 <= i <= 45 }");
}