[mcs] Include more unicode categories in parsing identifier part character. Fixes...
authorMarek Safar <marek.safar@gmail.com>
Tue, 6 May 2014 17:58:34 +0000 (19:58 +0200)
committerMarek Safar <marek.safar@gmail.com>
Tue, 6 May 2014 17:59:36 +0000 (19:59 +0200)
mcs/mcs/cs-tokenizer.cs
mcs/tests/test-444.cs
mcs/tests/ver-il-net_4_5.xml

index 7fb9caa018a7a31ed8c7d2d5545a3952c13b940b..68ddff9873ce1a9c31e1993ab87e9899853c5948 100644 (file)
@@ -934,7 +934,27 @@ namespace Mono.CSharp
                        if (c < 0x80)
                                return false;
 
-                       return Char.IsLetter (c) || Char.GetUnicodeCategory (c) == UnicodeCategory.ConnectorPunctuation;
+                       return is_identifier_part_character_slow_part (c);
+               }
+
+               static bool is_identifier_part_character_slow_part (char c)
+               {
+                       if (Char.IsLetter (c))
+                               return true;
+
+                       switch (Char.GetUnicodeCategory (c)) {
+                               case UnicodeCategory.ConnectorPunctuation:
+
+                               // combining-character: A Unicode character of classes Mn or Mc
+                               case UnicodeCategory.NonSpacingMark:
+                               case UnicodeCategory.SpacingCombiningMark:
+
+                               // decimal-digit-character: A Unicode character of the class Nd 
+                               case UnicodeCategory.DecimalDigitNumber:
+                               return true;
+                       }
+
+                       return false;
                }
 
                public static bool IsKeyword (string s)
@@ -3039,7 +3059,7 @@ namespace Mono.CSharp
 
                                                        continue;
                                                }
-                                       } else if (Char.IsLetter ((char) c) || Char.GetUnicodeCategory ((char) c) == UnicodeCategory.ConnectorPunctuation) {
+                                       } else if (is_identifier_part_character_slow_part ((char) c)) {
                                                id_builder [pos++] = (char) c;
                                                continue;
                                        }
index d28e5854f872b8fddea551b3da0e43f75d7bd142..86a3cd57a5ae7b59d15b67eccc2c7dec49764c48 100644 (file)
@@ -7,5 +7,9 @@ public class 쯠쯡쯢
        public static void Main ()
        {
        }
+
+       static void P̀ः०‿ ()
+       {
+       }
 }
 
index f6e3552556708ca362240a9a9a360ae18a5c0cde..eadd41957a448c1b4dbb44c219dca938c9e530d8 100644 (file)
       <method name="Void .ctor()" attrs="6278">\r
         <size>7</size>\r
       </method>\r
+      <method name="Void P̀ः०‿()" attrs="145">\r
+        <size>2</size>\r
+      </method>\r
     </type>\r
   </test>\r
   <test name="test-445.cs">\r