isl_stream: accept "==" token
authorSven Verdoolaege <skimo@kotnet.org>
Sun, 18 Sep 2011 12:41:05 +0000 (14:41 +0200)
committerSven Verdoolaege <skimo@kotnet.org>
Sun, 18 Sep 2011 15:55:47 +0000 (17:55 +0200)
Signed-off-by: Sven Verdoolaege <skimo@kotnet.org>
include/isl/stream.h
isl_stream.c

index c421030..7c19299 100644 (file)
@@ -23,7 +23,7 @@ enum isl_token_type { ISL_TOKEN_ERROR = -1,
                        ISL_TOKEN_UNKNOWN = 256, ISL_TOKEN_VALUE,
                        ISL_TOKEN_IDENT, ISL_TOKEN_GE,
                        ISL_TOKEN_LE, ISL_TOKEN_GT, ISL_TOKEN_LT,
-                       ISL_TOKEN_NE,
+                       ISL_TOKEN_NE, ISL_TOKEN_EQ_EQ,
                        ISL_TOKEN_LEX_GE, ISL_TOKEN_LEX_LE,
                        ISL_TOKEN_LEX_GT, ISL_TOKEN_LEX_LT,
                        ISL_TOKEN_TO, ISL_TOKEN_AND,
index 3643893..db59468 100644 (file)
@@ -354,7 +354,6 @@ static struct isl_token *next_token(struct isl_stream *s, int same_line)
            c == '%' ||
            c == '?' ||
            c == '^' ||
-           c == '=' ||
            c == '@' ||
            c == '$' ||
            c == ',' ||
@@ -456,6 +455,21 @@ static struct isl_token *next_token(struct isl_stream *s, int same_line)
                tok->u.s = strdup(s->buffer);
                return tok;
        }
+       if (c == '=') {
+               int c;
+               tok = isl_token_new(s->ctx, line, col, old_line != line);
+               if (!tok)
+                       return NULL;
+               if ((c = isl_stream_getc(s)) == '=') {
+                       tok->u.s = strdup("==");
+                       tok->type = ISL_TOKEN_EQ_EQ;
+                       return tok;
+               }
+               if (c != -1)
+                       isl_stream_ungetc(s, c);
+               tok->type = (enum isl_token_type) '=';
+               return tok;
+       }
        if (c == ':') {
                int c;
                tok = isl_token_new(s->ctx, line, col, old_line != line);