* 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 11:14:51 -0000
@@ -109,8 +109,4 @@ static int in_def = 0;
 static int compile_for_eval = 0;
 static ID cur_mid = 0;
-static int quoted_term;
-#define quoted_term_char ((unsigned char)quoted_term)
-#define WHEN_QUOTED_TERM(x) ((quoted_term >= 0) && (x))
-#define QUOTED_TERM_P(c) WHEN_QUOTED_TERM((c) == quoted_term_char)
 
 static NODE *cond();
@@ -175,5 +171,4 @@ static void top_local_setup();
 #define NODE_STRTERM NODE_ZARRAY	/* nothing to gc */
 #define NODE_HEREDOC NODE_ARRAY 	/* 1, 3 to gc */
-#define ESCAPED_TERM (1 << CHAR_BIT)
 #define SIGN_EXTEND(x,n) (((1<<(n))-1-((x)&~(~0<<(n))))^~(~0<<(n)))
 #define nd_func u1.id
@@ -264,5 +259,5 @@ static void top_local_setup();
 %type <id>   fitem variable sym symbol operation operation2 operation3
 %type <id>   cname fname op f_rest_arg
-%type <num>  f_norm_arg f_arg term_push
+%type <num>  f_norm_arg f_arg
 %token tUPLUS 		/* unary+ */
 %token tUMINUS 		/* unary- */
@@ -2051,5 +2046,5 @@ string_content	: tSTRING_CONTENT
 		        $$ = NEW_EVSTR($3);
 		    }
-		| tSTRING_DBEG term_push
+		| tSTRING_DBEG
 		    {
 			$<node>$ = lex_strterm;
@@ -2059,9 +2054,8 @@ string_content	: tSTRING_CONTENT
 		  compstmt '}'
 		    {
-			quoted_term = $2;
-			lex_strterm = $<node>3;
-			if (($$ = $4) && nd_type($$) == NODE_NEWLINE) {
+			lex_strterm = $<node>2;
+			if (($$ = $3) && nd_type($$) == NODE_NEWLINE) {
 			    $$ = $$->nd_next;
-			    rb_gc_force_recycle((VALUE)$4);
+			    rb_gc_force_recycle((VALUE)$3);
 			}
 			$$ = new_evstr($$);
@@ -2075,14 +2069,4 @@ string_dvar	: tGVAR {$$ = NEW_GVAR($1);}
 		;
 
-term_push	: /* none */
-		    {
-			if (($$ = quoted_term) == -1 &&
-			    nd_type(lex_strterm) == NODE_STRTERM &&
-			    !nd_paren(lex_strterm)) {
-			    quoted_term = nd_term(lex_strterm);
-			}
-		    }
-		;
-
 symbol		: tSYMBEG sym
 		    {
@@ -2451,5 +2435,5 @@ static char *lex_pend;
 static int
 yyerror(msg)
-    char *msg;
+    const char *msg;
 {
     char *p, *pe, *buf;
@@ -2536,5 +2520,4 @@ yycompile(f, line)
     heredoc_end = 0;
     lex_strterm = 0;
-    quoted_term = -1;
     ruby_current_node = 0;
     ruby_sourcefile = rb_source_filename(f);
@@ -2994,8 +2977,4 @@ tokadd_string(func, term, paren, nest)
 	else if (c == '\\') {
 	    c = nextc();
-	    if (QUOTED_TERM_P(c)) {
-		pushback(c);
-		return c;
-	    }
 	    switch (c) {
 	      case '\n':
@@ -3069,7 +3048,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;
@@ -4096,11 +4073,4 @@ 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;
-	}
 	return '\\';
 
@@ -4112,12 +4082,4 @@ yylex()
 	    c = nextc();
 	  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;
-		}
-	    }
 	    if (!ISALNUM(c)) {
 		term = c;
@@ -4857,5 +4819,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;
