From: Sven Verdoolaege Date: Sat, 5 Mar 2011 09:47:34 +0000 (+0100) Subject: isl_stream: accept "/\" and "\/" as alternatives for "and" and "or" X-Git-Tag: isl-0.06~25 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=4d08346a9694558ee9c98a9ea4f60700b3d35c25;p=platform%2Fupstream%2Fisl.git isl_stream: accept "/\" and "\/" as alternatives for "and" and "or" Signed-off-by: Sven Verdoolaege --- diff --git a/isl_stream.c b/isl_stream.c index 6a7a912..139e4c0 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)