diff options
author | ragge <ragge> | 2009-08-07 18:57:17 +0000 |
---|---|---|
committer | ragge <ragge> | 2009-08-07 18:57:17 +0000 |
commit | 8b9975002d30dc1189655375b4dd14c63fe9e529 (patch) | |
tree | c991fb320689eb4187c04649f4362ea7f87a8dcf | |
parent | 3767af5a859910f75db5820f6480b65245391aad (diff) |
Fix bug where string with escaped char would not terminate. Fixes bug
reported by Alt.
-rw-r--r-- | token.c | 22 |
1 files changed, 11 insertions, 11 deletions
@@ -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 == '\"') { |