From 49845b4279bb8c3560058f670c32d15dd6664a75 Mon Sep 17 00:00:00 2001 From: Sven Verdoolaege Date: Wed, 3 Mar 2010 14:13:58 +0100 Subject: [PATCH] isl_map_read: skip until the end of the last line when reading in PolyLib format --- isl_input.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/isl_input.c b/isl_input.c index 091c7cf..c6ca654 100644 --- a/isl_input.c +++ b/isl_input.c @@ -919,6 +919,13 @@ static __isl_give isl_basic_map *basic_map_read_polylib(struct isl_stream *s, for (i = 0; i < n_row; ++i) bmap = basic_map_read_polylib_constraint(s, bmap); + tok = isl_stream_next_token_on_same_line(s); + if (tok) { + isl_stream_error(s, tok, "unexpected extra token on line"); + isl_stream_push_token(s, tok); + goto error; + } + bmap = isl_basic_map_simplify(bmap); bmap = isl_basic_map_finalize(bmap); return bmap; @@ -939,18 +946,12 @@ static struct isl_map *map_read_polylib(struct isl_stream *s, int nparam) isl_stream_error(s, NULL, "unexpected EOF"); return NULL; } - tok2 = isl_stream_next_token(s); - if (!tok2) { - isl_token_free(tok); - isl_stream_error(s, NULL, "unexpected EOF"); - return NULL; - } - if (!tok2->on_new_line) { + tok2 = isl_stream_next_token_on_same_line(s); + if (tok2) { isl_stream_push_token(s, tok2); isl_stream_push_token(s, tok); return isl_map_from_basic_map(basic_map_read_polylib(s, nparam)); } - isl_stream_push_token(s, tok2); n = isl_int_get_si(tok->u.v); isl_token_free(tok); -- 2.7.4