From 4d08346a9694558ee9c98a9ea4f60700b3d35c25 Mon Sep 17 00:00:00 2001 From: Sven Verdoolaege Date: Sat, 5 Mar 2011 10:47:34 +0100 Subject: [PATCH] isl_stream: accept "/\" and "\/" as alternatives for "and" and "or" Signed-off-by: Sven Verdoolaege --- isl_stream.c | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/isl_stream.c b/isl_stream.c index 6a7a912a..139e4c0a 100644 --- a/isl_stream.c +++ b/isl_stream.c @@ -320,7 +320,6 @@ static struct isl_token *next_token(struct isl_stream *s, int same_line) if (c == '(' || c == ')' || c == '+' || - c == '/' || c == '*' || c == '%' || c == '^' || @@ -504,6 +503,32 @@ static struct isl_token *next_token(struct isl_stream *s, int same_line) tok->u.s = strdup("||"); return tok; } + if (c == '/') { + tok = isl_token_new(s->ctx, line, col, old_line != line); + if (!tok) + return NULL; + if ((c = isl_stream_getc(s)) != '\\' && c != -1) { + tok->type = (enum isl_token_type) '/'; + isl_stream_ungetc(s, c); + } else { + tok->u.s = strdup("/\\"); + tok->type = ISL_TOKEN_AND; + } + return tok; + } + if (c == '\\') { + tok = isl_token_new(s->ctx, line, col, old_line != line); + if (!tok) + return NULL; + if ((c = isl_stream_getc(s)) != '/' && c != -1) { + tok->type = (enum isl_token_type) '\\'; + isl_stream_ungetc(s, c); + } else { + tok->u.s = strdup("\\/"); + tok->type = ISL_TOKEN_OR; + } + return tok; + } if (c == '!') { tok = isl_token_new(s->ctx, line, col, old_line != line); if (!tok) -- 2.11.4.GIT