fix horrible typo
[mcs.git] / docs / ecma334 / 9.4.2.xml
blob709f9a01f0ef8330613fc4db0bab2d7027e822c5
1 <?xml version="1.0"?>
2 <clause number="9.4.2" title="Identifiers">
3   <paragraph>The rules for identifiers given in this section correspond exactly to those recommended by the Unicode Standard Annex 15 except that underscore is allowed as an initial character (as is traditional in the C programming language), Unicode escape sequences are permitted in identifiers, and the &quot;@&quot; character is allowed as a prefix to enable keywords to be used as identifiers. <grammar_production><name>identifier</name> :: <rhs><non_terminal where="9.4.2">available-identifier</non_terminal></rhs><rhs><terminal>@</terminal><non_terminal where="9.4.2">identifier-or-keyword</non_terminal></rhs></grammar_production><grammar_production><name><non_terminal where="9.4.2">available-identifier</non_terminal></name> :: <rhs>An <non_terminal where="9.4.2">identifier-or-keyword</non_terminal> that is not a <non_terminal where="9.4.3">keyword</non_terminal> </rhs></grammar_production><grammar_production><name><non_terminal where="9.4.2">identifier-or-keyword</non_terminal></name> :: <rhs><non_terminal where="9.4.2">identifier-start-character</non_terminal><non_terminal where="9.4.2">identifier-part-characters</non_terminal><opt/></rhs></grammar_production><grammar_production><name><non_terminal where="9.4.2">identifier-start-character</non_terminal></name> :: <rhs><non_terminal where="9.4.2">letter-character</non_terminal></rhs><rhs>_ (the underscore character U+005F) </rhs></grammar_production><grammar_production><name><non_terminal where="9.4.2">identifier-part-character</non_terminal>s</name> :: <rhs><non_terminal where="9.4.2">identifier-part-character</non_terminal></rhs><rhs><non_terminal where="9.4.2">identifier-part-characters</non_terminal><non_terminal where="9.4.2">identifier-part-character</non_terminal></rhs></grammar_production><grammar_production><name><non_terminal where="9.4.2">identifier-part-character</non_terminal></name> :: <rhs><non_terminal where="9.4.2">letter-character</non_terminal></rhs><rhs><non_terminal where="9.4.2">decimal-digit-character</non_terminal></rhs><rhs><non_terminal where="9.4.2">connecting-character</non_terminal></rhs><rhs><non_terminal where="9.4.2">combining-character</non_terminal></rhs><rhs><non_terminal where="9.4.2">formatting-character</non_terminal></rhs></grammar_production><grammar_production><name><non_terminal where="9.4.2">letter-character</non_terminal></name> :: <rhs>A Unicode character of classes Lu, Ll, Lt, Lm, Lo, or Nl </rhs><rhs>A <non_terminal where="9.4.1">unicode-escape-sequence</non_terminal> representing a character of classes Lu, Ll, Lt, Lm, Lo, or Nl </rhs></grammar_production><grammar_production><name><non_terminal where="9.4.2">combining-character</non_terminal></name> :: <rhs>A Unicode character of classes Mn or Mc </rhs><rhs>A <non_terminal where="9.4.1">unicode-escape-sequence</non_terminal> representing a character of classes Mn or Mc </rhs></grammar_production><grammar_production><name><non_terminal where="9.4.2">decimal-digit-character</non_terminal></name> :: <rhs>A Unicode character of the class Nd </rhs><rhs>A <non_terminal where="9.4.1">unicode-escape-sequence</non_terminal> representing a character of the class Nd </rhs></grammar_production><grammar_production><name><non_terminal where="9.4.2">connecting-character</non_terminal></name> :: <rhs>A Unicode character of the class Pc </rhs><rhs>A <non_terminal where="9.4.1">unicode-escape-sequence</non_terminal> representing a character of the class Pc </rhs></grammar_production><grammar_production><name><non_terminal where="9.4.2">formatting-character</non_terminal></name> :: <rhs>A Unicode character of the class Cf </rhs><rhs>A <non_terminal where="9.4.1">unicode-escape-sequence</non_terminal> representing a character of the class Cf </rhs></grammar_production></paragraph>
4   <paragraph>
5     <note>[Note: For information on the Unicode character classes mentioned above, see The Unicode Standard, Verson 3.0, 4-5. end note]</note>
6   </paragraph>
7   <paragraph>
8     <example>[Example: Examples of valid identifiers include &quot;identifier1&quot;, &quot;_identifier2&quot;, and &quot;@if&quot;. end example]</example>
9   </paragraph>
10   <paragraph>An identifier in a conforming program must be in the canonical format defined by Unicode Normalization Form C, as defined by Unicode Standard Annex 15. The behavior when encountering an identifier not in Normalization Form C is implementation-defined; however, a diagnostic is not required. </paragraph>
11   <paragraph>The prefix &quot;@&quot; enables the use of keywords as identifiers, which is useful when interfacing with other programming languages. The character @ is not actually part of the identifier, so the identifier might be seen in other languages as a normal identifier, without the prefix. An identifier with an @ prefix is called a verbatim identifier. <note>[Note: Use of the @ prefix for identifiers that are not keywords is permitted, but strongly discouraged as a matter of style. end note]</note> </paragraph>
12   <paragraph>
13     <example>[Example: The example: <code_example><![CDATA[
14 class @class  
15 {  
16    public static void @static(bool @bool) {  
17       if (@bool)  
18       System.Console.WriteLine("true");  
19       else  
20       System.Console.WriteLine("false");  
21    }    
22 }  
23 class Class1  
24 {  
25    static void M() {  
26       cl\u0061ss.st\u0061tic(true);  
27    }  
28 }  
29 ]]></code_example>defines a class named &quot;class&quot; with a static method named &quot;static&quot; that takes a parameter named &quot;bool&quot;. Note that since Unicode escapes are not permitted in keywords, the token &quot;cl\u0061ss&quot; is an identifier, and is the same identifier as &quot;@class&quot;. end example]</example>
30   </paragraph>
31   <paragraph>Two identifiers are considered the same if they are identical after the following transformations are applied, in order: <list><list_item> The prefix &quot;@&quot;, if used, is removed. </list_item><list_item> Each <non_terminal where="9.4.1">unicode-escape-sequence</non_terminal> is transformed into its corresponding Unicode character. </list_item><list_item> Any <non_terminal where="9.4.2">formatting-character</non_terminal>s are removed. </list_item></list></paragraph>
32   <paragraph>Identifiers containing two consecutive underscore characters (U+005F) are reserved for use by the implementation; however, no diagnostic is required if such an identifier is defined. <note>[Note: For example, an implementation might provide extended keywords that begin with two underscores. end note]</note> </paragraph>
33 </clause>