isl_stream_read_obj: read int objects
authorSven Verdoolaege <skimo@kotnet.org>
Thu, 9 Dec 2010 18:56:31 +0000 (19:56 +0100)
committerSven Verdoolaege <skimo@kotnet.org>
Sun, 23 Jan 2011 14:12:58 +0000 (15:12 +0100)
Signed-off-by: Sven Verdoolaege <skimo@kotnet.org>
isl_input.c

index dca1442..d6c3f8e 100644 (file)
@@ -1749,7 +1749,20 @@ static struct isl_obj obj_read(struct isl_stream *s, int nparam)
                goto error;
        }
        if (tok->type == ISL_TOKEN_VALUE) {
+               struct isl_token *tok2;
                struct isl_map *map;
+
+               tok2 = isl_stream_next_token(s);
+               if (!tok2 || tok2->type != ISL_TOKEN_VALUE ||
+                   isl_int_is_neg(tok2->u.v)) {
+                       if (tok2)
+                               isl_stream_push_token(s, tok2);
+                       obj.type = isl_obj_int;
+                       obj.v = isl_int_obj_alloc(s->ctx, tok->u.v);
+                       isl_token_free(tok);
+                       return obj;
+               }
+               isl_stream_push_token(s, tok2);
                isl_stream_push_token(s, tok);
                map = map_read_polylib(s, nparam);
                if (!map)