isl_map_read_from_str: parse tuple entries with leading minus sign
authorSven Verdoolaege <skimo@kotnet.org>
Tue, 24 Aug 2010 08:02:34 +0000 (10:02 +0200)
committerSven Verdoolaege <skimo@kotnet.org>
Tue, 24 Aug 2010 08:02:34 +0000 (10:02 +0200)
Signed-off-by: Sven Verdoolaege <skimo@kotnet.org>
isl_input.c
isl_test.c

index a6c5572..4ac4416 100644 (file)
@@ -364,7 +364,8 @@ static __isl_give isl_dim *read_var_list(struct isl_stream *s,
                        dim = set_name(dim, type, i, v->v->name);
                        isl_token_free(tok);
                } else if (tok->type == ISL_TOKEN_IDENT ||
-                          tok->type == ISL_TOKEN_VALUE) {
+                          tok->type == ISL_TOKEN_VALUE ||
+                          tok->type == '-') {
                        if (type == isl_dim_param) {
                                isl_stream_error(s, tok,
                                                "expecting unique identifier");
index 14f633d..24aca70 100644 (file)
 
 static char *srcdir;
 
+void test_parse(struct isl_ctx *ctx)
+{
+       isl_map *map;
+       const char *str;
+
+       str = "{ [i] -> [-i] }";
+       map = isl_map_read_from_str(ctx, str, -1);
+       assert(map);
+       isl_map_free(map);
+}
+
 void test_read(struct isl_ctx *ctx)
 {
        char filename[PATH_MAX];
@@ -1392,6 +1403,7 @@ int main()
        assert(srcdir);
 
        ctx = isl_ctx_alloc();
+       test_parse(ctx);
        test_pwqp(ctx);
        test_lex(ctx);
        test_sv(ctx);