From 2e15763c4e5f1d99b62521d1aa0d3298e8f659b4 Mon Sep 17 00:00:00 2001 From: Sven Verdoolaege Date: Sat, 19 Jun 2010 16:39:20 +0200 Subject: [PATCH] add isl_stream_flush_tokens --- include/isl_stream.h | 1 + isl_stream.c | 11 +++++++++++ 2 files changed, 12 insertions(+) diff --git a/include/isl_stream.h b/include/isl_stream.h index 134ee3b..c63b67e 100644 --- a/include/isl_stream.h +++ b/include/isl_stream.h @@ -75,6 +75,7 @@ struct isl_token *isl_stream_next_token(struct isl_stream *s); struct isl_token *isl_stream_next_token_on_same_line(struct isl_stream *s); int isl_stream_next_token_is(struct isl_stream *s, int type); void isl_stream_push_token(struct isl_stream *s, struct isl_token *tok); +void isl_stream_flush_tokens(struct isl_stream *s); int isl_stream_eat_if_available(struct isl_stream *s, int type); char *isl_stream_read_ident_if_available(struct isl_stream *s); int isl_stream_eat(struct isl_stream *s, int type); diff --git a/isl_stream.c b/isl_stream.c index c38363d..1267d24 100644 --- a/isl_stream.c +++ b/isl_stream.c @@ -546,6 +546,17 @@ static int free_keyword(void *p) return 0; } +void isl_stream_flush_tokens(struct isl_stream *s) +{ + int i; + + if (!s) + return; + for (i = 0; i < s->n_token; ++i) + isl_token_free(s->tokens[i]); + s->n_token = 0; +} + void isl_stream_free(struct isl_stream *s) { if (!s) -- 2.7.4