isl_stream_read_pw_qpolynomial: accept products of integer divisions
authorSven Verdoolaege <skimo@kotnet.org>
Wed, 1 Feb 2012 11:34:30 +0000 (12:34 +0100)
committerSven Verdoolaege <skimo@kotnet.org>
Wed, 1 Feb 2012 21:47:41 +0000 (22:47 +0100)
Before, we called accept_affine to parse an integer division that appears
inside a function, but accept_affine also parses a subsequent '*' and
then expects this '*' to be followed by a constant.
Call accept_div directly intead.

Signed-off-by: Sven Verdoolaege <skimo@kotnet.org>
isl_input.c
isl_test.c

index 320703a..8c9ab36 100644 (file)
@@ -1557,7 +1557,7 @@ static __isl_give isl_pw_qpolynomial *read_factor(struct isl_stream *s,
                int pow;
 
                isl_stream_push_token(s, tok);
-               pwaff = accept_affine(s, isl_map_get_space(map), v);
+               pwaff = accept_div(s, isl_map_get_space(map), v);
                pow = optional_power(s);
                pwqp = isl_pw_qpolynomial_from_pw_aff(pwaff);
                pwqp = isl_pw_qpolynomial_pow(pwqp, pow);
index 9bd7e25..c090604 100644 (file)
@@ -166,6 +166,7 @@ void test_parse(struct isl_ctx *ctx)
        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 }");
+       test_parse_pwqp(ctx, "{ [x] -> ([(x)/2] * [(x)/3]) }");
 }
 
 void test_read(struct isl_ctx *ctx)