* parse.y (tokadd_string, parse_string, yylex): escaped terminator
  is now interpreted as is.  [ruby-talk:82206]


Index: parse.y
===================================================================
RCS file: /cvs/ruby/src/ruby/parse.y,v
retrieving revision 1.289
diff -u -2 -p -r1.289 parse.y
--- parse.y	6 Sep 2003 16:18:02 -0000	1.289
+++ parse.y	17 Sep 2003 10:59:18 -0000
@@ -2451,5 +2451,5 @@ static char *lex_pend;
 static int
 yyerror(msg)
-    char *msg;
+    const char *msg;
 {
     char *p, *pe, *buf;
@@ -2968,4 +2968,13 @@ dispose_string(str)
 }
 
+static void
+warn_escaped_term()
+{
+    if (quoted_term & ESCAPED_TERM) return;
+    rb_warn("escaped terminator '%s%c' is now interpreted as is",
+	    (quoted_term_char == '\'' ? "\\" : ""), quoted_term_char);
+    quoted_term |= ESCAPED_TERM;
+}
+
 static int
 tokadd_string(func, term, paren, nest)
@@ -2995,6 +3004,5 @@ tokadd_string(func, term, paren, nest)
 	    c = nextc();
 	    if (QUOTED_TERM_P(c)) {
-		pushback(c);
-		return c;
+		warn_escaped_term();
 	    }
 	    switch (c) {
@@ -3069,7 +3077,5 @@ parse_string(quote)
 	space = 1;
     }
-    if ((c == term && !quote->nd_nest) ||
-	(c == '\\' && WHEN_QUOTED_TERM(peek(quoted_term_char)) &&
-	 (c = nextc()) == term)) {
+    if (c == term && !quote->nd_nest) {
 	if (func & STR_FUNC_QWORDS) {
 	    quote->nd_func = -1;
@@ -4097,9 +4103,5 @@ yylex()
 	pushback(c);
 	if (QUOTED_TERM_P(c)) {
-	    if (!(quoted_term & ESCAPED_TERM)) {
-		rb_warn("escaped terminator '%c' inside string interpolation", c);
-		quoted_term |= ESCAPED_TERM;
-	    }
-	    goto retry;
+	    warn_escaped_term();
 	}
 	return '\\';
@@ -4113,10 +4115,5 @@ yylex()
 	  quotation:
 	    if (c == '\\' && WHEN_QUOTED_TERM(peek(quoted_term_char))) {
-		c = nextc();
-		if (!(quoted_term & ESCAPED_TERM)) {
-		    rb_warn("escaped terminator '%s%c' inside string interpolation",
-			    (c == '\'' ? "\\" : ""), c);
-		    quoted_term |= ESCAPED_TERM;
-		}
+		warn_escaped_term();
 	    }
 	    if (!ISALNUM(c)) {
@@ -4857,5 +4854,5 @@ assignable(id, val)
     }
     else {
-      rb_compile_error("identifier %s is not valid", rb_id2name(id));
+	rb_compile_error("identifier %s is not valid", rb_id2name(id));
     }
     return 0;
