isl_input.c: read_term: allow terms starting with negative constant
authorSven Verdoolaege <skimo@kotnet.org>
Mon, 16 Aug 2010 12:36:58 +0000 (14:36 +0200)
committerSven Verdoolaege <skimo@kotnet.org>
Wed, 18 Aug 2010 13:14:21 +0000 (15:14 +0200)
In particular, we used to fail to parse "1-3x" because -3 is treated
as a negative constant.  Now, we treat is in the same way as "1+-3x".

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

index 075ad8d..10c4820 100644 (file)
@@ -1319,9 +1319,8 @@ static __isl_give isl_qpolynomial *read_term(struct isl_stream *s,
                            isl_int_is_neg(tok->u.v)) {
                        struct isl_qpolynomial *qp2;
 
-                       qp2 = isl_qpolynomial_cst(isl_basic_map_get_dim(bmap),
-                                                       tok->u.v);
-                       isl_token_free(tok);
+                       isl_stream_push_token(s, tok);
+                       qp2 = read_factor(s, bmap, v);
                        qp = isl_qpolynomial_add(qp, qp2);
                } else {
                        isl_stream_push_token(s, tok);