isl_stream_read_map: handle nested parenthesized expressions
authorSven Verdoolaege <skimo@kotnet.org>
Sat, 8 Oct 2011 14:23:59 +0000 (16:23 +0200)
committerSven Verdoolaege <skimo@kotnet.org>
Sat, 8 Oct 2011 21:58:52 +0000 (23:58 +0200)
Signed-off-by: Sven Verdoolaege <skimo@kotnet.org>
isl_input.c
isl_test.c

index 548ff41..56bec5a 100644 (file)
@@ -1058,9 +1058,14 @@ static int resolve_paren_expr(struct isl_stream *s,
        if (!tok || tok->type != '(')
                goto error;
 
+       if (isl_stream_next_token_is(s, '('))
+               if (resolve_paren_expr(s, v, isl_map_copy(map)))
+                       goto error;
+
        if (isl_stream_next_token_is(s, ISL_TOKEN_EXISTS) ||
            isl_stream_next_token_is(s, ISL_TOKEN_TRUE) ||
-           isl_stream_next_token_is(s, ISL_TOKEN_FALSE)) {
+           isl_stream_next_token_is(s, ISL_TOKEN_FALSE) ||
+           isl_stream_next_token_is(s, ISL_TOKEN_MAP)) {
                map = read_disjuncts(s, v, map);
                if (isl_stream_eat(s, ')'))
                        goto error;
index fdea5ee..59a81fe 100644 (file)
@@ -153,6 +153,10 @@ void test_parse(struct isl_ctx *ctx)
        str2 = "{ [x] : x-0 >= 0 }";
        test_parse_map_equal(ctx, str, str2);
 
+       str = "{ [i] : ((i > 10)) }";
+       str2 = "{ [i] : i >= 11 }";
+       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_pwaff(ctx, "{ [i] -> [i + 1] : i > 0; [a] -> [a] : a < 0 }");