white-space-and-comments | → | (space | comment)+ |
space | → | 'any ASCII whitespace character' |
comment | → | line-comment | block-comment |
line-comment | → | // [^\n\r]* |
block-comment | → | /* (any-char−*/)* */ |
any-char | → | 'any character' |
For an explanation of the used syntax notation, see Appendix A.
keyword | → | abstract | as | base | bool | break | byte | case | cast | catch | char | class | const | continue | default | delegate | do | double | else | enum | false | finally | float | for | foreach | goto | if | in | inline | int | interface | internal | is | lock | long | namespace | new | null | object | operator | override | private | protected | public | ref | return | sbyte | short | static | string | switch | this | throw | true | try | ulong | uint | ushort | using | virtual | void | while |
identifier | → | id-char-sequence−keyword |
qualified-id | → | identifier (.identifier)* |
id-char-sequence | → | (letter | _ ) (letter | digit | _ )* |
letter | → | 'any Unicode letter character (category Lu, Ll, LC, Lm, Lo and Lt) encoded using UTF-8 encoding' |
digit | → | 'any Unicode number character (category Nd, Nl and No) encoded using UTF-8 encoding' |
literal | → |
boolean-literal |
floating-literal |
integer-literal |
char-literal |
string-literal | null-literal |
boolean-literal | → | true | false |
floating-literal | → | floating-literal-value [fF]? |
floating-literal-value | → | fractional-floating-literal | exponent-floating-literal |
fractional-floating-literal | → |
decimal-digit-sequence?
.
decimal-digit-sequence
exponent-part? | decimal-digit-sequence . |
exponent-floating-literal | → | decimal-digit-sequence exponent-part |
exponent-part | → | [eE] sign? decimal-digit-sequence |
integer-literal | → | integer-literal-value [uU]? |
integer-literal-value | → | hexadecimal-integer-literal | decimal-integer-literal |
hexadecimal-integer-literal | → | ("0x" | "0X") hexadecimal-digit-sequence |
decimal-integer-literal | → | decimal-digit-sequence |
char-literal | → | ' ([^\n\r]+ | char-escape) ' |
string-literal | → |
@" [^"]*
" | " ([^"\\\r\n]+ | char-escape)* " |
null-literal | → | null |
char-escape | → |
\\ ( [xX] hexadecimal-digit-sequence | [dD] decimal-digit-sequence | octal-digit-sequence | u four-hex-digits | U eight-hex-digits | a | b | f | n | r | t | v | any-char ) |
decimal-digit-sequence | → | [0−9]+ |
hexadecimal-digit-sequence | → | hex-digit+ |
four-hex-digits | → | hex-digit hex-digit hex-digit hex-digit |
eight-hex-digits | → | hex-digit hex-digit hex-digit hex-digit hex-digit hex-digit hex-digit hex-digit |
hex-digit | → | [0−9 a−f A−F] |
octal-digit-sequence | → | [0−7]+ |
sign | → | + | - |