From a9599d5eff53bffac5dcfc92bbf68d564a64b175 Mon Sep 17 00:00:00 2001 From: Ali Gholami Rudi Date: Fri, 4 Jun 2010 17:10:27 +0430 Subject: [PATCH] tok: s = "a" "b"; --- tok.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/tok.c b/tok.c index f8ee6dd..5af9b4c 100644 --- a/tok.c +++ b/tok.c @@ -126,9 +126,9 @@ int tok_str(char *buf) return str_len; } -static void readstr(void) +static int readstr(char *out) { - char *s = str; + char *s = out; char *r = buf + cur; char *e = buf + len; r++; @@ -143,7 +143,7 @@ static void readstr(void) } *s++ = '\0'; cur = r - buf + 1; - str_len = s - str; + return s - out - 1; } static int id_char(int c) @@ -182,7 +182,13 @@ int tok_get(void) if (skipws()) return TOK_EOF; if (buf[cur] == '"') { - readstr(); + str_len = 0; + while (buf[cur] == '"') { + str_len += readstr(str + str_len); + if (skipws()) + return TOK_EOF; + } + str_len++; return TOK_STR; } if (isdigit(buf[cur]) || buf[cur] == '\'') { -- 2.11.4.GIT