[Mono-bugs] [Bug 78259][Wis] New - mcs doesn't honor c#'s definition of allowed identifier chars

bugzilla-daemon at bugzilla.ximian.com bugzilla-daemon at bugzilla.ximian.com
Mon May 1 14:11:24 EDT 2006

Please do not reply to this email- if you want to comment on the bug, go to the
URL shown below and enter your comments there.

Changed by dwashington at gmx.net.


--- shadow/78259	2006-05-01 14:11:24.000000000 -0400
+++ shadow/78259.tmp.3181	2006-05-01 14:11:24.000000000 -0400
@@ -0,0 +1,71 @@
+Bug#: 78259
+Product: Mono: Compilers
+Version: 1.1
+OS Details: 
+Status: NEW   
+Priority: Wishlist
+Component: C#
+AssignedTo: rharinath at novell.com                            
+ReportedBy: dwashington at gmx.net               
+QAContact: mono-bugs at ximian.com
+TargetMilestone: ---
+Summary: mcs doesn't honor c#'s definition of allowed identifier chars
+Description of Problem:
+The C# Specification, 2nd Edition's definition of indentifiers and the
+implementation in Mono's C# compiler don't match. The spec allows "A
+Unicode character of the class Pc" as part of an identifier. But mcs only
+allows the fullwidth low line ("_"). The compiler also doesn't seem to
+handle other allowed characters in identifiers, like characters of the
+classes Mn, Mc and Cf.
+Steps to reproduce the problem:
+1. Enter following code into an editor:
+using System;
+namespace Bla.Blub
+	class Foo
+	{
+		public static void Main(string[] args)
+		{
+			Console.WriteLine("bla");
+		}
+	}
+2. Put the undertie character (U+203F) somewhere in one of the identifiers
+"Foo", "Bla", or "Blub"
+3. Compile the program
+Actual Results:
+A parsing error (CS8025).
+Expected Results:
+Compilation without problems.
+How often does this happen? 
+Additional Information:
+The method for checking for a valid identifier char s defined as follows
+(in cs-tokenizer.cs):
+static bool is_identifier_part_character (char c)
+    return (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') || c == '_' ||
+(c >= '0' && c <= '9') || Char.IsLetter (c);
+This doesn't allow many of the characters that the c# specification allows.
+It is clearly visible that the undertie for instance is not accepted,
+though allowed by the standard.

More information about the mono-bugs mailing list