summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorragge <ragge>2009-08-07 18:57:17 +0000
committerragge <ragge>2009-08-07 18:57:17 +0000
commit8b9975002d30dc1189655375b4dd14c63fe9e529 (patch)
treec991fb320689eb4187c04649f4362ea7f87a8dcf
parent3767af5a859910f75db5820f6480b65245391aad (diff)
Fix bug where string with escaped char would not terminate. Fixes bug
reported by Alt.
-rw-r--r--token.c22
1 files changed, 11 insertions, 11 deletions
diff --git a/token.c b/token.c
index 69e380c..a8fe20a 100644
--- a/token.c
+++ b/token.c
@@ -217,16 +217,16 @@ run: ch = NXTCH();
goto xloop;
case '\"': /* strings */
-str: do {
+str: PUTCH(ch);
+ while ((ch = NXTCH()) != '\"') {
PUTCH(ch);
- ch = NXTCH();
if (ch == '\\') {
- PUTCH(ch);
ch = NXTCH();
+ PUTCH(ch);
}
if (ch < 0)
return;
- } while (ch != '\"');
+ }
PUTCH(ch);
break;
@@ -251,20 +251,20 @@ str: do {
goto xloop;
case '\'': /* character literal */
-con: do {
+con: PUTCH(ch);
+ while ((ch = NXTCH()) != '\'') {
PUTCH(ch);
- ch = NXTCH();
if (ch == '\\') {
- PUTCH(ch);
ch = NXTCH();
- }
- if (ch < 0)
+ PUTCH(ch);
+ } else if (ch < 0)
return;
- if (ch == '\n')
+ else if (ch == '\n')
goto xloop;
- } while (ch != '\'');
+ }
PUTCH(ch);
break;
+
case 'L':
ch = NXTCH();
if (ch == '\"') {