isl_stream: support \<newline> line continuation
authorSven Verdoolaege <skimo@kotnet.org>
Thu, 17 Feb 2011 10:46:33 +0000 (11:46 +0100)
committerSven Verdoolaege <skimo@kotnet.org>
Thu, 17 Feb 2011 18:50:23 +0000 (19:50 +0100)
Signed-off-by: Sven Verdoolaege <skimo@kotnet.org>
isl_stream.c

index de8855a..09ef60d 100644 (file)
@@ -159,7 +159,7 @@ struct isl_stream* isl_stream_new_str(struct isl_ctx *ctx, const char *str)
        return s;
 }
 
-static int isl_stream_getc(struct isl_stream *s)
+static int stream_getc(struct isl_stream *s)
 {
        int c;
        if (s->eof)
@@ -184,6 +184,20 @@ static int isl_stream_getc(struct isl_stream *s)
        return c;
 }
 
+static int isl_stream_getc(struct isl_stream *s)
+{
+       int c;
+
+       do {
+               c = stream_getc(s);
+               if (c != '\\')
+                       break;
+               c = stream_getc(s);
+       } while (c == '\n');
+
+       return c;
+}
+
 static void isl_stream_ungetc(struct isl_stream *s, int c)
 {
        if (s->file)