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

ruby-changes:43947

From: nobu <ko1@a...>
Date: Sat, 27 Aug 2016 08:26:09 +0900 (JST)
Subject: [ruby-changes:43947] nobu:r56020 (trunk): parse.y: heredoc token

nobu	2016-08-27 08:26:03 +0900 (Sat, 27 Aug 2016)

  New Revision: 56020

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

  Log:
    parse.y: heredoc token
    
    * parse.y (parser_heredoc_identifier): gather branches by quote
      char.

  Modified files:
    trunk/parse.y
Index: parse.y
===================================================================
--- parse.y	(revision 56019)
+++ parse.y	(revision 56020)
@@ -6401,6 +6401,7 @@ static int https://github.com/ruby/ruby/blob/trunk/parse.y#L6401
 parser_heredoc_identifier(struct parser_params *parser)
 {
     int c = nextc(), term, func = 0;
+    int token = tSTRING_BEG;
     long len;
 
     if (c == '-') {
@@ -6419,7 +6420,9 @@ parser_heredoc_identifier(struct parser_ https://github.com/ruby/ruby/blob/trunk/parse.y#L6420
       case '"':
 	func |= str_dquote; goto quoted;
       case '`':
-	func |= str_xquote;
+	token = tXSTRING_BEG;
+	func |= str_xquote; goto quoted;
+
       quoted:
 	newtok();
 	tokadd(func);
@@ -6442,7 +6445,6 @@ parser_heredoc_identifier(struct parser_ https://github.com/ruby/ruby/blob/trunk/parse.y#L6445
 	    return 0;
 	}
 	newtok();
-	term = '"';
 	tokadd(func |= str_dquote);
 	do {
 	    if (tokadd_mbchar(c) == -1) return 0;
@@ -6461,7 +6463,7 @@ parser_heredoc_identifier(struct parser_ https://github.com/ruby/ruby/blob/trunk/parse.y#L6463
 				  lex_lastline);		/* nd_orig */
     nd_set_line(lex_strterm, ruby_sourceline);
     ripper_flush(parser);
-    return term == '`' ? tXSTRING_BEG : tSTRING_BEG;
+    return token;
 }
 
 static void

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

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