isl_stream_next_token: skip comment lines
authorSven Verdoolaege <skimo@kotnet.org>
Sun, 24 Jan 2010 13:36:02 +0000 (14:36 +0100)
committerSven Verdoolaege <skimo@kotnet.org>
Sun, 24 Jan 2010 17:13:11 +0000 (18:13 +0100)
isl_stream.c

index be5eee2..d22d3fa 100644 (file)
@@ -157,10 +157,17 @@ struct isl_token *isl_stream_next_token(struct isl_stream *s)
 
        s->len = 0;
 
-       /* skip spaces */
-       while ((c = isl_stream_getc(s)) != -1 && isspace(c))
-               /* nothing */
-               ;
+       /* skip spaces and comment lines */
+       while ((c = isl_stream_getc(s)) != -1) {
+               if (c == '#') {
+                       while ((c = isl_stream_getc(s)) != -1 && c != '\n')
+                               /* nothing */
+                               ;
+                       if (c == -1)
+                               break;
+               } else if (!isspace(c))
+                       break;
+       }
 
        line = s->line;
        col = s->col;