diff options
Diffstat (limited to 'Parser/tokenizer.c')
-rw-r--r-- | Parser/tokenizer.c | 28 |
1 files changed, 27 insertions, 1 deletions
diff --git a/Parser/tokenizer.c b/Parser/tokenizer.c index 725a2f1..6504e0c 100644 --- a/Parser/tokenizer.c +++ b/Parser/tokenizer.c @@ -564,7 +564,7 @@ tok_get(tok, p_start, p_end) return NUMBER; } - /* String */ + /* String (single quotes) */ if (c == '\'') { for (;;) { c = tok_nextc(tok); @@ -590,6 +590,32 @@ tok_get(tok, p_start, p_end) return STRING; } + /* String (double quotes) */ + if (c == '\"') { + for (;;) { + c = tok_nextc(tok); + if (c == '\n' || c == EOF) { + tok->done = E_TOKEN; + tok->cur = tok->inp; + return ERRORTOKEN; + } + if (c == '\\') { + c = tok_nextc(tok); + *p_end = tok->cur; + if (c == '\n' || c == EOF) { + tok->done = E_TOKEN; + tok->cur = tok->inp; + return ERRORTOKEN; + } + continue; + } + if (c == '\"') + break; + } + *p_end = tok->cur; + return STRING; + } + /* Line continuation */ if (c == '\\') { c = tok_nextc(tok); |