add isl_stream_flush_tokens
authorSven Verdoolaege <skimo@kotnet.org>
Sat, 19 Jun 2010 14:39:20 +0000 (16:39 +0200)
committerSven Verdoolaege <skimo@kotnet.org>
Sat, 19 Jun 2010 17:35:27 +0000 (19:35 +0200)
include/isl_stream.h
isl_stream.c

index 134ee3b..c63b67e 100644 (file)
@@ -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);
index c38363d..1267d24 100644 (file)
@@ -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)