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

ruby-changes:47878

From: nobu <ko1@a...>
Date: Sun, 24 Sep 2017 03:28:11 +0900 (JST)
Subject: [ruby-changes:47878] nobu:r59999 (trunk): parse.y: token type by identifer ID type

nobu	2017-09-23 15:49:35 +0900 (Sat, 23 Sep 2017)

  New Revision: 59999

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

  Log:
    parse.y: token type by identifer ID type
    
    * parse.y (parse_ident): leave identifier type decision (local or
      const) to rb_enc_symname_type, and set the token type by ID
      type.

  Modified files:
    trunk/parse.y
Index: parse.y
===================================================================
--- parse.y	(revision 59998)
+++ parse.y	(revision 59999)
@@ -7842,7 +7842,7 @@ parse_ident(struct parser_params *parser https://github.com/ruby/ruby/blob/trunk/parse.y#L7842
 	tokadd(c);
     }
     else {
-	result = ISUPPER(tok()[0]) ? tCONSTANT : tIDENTIFIER;
+	result = tCONSTANT;	/* assume provisionally */
 	pushback(c);
     }
     tokfix();
@@ -7909,6 +7909,7 @@ parse_ident(struct parser_params *parser https://github.com/ruby/ruby/blob/trunk/parse.y#L7909
     }
 
     ident = tokenize_ident(parser, last_state);
+    if (result == tCONSTANT && is_local_id(ident)) result = tIDENTIFIER;
     if (!IS_lex_state_for(last_state, EXPR_DOT|EXPR_FNAME) &&
 	(result == tIDENTIFIER) && /* not EXPR_FNAME, not attrasgn */
 	lvar_defined(ident)) {

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

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