From 1e998960028b11076264dce51437bc99d5694f16 Mon Sep 17 00:00:00 2001 From: Sven Verdoolaege Date: Sat, 8 Oct 2011 16:23:59 +0200 Subject: [PATCH] isl_stream_read_map: handle nested parenthesized expressions Signed-off-by: Sven Verdoolaege --- isl_input.c | 7 ++++++- isl_test.c | 4 ++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/isl_input.c b/isl_input.c index 548ff41..56bec5a 100644 --- a/isl_input.c +++ b/isl_input.c @@ -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; diff --git a/isl_test.c b/isl_test.c index fdea5ee..59a81fe 100644 --- a/isl_test.c +++ b/isl_test.c @@ -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 }"); -- 2.7.4