-
- while (1) {
- ch = input();
-
- if (!ch)
- break; /* end of input */
-
- /* if it is a \ then escape char's are allowed */
- if (ch == '\\') {
- *str++ = ch; /* backslash in place */
- *str++=input(); /* get the escape char, no check */
- continue; /* carry on */
- }
-
- /* if new line we have a new line break */
- if (ch == '\n') {
- yylineno++;
- continue;
- }
-
- /* if this is a quote then we have work to do */
- /* find the next non whitespace character */
- /* if that is a double quote then carry on */
- if (ch == '\"') {
- *str++ = ch ; /* Pass end of this string or substring to evaluator */
-
+
+ while ((ch = input()) != 0) {
+ switch (ch) {
+ case '\\':
+ /* if it is a \ then escape char's are allowed */
+ ch = input();
+ if (ch == '\n') {
+ /* \<newline> is a continuator */
+ lineno = ++yylineno;
+ column = 0;
+ }
+ else {
+ buf[0] = '\\';
+ buf[1] = ch;
+ dbuf_append(&dbuf, buf, 2); /* get the escape char, no further check */
+ }
+ break; /* carry on */
+
+ case '\n':
+ /* if new line we have a new line break, which is illegal */
+ werror(W_NEWLINE_IN_STRING);
+ dbuf_append(&dbuf, "\n", 1);
+ lineno = ++yylineno;
+ column = 0;
+ break;
+
+ case '"':
+ /* if this is a quote then we have work to do */
+ /* find the next non whitespace character */
+ /* if that is a double quote then carry on */
+ dbuf_append(&dbuf, "\"", 1); /* Pass end of this string or substring to evaluator */