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

ruby-changes:2344

From: ko1@a...
Date: 8 Nov 2007 07:31:32 +0900
Subject: [ruby-changes:2344] davidflanagan - Ruby:r13835 (trunk): * parse.y (rb_intern3): commented out broken code that prevented

davidflanagan	2007-11-08 07:17:58 +0900 (Thu, 08 Nov 2007)

  New Revision: 13835

  Modified files:
    trunk/ChangeLog
    trunk/parse.y

  Log:
    * parse.y (rb_intern3): commented out broken code that prevented
      correct interning of multi-byte symbols.  Without this patch
      :x==:x is false when x is a multi-byte character. 
    


  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/parse.y?r1=13835&r2=13834
  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/ChangeLog?r1=13835&r2=13834

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 13834)
+++ ChangeLog	(revision 13835)
@@ -1,3 +1,8 @@
+Thu Nov  8 07:14:37 UTC 2007 David Flanagan <davidflanagan@r...>
+        * parse.y (rb_intern3): commented out broken code that prevented
+	  correct interning of multi-byte symbols.  Without this patch
+	  :x==:x is false when x is a multi-byte character. 
+	
 Thu Nov  8 07:04:31 UTC 2007 David Flanagan <davidflanagan@r...>
 	* string.c (tr_setup_table, tr_trans): fix test failures
 	  in test/ruby/test_string.rb
Index: parse.y
===================================================================
--- parse.y	(revision 13834)
+++ parse.y	(revision 13835)
@@ -8661,6 +8661,21 @@
 	}
     }
     if (m - name < len) id = ID_JUNK;
+    /*
+     * davidflanagan: commented out because this just doesn't make sense.
+     *
+     * If we were called with a non-ascii encoding, then change
+     * the encoding to ASCII, unless the symbol had multi-byte characters
+     * and there are trailing non-identifier characters that are 
+     * outside of ASCII. But all multi-byte characters
+     * are identifier chars, so there will never be trailing characters
+     * so this clause always changes the encoding of the string.
+     *
+     * The upshot is that the symbol is placed in the hashtable with
+     * an ASCII encoding, but is queried (at the top of this function)
+     * with its real encoding.  So :x == :x is false when x is a
+     * multi-byte character. 
+     *
     if (enc != rb_enc_from_index(0)) {
 	if (!mb) {
 	    for (; m <= name + len; ++m) {
@@ -8670,6 +8685,7 @@
 	enc = rb_enc_from_index(0);
       mbstr:;
     }
+    */
   new_id:
     id |= ++global_symbols.last_id << ID_SCOPE_SHIFT;
   id_register:

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

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