[前][次][番号順一覧][スレッド一覧]

ruby-changes:54695

From: nobu <ko1@a...>
Date: Wed, 23 Jan 2019 18:39:50 +0900 (JST)
Subject: [ruby-changes:54695] nobu:r66911 (trunk): parse.y: token name of tSTRING_DEND

nobu	2019-01-23 18:39:45 +0900 (Wed, 23 Jan 2019)

  New Revision: 66911

  https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=66911

  Log:
    parse.y: token name of tSTRING_DEND
    
    * parse.y (rb_yytnamerr): show single-quoted single char as-is, to
      show a quoted closing brace as tSTRING_DEND.  e.g.:
    
          $ ./ruby -e '"#{true'
          -e:1: syntax error, unexpected end-of-input, expecting '}'

  Modified files:
    trunk/parse.y
Index: parse.y
===================================================================
--- parse.y	(revision 66910)
+++ parse.y	(revision 66911)
@@ -924,7 +924,8 @@ static void token_info_warn(struct parse https://github.com/ruby/ruby/blob/trunk/parse.y#L924
 %token tSYMBOLS_BEG	"symbol list"
 %token tQSYMBOLS_BEG	"verbatim symbol list"
 %token tSTRING_END	"terminator"
-%token tSTRING_DBEG tSTRING_DEND tSTRING_DVAR tLAMBEG tLABEL_END
+%token tSTRING_DEND	"'}'"
+%token tSTRING_DBEG tSTRING_DVAR tLAMBEG tLABEL_END
 
 /*
  *	precedence table
@@ -11220,6 +11221,12 @@ rb_yytnamerr(char *yyres, const char *yy https://github.com/ruby/ruby/blob/trunk/parse.y#L11221
 		    bquote = 0;
 		    break;
 		}
+		if (yyp[1] && yyp[1] != '\'' && yyp[2] == '\'') {
+		    if (yyres) memcpy(yyres + yyn, yyp, 3);
+		    yyn += 3;
+		    yyp += 2;
+		    break;
+		}
 		goto do_not_strip_quotes;
 
 	      case ',':

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]