Click here to Skip to main content
15,884,472 members
Articles / Containers / Virtual Machine

Parsing Expression Grammar Support for C# 3.0 Part 1 - PEG Lib and Parser Generator

Rate me:
Please Sign up or sign in to vote.
4.95/5 (49 votes)
7 Oct 2008CPOL40 min read 202.7K   2.1K   118  
Introduction to the parsing method PEG with library and parser generator
<<Grammar Name="CSharp3" 
	  encoding_class="utf8" 
	  host_language="C#3.0"
	  reference= "C# Language Specification Version 3.0"
	  comment= "CSharp3 parser which skips preprocessing directives"
>>
Top
{
	#region data members
        internal string unicode_;
	#endregion data members
        bool GetUnicodeCategory(out System.Globalization.UnicodeCategory cat)
        {
            uint val;
            cat= System.Globalization.UnicodeCategory.Control;
            System.Diagnostics.Debug.Assert(unicode_.Length>=5 );
            val = UInt32.Parse(unicode_.Substring(2), System.Globalization.NumberStyles.HexNumber);
            char uniCode= (char)val;
            cat = System.Globalization.CharUnicodeInfo.GetUnicodeCategory(uniCode);
            return true;
        }
	internal bool UnicodeEscapeIsLetter_()
    {
        System.Globalization.UnicodeCategory cat;
        if (GetUnicodeCategory(out cat))
        {
            return cat == System.Globalization.UnicodeCategory.UppercaseLetter
                || cat == System.Globalization.UnicodeCategory.LowercaseLetter
                || cat == System.Globalization.UnicodeCategory.TitlecaseLetter
                || cat == System.Globalization.UnicodeCategory.ModifierLetter
                || cat == System.Globalization.UnicodeCategory.OtherLetter
                || cat == System.Globalization.UnicodeCategory.LetterNumber;
        }
        return false;
    }
	internal bool UnicodeEscapeIsNd_()
    {
        System.Globalization.UnicodeCategory cat;
        return GetUnicodeCategory(out cat) && cat == System.Globalization.UnicodeCategory.DecimalDigitNumber;
    }
    internal bool UnicodeEscapeIsMnOrMc_()
    {
        System.Globalization.UnicodeCategory cat;
        return GetUnicodeCategory(out cat) 
            && (   cat == System.Globalization.UnicodeCategory.NonSpacingMark
                || cat == System.Globalization.UnicodeCategory.SpacingCombiningMark);
    }
	internal bool UnicodeEscapeIsPc_()
    {
        System.Globalization.UnicodeCategory cat;
        return GetUnicodeCategory(out cat) 
            && cat == System.Globalization.UnicodeCategory.ConnectorPunctuation;
    }
	internal bool UnicodeEscapeIsCf_()
    {
        System.Globalization.UnicodeCategory cat;
        return GetUnicodeCategory(out cat)
            && cat == System.Globalization.UnicodeCategory.Format;
    }
}

//A.1.1 Line terminators
//----------------------
new_line: '\r\n' /  [\r\n#x0085#x0085#x2028#x2029];
//	Carriage return character (U+000D) /
//	Line feed character (U+000A) /
//	Carriage return character (U+000D) followed by line feed character (U+000A) /
//	Next line character (U+0085) /
//	Line separator character (U+2028) /
//	Paragraph separator character (U+2029) /
//A.1.2 Comments
//----------------------
comment: 		single_line_comment / delimited_comment;
single_line_comment: 	'//'   input_characters?;
input_characters: 	input_character+;
input_character:  	[^#x000D#x000A#x0085#x2028#x2029]; //Any Unicode character except a new_line_character
new_line_character: 	[#x000D#x000A#x0085#x2028#x2029];
//Carriage return character (U+000D)
//Line feed character (U+000A)
//Next line character (U+0085)
//Line separator character (U+2028)
//Paragraph separator character (U+2029)
delimited_comment:	'/*'  (!'*/' . )*   '*/';
//A.1.3 White space
//----------------------
whitespace:  		Zs/#x0009/#x000B/#x000C;   
//Horizontal tab character (U+0009)
//Vertical tab character (U+000B)
//Form feed character (U+000C)

//A.1.5 Unicode character escape sequences
//----------------------
unicode_escape_sequence:'\u'   hex_digit{4} / '\U'   hex_digit{8};
//A.1.6 Identifiers
//----------------------
identifier: 			 '@'   identifier_or_keyword / available_identifier;
available_identifier:  		!(keyword B) identifier_or_keyword; //An identifier_or_keyword that is not a keyword
identifier_or_keyword: 		identifier_start_character   identifier_part_characters?;
identifier_start_character: 	letter_character / '_' ;
identifier_part_characters: 	identifier_part_character+;
identifier_part_character: 	letter_character / decimal_digit_character / 
				connecting_character /combining_character / formatting_character;
letter_character: 		Lu / Ll / Lt / Lm / Lo / Nl /
 				unicode_escape_sequence:unicode_  UnicodeEscapeIsLetter_;
//A Unicode character of classes Lu, Ll, Lt, Lm, Lo, or Nl or unicode escape representing one of Lu,...
combining_character:   		Mn / Mc / unicode_escape_sequence:unicode_ UnicodeEscapeIsMnOrMc_; 
//A Unicode character of classes Mn or Mc /A unicode_escape_sequence representing a character of classes Mn or Mc
decimal_digit_character: 	Nd /  unicode_escape_sequence:unicode_ UnicodeEscapeIsNd_; 
//A unicode-escape-sequence representing a character of the class Nd

connecting_character:   	Pc / unicode_escape_sequence:unicode_ UnicodeEscapeIsPc_;
//A Unicode character of the class Pc
//A unicode-escape-sequence representing a character of the class Pc

formatting_character:  		Cf / unicode_escape_sequence:unicode_ UnicodeEscapeIsCf_;
//A Unicode character of the class Cf
//A unicode-escape-sequence representing a character of the class Cf
//A.1.7 Keywords
//----------------------
keyword:  
'abstract'	/'as'		/'base'		/'bool'		/'break'	/
'byte'		/'case'		/'catch'	/'char'		/'checked'	/
'class'		/'const'	/'continue'	/'decimal'	/'default'	/
'delegate'	/'do'		/'double'	/'else'		/'enum'		/
'event'		/'explicit'	/'extern'	/'false'	/'finally'	/
'fixed'		/'float'	/'for'		/'foreach'	/'goto'		/
'if'		/'implicit'	/'in'		/'int'		/'interface'	/
'internal'	/'is'		/'lock'		/'long'		/'namespace'	/
'new'		/'null'		/'object'	/'operator'	/'out'		/
'override'	/'params'	/'private'	/'protected'	/'public'	/
'readonly'	/'ref'		/'return'	/'sbyte'	/'sealed'	/
'short'		/'sizeof'	/'stackalloc'	/'static'	/'string'	/
'struct'	/'switch'	/'this'		/'throw'	/'true'		/
'try'		/'typeof'	/'uint'		/'ulong'	/'unchecked'	/
'unsafe'	/'ushort'	/'using'	/'virtual'	/'void'		/
'volatile'	/'while';
//A.1.8 Literals
//----------------------
literal: 		(boolean_literal /real_literal / integer_literal / character_literal / string_literal / null_literal) S;
^boolean_literal:  	'true' B / 'false' B;
integer_literal: 	 hexadecimal_integer_literal / decimal_integer_literal ;
^decimal_integer_literal:decimal_digits   integer_type_suffix?;
decimal_digits: 	decimal_digit+;
decimal_digit: 		[0-9];
integer_type_suffix:  	[uU][lL] / [lL][uU];
^hexadecimal_integer_literal: 
			'0'[xX] hex_digits   integer_type_suffix?;
hex_digits: 		hex_digit+;
hex_digit: 		[0-9A-Fa-f];
^real_literal: 		decimal_digits  ( exponent_part   real_type_suffix? / real_type_suffix / fraction) / fraction;
fraction:		'.'   decimal_digits   exponent_part?   real_type_suffix?;
exponent_part: 		[eE]   sign?   decimal_digits;
sign:  			[+-];
real_type_suffix: 	[FfDdMm];
^character_literal: 	['] character  ['];
character: 		single_character / simple_escape_sequence / hexadecimal_escape_sequence / unicode_escape_sequence;
single_character:  	[^'\\#x000D#x000A#x0085#x2028#x2029]; // Any character except ' (U+0027), \ (U+005C), and new-line-character
simple_escape_sequence: '\\' ['"\\0abfnrtv];
hexadecimal_escape_sequence: '\\x'   hex_digit   hex_digit?   hex_digit?   hex_digit?;
^string_literal: regular_string_literal / verbatim_string_literal;
regular_string_literal: '"'   regular_string_literal_characters?   '"';
regular_string_literal_characters: regular_string_literal_character+;
regular_string_literal_character: 	
					single_regular_string_literal_character
				/	simple_escape_sequence
				/	hexadecimal_escape_sequence
				/	unicode_escape_sequence;
single_regular_string_literal_character: [^"\\#x000D#x000A#x0085#x2028#x2029]; //Any character except " (U+0022), " (U+005C), and new-line-character
verbatim_string_literal: '@"'   verbatim_string_literal_characters?  '"';
verbatim_string_literal_characters: verbatim_string_literal_character+;
verbatim_string_literal_character: single_verbatim_string_literal_character/quote_escape_sequence;
single_verbatim_string_literal_character: [^"];		//any character except "
quote_escape_sequence: '""';
null_literal:'null' B;
//A.1.9 Operators and punctuators
//----------------------
operator_or_punctuator: 
'{' /	'}' /	'[' /	']' /	'(' /	')' /	'.' /	',' /	':' /	';'  /
'+' /	'-' /	'*' /	' /' /	'%' /	'&' /	'|' /	'^' /	'!' /	'~'  /
'=' /	'<' /	'>' /	'?' /	'??' /	'::' /	'++' /	'--' /	'&&' /	'||' /
'->' /	'==' /	'!=' /	'<=' /	'>=' /	'+=' /	'-=' /	'*=' /	' /=' /	'%=' /
'&=' /	'|=' /	'^=' /	'<<' / '>>' / '<<=' / '>>=' / '=>';
right_shift: '>|>';
right_shift_assignment: '>|>=';
//A.1.10 Pre
//-----------------------processing directives
pp_directive: pp_declaration / pp_conditional / pp_line / pp_diagnostic / pp_region  / pp_pragma;
conditional_symbol: !('true' /'false') keyword B / symbolName ; //Any identifier_or_keyword except true or false
^^symbolName:    identifier;
pp_expression: whitespace*   pp_or_expression   whitespace*;
pp_or_expression: pp_and_expression  (whitespace*  '||'   whitespace*   pp_and_expression)*;
pp_and_expression: pp_equality_expression whitespace*   ('&&'   whitespace*   pp_equality_expression)*;
pp_equality_expression: pp_unary_expression (whitespace*   ('==' /'!=')   whitespace*   pp_unary_expression)*;
pp_unary_expression: ('!'   whitespace*)?  pp_primary_expression;
pp_primary_expression:
'true' / 'false' / conditional_symbol / '('   whitespace*   pp_expression   whitespace*   ')';
^^pp_declaration: whitespace*  '#'   whitespace*   ('define'/'undef')   whitespace+   conditional_symbol   pp_new_line;
pp_new_line: whitespace*   single_line_comment?   new_line;
pp_conditional: 	pp_if_section  / pp_elif_section /    pp_else_section /  pp_endif;
^^pp_if_section: 		whitespace*   '#'   whitespace*   'if'   whitespace+   pp_expression   pp_new_line   ;
^^pp_elif_section: 	whitespace*   '#'   whitespace*   'elif'   whitespace+   pp_expression   pp_new_line ;
^^pp_else_section: 	whitespace*   '#'   whitespace*   'else'  pp_new_line;
^^pp_endif: 		whitespace*   '#'   whitespace*   'endif'   pp_new_line;
^^pp_diagnostic: whitespace*   '#'   whitespace*   ('error'/'warning')   pp_message;
pp_message: new_line / whitespace*   input_characters?   new_line;
pp_region: pp_start_region  /  pp_end_region;
^^pp_start_region: whitespace*   '#'   whitespace*   'region'   pp_message;
^^pp_end_region: whitespace*   '#'   whitespace*   'endregion'   pp_message;
^^pp_line: whitespace*   '#'   whitespace*   'line'   whitespace+   line_indicator   pp_new_line;
line_indicator: decimal_digits   (whitespace+   file_name )? / 'default' / 'hidden';
file_name: '"'   file_name_characters   '"';
file_name_characters: 	file_name_character+;
file_name_character: 	!'"' input_character ;//Any input_character except "
^^pp_pragma: 		whitespace*   '#'   whitespace*   'pragma'   whitespace+   pragma_body   pp_new_line;
pragma_body: 		pragma_warning_body;
pragma_warning_body: 	'warning'   whitespace+   warning_action  (whitespace+   warning_list)?;
^^warning_action: 	'disable' / 'restore';
^^warning_list: 		decimal_digits  (whitespace*   ','   whitespace+   @decimal_digits)*;
//A.2 Syntactic grammar
//---------------------
//A.2.1 Basic concepts
//----------------------
^namespace_name: 		namespace_or_type_name;
^^type_name: 			namespace_or_type_name;
^namespace_or_type_name: 	( qualified_alias_member / name S type_argument_list? )  
			 	('.' S   @name S  type_argument_list?)*;
^^name:				identifier;
//A.2.2 Types
//----------------------
^^type: 			void_pointer / non_array_type rank_specifiers? pointers?;
^^pointer_type:			void_pointer / non_array_type rank_specifiers? pointers;
^^pointers:			'*' S ('*' S)*;
^^void_pointer:			'void' S '*' S;
value_type: 			struct_type / enum_type;
struct_type: 			type_name / simple_type ;
simple_type: 			numeric_type / ^'bool' B S;
numeric_type: 			integral_type / floating_point_type / ^'decimal' B S;
integral_type:			^('sbyte' / 'byte' / 'short' / 'ushort' / 'int' / 'uint' / 'long' / 'ulong' / 'char') B S;
floating_point_type:		^('float'/'double') B S;
^is_nullable: 			'?' S;
non_nullable_type: 		void_pointer / non_array_non_nullable_type rank_specifiers? pointers?;
enum_type: 			type_name;
non_array_reference_type: 	^'object' B S / ^'string' B S / type_name;
class_type:			non_array_reference_type;
^interface_type: 		type_name;
^array_type: 			non_array_type   rank_specifiers;
non_array_non_nullable_type:	( value_type / non_array_reference_type / type_parameter );
non_array_type: 		non_array_non_nullable_type  is_nullable? ;
rank_specifiers: 		rank_specifier+;
^^rank_specifier: 		'[' S   dim_separators?   ']' S;
dim_separators: 		(',' S)+;
^^delegate_type: 		type_name;
^^type_argument_list:		'<'  S type_arguments   '>' S;
type_arguments: 		type_argument (',' S  type_argument)*;
^^type_argument: 		type;
^^type_parameter: 		identifier S;
//A.2.3 Variables
//----------------------
^variable_reference: 		expression;
//A.2.4 Expressions
//----------------------
^^argument_list: 		argument (',' S   argument)*;
^^argument: 			expression / ^'ref' B S  @variable_reference / ^'out' B S  @variable_reference;
postfix_expression: 		primary_expression postfix_operation*;
postfix_operation:              (invocation/member_access/pointer_member_access/element_access/post_incr/post_decr);
^^invocation:			'(' S  argument_list?  @')' S;
^^member_access:		'.' S  @name S  type_argument_list?;		
^^pointer_member_access:	'->' S @name S;
^^element_access:		'[' S  @index    S ']' S;
^^index:			expression_list;
^post_incr:                     '++' S;
^post_decr:                     '--' S;
primary_expression:		literal / simple_name / parenthesized_expression /this_access / base_access / creation_expression /
				typeof_expression /  checked_expression / unchecked_expression / default_value_expression /
				special_member_access / sizeof_expression;
^^sizeof_expression:		'sizeof' S  '(' S   type   ')' S;
^simple_name: 			name B S   type_argument_list?;
^parenthesized_expression: 	'(' S   expression   ')' S;
special_member_access: 		predefined_type S  '.' S  @name S  type_argument_list?
			/	qualified_alias_member   '.' S  @name S;
^predefined_type: 		(
				'bool'	  /  'byte'	  /  'char'	  /  'decimal'  /  'double'  /  'float'	  /  'int'    /  'long' /
				'object'  /  'sbyte'	  /  'short'	  /  'string'  /  'uint'     /  'ulong'	  /  'ushort' 
				) B ;
expression_list: 		expression (',' S   @expression)*;
^this_access: 			'this' B S;
^base_access: 			'base'  S ( '.'  S @name S / '[' S  @index   @']' S );
^^post_increment_expression: 	postfix_expression   '++' S;
^^post_decrement_expression: 	postfix_expression   '--' S;
^^object_creation_expression: 	'new'  S type  
				( '(' S   argument_list?   ')'  S   object_or_collection_initializer? / object_or_collection_initializer );
object_or_collection_initializer: 
				object_initializer / collection_initializer;
^^object_initializer:		'{'  S (member_initializer_list ','? S)?   '}' S;
member_initializer_list: 	member_initializer ( ',' S  @member_initializer )*;
^member_initializer: 		member_name  S '=' S   @initializer_value;
^^initializer_value: 		expression / object_or_collection_initializer;
^^collection_initializer: 	'{' S  element_initializer_list  ','?  S @'}' S;
^^element_initializer_list: 	element_initializer  (',' S   element_initializer)*;
^^element_initializer: 		'{' S  initial_value_list    @'}' S / non_assignment_expression ;
^^initial_value_list:	        expression_list;
^^array_creation_expression: 	'new' B S
				(	non_array_type   '[' S  array_size   @']' S   rank_specifiers?   array_initializer?
				/	array_type   array_initializer 
				/    	rank_specifier   array_initializer
				);
^^array_size:			expression_list;
^^delegate_creation_expression:	'new' S  delegate_type   '(' S  expression  @')' S;
^^anonymous_object_creation_expression: 
				'new' S   anonymous_object_initializer;
^^anonymous_object_initializer:  '{' S   (member_declarator_list ','? S)?   @'}' S;
^^member_declarator_list: 	member_declarator  (',' S  @member_declarator)*;
^^member_declarator: 		member_name  S  '=' S   @expression /  full_member_access /simple_name  ;
^^full_member_access:		primary_expression (!(member_access [,)}]) postfix_operation)* member_access;
^^typeof_expression: 		'typeof' B S   '(' S   (type !generic_dimension_specifier/unbound_type_name/'void' B S)   @')' S;
^^unbound_type_name: 		(name S ('::' S @name S)?  generic_dimension_specifier?)
			 	(  '.' S   @name S  generic_dimension_specifier?)*;
^^generic_dimension_specifier: 	'<' S   commas?   @'>' S;
^commas: 			(',' S)+;
^^checked_expression: 		'checked' S    @'(' S  @expression   @')' S;
^^unchecked_expression: 	'unchecked' S  @'(' S   @expression   @')' S;
^^default_value_expression: 	'default' S    '(' S  @type   @')' S;
^unary_expression: 		cast_expression /
				postfix_expression / 
				pre_increment_expression / 
				pre_decrement_expression / 
				^'+' S   unary_expression / 
				^'-' S   unary_expression / 
				^'!' S   unary_expression / 
				^'~' S   unary_expression / 
				^'*' S   unary_expression / 
				^'&' S   unary_expression / 
                                anonymous_method_expression;
^creation_expression:           array_creation_expression / 
				object_creation_expression / 
				delegate_creation_expression / 
				anonymous_object_creation_expression;
^^pre_increment_expression: 	'++' S   unary_expression;
^^pre_decrement_expression: 	'--' S   unary_expression;
^cast_expression: 	        ('(' S   type   ')' S &([~!(]/identifier/literal/!('as' B/'is' B) keyword B)
				/ !parenthesized_expression   '(' S type ')' )
				S   unary_expression;
^multiplicative_expression: 	unary_expression ( ^[*/%] S  unary_expression )*;
^additive_expression: 		multiplicative_expression ( ^[+-] S  multiplicative_expression )*;
^shift_expression: 		additive_expression ( ^('<<' / '>>') S  additive_expression )*;
^relational_expression: 	shift_expression (^('<='/'>='/'<'/'>') S shift_expression)* 
                                (('is' B/'as' B) S non_nullable_type)? ;
^equality_expression: 		relational_expression (^('=='/'!=') S relational_expression)*;
^and_expression: 		equality_expression ('&' S equality_expression)*;
^exclusive_or_expression: 	and_expression ('^' S and_expression)*;
^inclusive_or_expression: 	exclusive_or_expression ('|' S exclusive_or_expression)*;
^conditional_and_expression: 	inclusive_or_expression ('&&' S inclusive_or_expression)*;
^conditional_or_expression: 	conditional_and_expression ('||' S conditional_and_expression)*;
^null_coalescing_expression: 	conditional_or_expression ('??' S null_coalescing_expression)?;
^conditional_expression: 	null_coalescing_expression if_else_expression?;
^if_else_expression:            ('?' S   expression   ':' S   expression);
^lambda_expression: 		anonymous_function_signature   '=>' S   anonymous_function_body;
^anonymous_method_expression: 	'delegate' S   explicit_anonymous_function_signature?   block;
^anonymous_function_signature: 	explicit_anonymous_function_signature  / implicit_anonymous_function_signature;
^explicit_anonymous_function_signature:
				'(' S  explicit_anonymous_function_parameter_list?   ')' S;
^explicit_anonymous_function_parameter_list:
                                explicit_anonymous_function_parameter (',' S explicit_anonymous_function_parameter)*;

^explicit_anonymous_function_parameter: anonymous_function_parameter_modifier?   type   parameter_name S;
^anonymous_function_parameter_modifier: ^'ref' B S / ^'out' B S;
^implicit_anonymous_function_signature:
				'(' S  implicit_anonymous_function_parameter_list?   ')' S
			/	implicit_anonymous_function_parameter;
^^implicit_anonymous_function_parameter_list:
                                implicit_anonymous_function_parameter (',' S implicit_anonymous_function_parameter)*;

implicit_anonymous_function_parameter: 
                                parameter_name S;
^anonymous_function_body: 	expression / block;
^query_expression: 		from_clause   query_body;
^from_clause: 			'from' B S   (!(name S 'in' B) type)?   name S ![;=,]  'in' B S  @expression;
^query_body: 			query_body_clauses?   select_or_group_clause   query_continuation?;
^query_body_clauses: 		query_body_clause+;
^query_body_clause: 		from_clause / let_clause / where_clause / join_into_clause  /  orderby_clause;
^let_clause: 			'let' B S   @name S  '=' S   @expression;
^where_clause: 			'where' B S   @boolean_expression;
^join_into_clause: 			'join' B S   (!(name S 'in' B) @type)?   @name S  ^'in' B S   @expression  
				 ^'on' B S   @expression   ^'equals' B S   @expression  (^'into' B S   @name S)?;
^^orderby_clause: 		'orderby' B S   @orderings;
orderings: 			ordering  (',' S   @ordering)*;
^^ordering: 			expression    ordering_direction?;
^ordering_direction: 		('ascending' / 'descending' ) B S;
select_or_group_clause: 	select_clause / group_clause;
^^select_clause: 		'select' B S   @expression;
^^group_clause:  		'group' B S   @expression   'by' B S   @expression;
^query_continuation: 		'into' B S   @name S  @query_body;
^assignment: 			unary_expression   assignment_operator S   expression;
^assignment_operator: 		'=' !'>' / '+=' / '-=' / '*=' / '/=' / '%=' / '&=' / '|=' / '^=' / '<<=' / '>>=';
^expression: 			![,)};] (assignment / non_assignment_expression) ;
^non_assignment_expression: 	query_expression / lambda_expression / conditional_expression;
^^constant_expression: 		expression;
^^boolean_expression: 		expression;
//A.2.5 Statements
//----------------------
statement: 			labeled_statement / declaration_statement / embedded_statement;
embedded_statement: 		checked_statement / unchecked_statement / using_statement  / expression_statement / 
				block / empty_statement / selection_statement / iteration_statement / 
				jump_statement / try_statement  / lock_statement / 
				 yield_statement / unsafe_statement /fixed_statement ;
^^block: 			'{' S  statement_list?   @'}' S ;
statement_list: 		statement+;
^^empty_statement: 		';' S;
^^labeled_statement: 		label S  ':' !':' S @statement;
^^label:			identifier;
^declaration_statement: 	local_variable_declaration   ';' S  /  local_constant_declaration   ';' S;
^^local_variable_declaration: 	local_variable_type   local_variable_declarators;
^local_variable_type: 		^'var' B S / type;
local_variable_declarators: 	local_variable_declarator  (',' S   @local_variable_declarator)*;
^^local_variable_declarator: 	variable_name S ('=' S local_variable_initializer)?;
^^variable_name:		identifier;
^^local_variable_initializer: 	expression / array_initializer / stackalloc_initializer;
^^stackalloc_initializer:	'stackalloc' B S   type   '[' S   expression   ']' S;
^^local_constant_declaration: 	'const' B S   @type   constant_declarators;
constant_declarators: 		constant_declarator (',' S @constant_declarator)*;
^^constant_declarator: 		constant_name S  '=' S   @constant_expression;
^^constant_name:		identifier;
^expression_statement: 		statement_expression   ';' S;
unsafe_statement:		'unsafe' B S block;
fixed_statement:		'fixed' S  '(' S   pointer_type   fixed_pointer_declarators   ')' S   embedded_statement;
fixed_pointer_declarators:	fixed_pointer_declarator (',' S fixed_pointer_declarator)*;
fixed_pointer_declarator:	name S  '=' S   fixed_pointer_initializer;
fixed_pointer_initializer:	(^'&' S)?   expression;
statement_expression: 		pre_increment_expression   / 
                                pre_decrement_expression   /
                                assignment                 / 
                                call_or_post_incr_decr    /
				object_creation_expression;
^^call_or_post_incr_decr:       primary_expression 
                                ( 
                                   (member_access/element_access) &postfix_operation / invocation / post_incr / post_decr 
                                 )+;
selection_statement: 		if_statement / switch_statement;
^if_statement: 			'if'  B S   @'(' S   boolean_expression   ')' S   embedded_statement ( 'else' S   embedded_statement)?;
^switch_statement: 		'switch' B S   @'(' S   @expression   @')' S   switch_block;
^^switch_block: 		'{' S   switch_sections?   @'}' S;
switch_sections: 		switch_section+;
^switch_section: 		switch_labels   statement_list;
switch_labels: 			switch_label+;
^^switch_label: 		'case' B S   @constant_expression   @':' S / 'default' S   @':' S ;
iteration_statement : 		while_statement / do_statement / for_statement / foreach_statement;
^while_statement: 		'while' B S   @'(' S   boolean_expression   @')' S   @embedded_statement;
^do_statement: 			'do' B S   @embedded_statement   @'while' S   @'(' S  @boolean_expression   @')' S   ';' S ;
^^for_statement: 		'for'  B S   @'(' S  for_initializer?   @';' S   for_condition?   @';' S   for_iterator?   @')' S   @embedded_statement;
^^for_initializer: 		local_variable_declaration / statement_expression_list;
^^for_condition: 		boolean_expression;
^^for_iterator: 		statement_expression_list;
statement_expression_list: 	statement_expression (',' S   @statement_expression)*;
^foreach_statement: 		'foreach' B S   @'(' S   local_variable_type   @variable_name B S  @'in' B S   @expression   @')' S   @embedded_statement;
jump_statement: 		break_statement / continue_statement / goto_statement / return_statement / throw_statement;
^^break_statement: 		'break' S   ';' S;
^^continue_statement: 		'continue' S   ';' S;
^^goto_statement: 		'goto'  B S   @(label S    / 'case' B S   @constant_expression    / 'default' S )  @';' S;
^^return_statement: 		'return' B S   expression?   @';' S;
^^throw_statement: 		'throw' B S   expression?   @';' S;
^^try_statement: 		'try' B S   @block   (catch_clauses finally_clause? / finally_clause );
^^catch_clauses: 		specific_catch_clauses   general_catch_clause? / general_catch_clause;
specific_catch_clauses: 	specific_catch_clause+;
^^specific_catch_clause: 	'catch' B S   '('  S class_type   variable_name? S  @')' S   @block;
^^general_catch_clause: 	'catch' B S   block;
^^finally_clause: 		'finally' B S   @block;
^^checked_statement: 		'checked' B S   @block;
^^unchecked_statement: 		'unchecked' B S   @block;
^^lock_statement: 		'lock' B S   @'(' S  @expression   @')' S   @embedded_statement;
^^using_statement: 		'using' B S  @'(' S   resource_acquisition   @')' S    @embedded_statement;
^^resource_acquisition: 	local_variable_declaration / expression;
^^yield_statement: 		'yield' B S   ('break' S /'return' B S   @expression)   @';' S ;
//A.2.6 Namespaces
//----------------------
^^compilation_unit: 		S extern_alias_directives?   using_directives?  global_attributes? namespace_member_declarations?
				(!./FATAL<"following code not recognized as C# source">);
^^namespace_declaration: 	'namespace' B S   @qualified_identifier S  @namespace_body   ;
^^qualified_identifier: 	name S ('.' S name S)* ;
^^namespace_body:		'{' S  extern_alias_directives?   using_directives?   namespace_member_declarations?   @'}' S;
^^extern_alias_directives:	extern_alias_directive+;
^^extern_alias_directive: 	'extern' B S   'alias' B S   alias_name S  ';' S;
^^alias_name:			identifier;
^^using_directives: 		using_directive+;
using_directive: 		using_alias_directive / using_namespace_directive;
^^using_alias_directive: 	'using' B S   using_alias_name S  '=' S   @namespace_or_type_name   @';' S;
^^using_alias_name:		identifier;	
^^using_namespace_directive: 	'using' B S   namespace_name   ';' S;
^^namespace_member_declarations:  namespace_member_declaration+;
namespace_member_declaration: 	namespace_declaration / type_declaration;
type_declaration: 		class_declaration / struct_declaration / interface_declaration / enum_declaration / delegate_declaration;
^qualified_alias_member: 	name S  '::' S   @name S  type_argument_list?;
//A.2.7 Classes
//----------------------
^^class_declaration: 		attributes?   class_modifiers?   ('partial' B S)?   'class' B S   class_name S  type_parameter_list?
				class_base?   type_parameter_constraints_clauses?   @class_body   (';' S)?;
^^class_name:			identifier;
class_modifiers: 		class_modifier+;
^^class_modifier:		('new' / 'public' / 'protected' / 'internal' / 'private' / 'abstract' / 'sealed' / 'static' / 'unsafe') B S;
^^type_parameter_list: 		'<' S   type_parameters   '>' S;
^^type_parameters: 		(attributes?   type_parameter)(',' S   attributes?   type_parameter)*;
//type_parameter: 		identifier S;
^^class_base: 			':' S  (( class_type  (',' S   interface_type_list)?) / interface_type_list);
interface_type_list: 		interface_type (',' S interface_type)*;
type_parameter_constraints_clauses: 
                                type_parameter_constraints_clause+ ;
^^type_parameter_constraints_clause: 
                                'where' B S   type_parameter   @':' S   @type_parameter_constraints;
^^type_parameter_constraints: 	primary_constraint (',' S (secondary_constraints (',' S constructor_constraint)?/constructor_constraint))? 
			/	secondary_constraints 	(',' S constructor_constraint)? ;	
^^primary_constraint: 		class_type / 'class' B S / 'struct' B S;
^^secondary_constraints: 	(interface_type / type_parameter) (',' S   (interface_type/type_parameter))*;
^^constructor_constraint: 	'new' S   '('  S @')' S;
^^class_body:			'{' S   class_member_declarations?   @'}' S;
class_member_declarations: 	class_member_declaration+;
class_member_declaration: 	constant_declaration / method_declaration / field_declaration  / property_declaration / 
				event_declaration / indexer_declaration / operator_declaration / constructor_declaration / 
				destructor_declaration / static_constructor_declaration / type_declaration;
^^constant_declaration: 	        attributes?   constant_modifiers?   'const' B S   @type   constant_declarators   ';' S;
constant_modifiers: 		constant_modifier+;
^^constant_modifier: 		('new'  / 'public' / 'protected' / 'internal' / 'private') B S;
//constant_declarators: 		constant_declarator (',' S   constant_declarator)+;
//constant_declarator: 		identifier S  '=' S   constant_expression;
^^field_declaration: 		attributes?   field_modifiers?   type   variable_declarators   ';' S;
field_modifiers: 		field_modifier+;
^^field_modifier: 		('new' / 'public' / 'protected' / 'internal' / 'private' / 'static' / 'readonly' / 'volatile' / 'unsafe') B S;
variable_declarators: 		variable_declarator (',' S   variable_declarator)*;
^^variable_declarator: 		variable_name S ('=' S   variable_initializer)?;
^^variable_initializer: 		expression / array_initializer;
^method_declaration: 		method_header   method_body;
^method_header: 			attributes?   method_modifiers?   (^'partial' B S)?   return_type   member_name S  type_parameter_list?
				'(' S   formal_parameter_list?   ')' S   type_parameter_constraints_clauses?;
method_modifiers: 		method_modifier+;
^method_modifier: 		('new' / 'public' / 'protected' / 'internal' / 'private' / 'static' / 'virtual' / 
				 'sealed' / 'override' / 'abstract' / 'extern' / 'unsafe' ) B S;
^^return_type: 			type / 'void' B S;
^interface_name_before_member: (name S type_argument_list? / qualified_alias_member)  
			       ( ^'.' S   @name S !(type_parameter_list? [({]) type_argument_list?)*;
^^method_body: 			missing_body / block;
^^missing_body:			';' S;
formal_parameter_list: 		parameter_array / fixed_parameters (',' S parameter_array)?;
fixed_parameters: 		fixed_parameter (',' S   fixed_parameter)*;
^fixed_parameter: 		attributes?   parameter_modifier?   type   parameter_name S;
^parameter_modifier: 		^('ref' / 'out' / 'this' ) B S;
^parameter_array: 		attributes?   'params' B S   @array_type   @parameter_name S;
^property_declaration: 		attributes?   property_modifiers?   type   member_name S  '{' S  @accessor_declarations   @'}' S;
property_modifiers: 		property_modifier+;
^property_modifier: 		('new' / 
                                 'public' / 
                                 'protected' / 
                                 'internal' / 
                                 'private' / 
                                 'static' / 
                                 'virtual' / 
                                 'sealed' / 
                                 'override' / 
                                 'abstract' / 
                                 'extern' /
				 'unsafe') S;
^^member_name: 			interface_name_before_member '.' S  name S / name S ;
accessor_declarations: 		get_accessor_declaration   set_accessor_declaration? / set_accessor_declaration   get_accessor_declaration?;
^^get_accessor_declaration: 	attributes?   accessor_modifier?    'get' S   accessor_body;
^^set_accessor_declaration: 	attributes?   accessor_modifier?    'set' S   accessor_body;
^^accessor_modifier: 		('protected' / 'internal' / 'private' / 'protected' B S  'internal' / 'internal' B S   'protected' )B S ;
^^accessor_body: 		block / ';' S;
^event_declaration: 		attributes?   event_modifiers?   'event' B S   type   
				(	variable_declarators  ';' S
				/ 	member_name  S '{' S   event_accessor_declarations   @'}' S
				);
event_modifiers: 		event_modifier+;
^event_modifier: 		('new' / 'public' / 'protected' / 'internal' / 'private' / 'static' / 'virtual' / 
				'sealed' / 'override' / 'abstract' / 'extern' / 'unsafe')  B S;
^event_accessor_declarations: 	add_accessor_declaration   remove_accessor_declaration / remove_accessor_declaration   add_accessor_declaration;
^^add_accessor_declaration: 	attributes?   'add' S   block;
^^remove_accessor_declaration: 	attributes?   'remove' S   block;
^indexer_declaration: 		attributes?   indexer_modifiers?   indexer_declarator   '{' S   accessor_declarations   @'}' S ;
indexer_modifiers: 		indexer_modifier+;
^indexer_modifier: 		('new' / 'public' / 'protected' / 'internal' / 'private'  / 'virtual' / 'sealed' / 
				'override' / 'abstract' / 'extern' / 'unsafe') B S;
^indexer_declarator: 		type  (interface_type   '.' S)? 'this' S    '[' S  formal_parameter_list   @']' S;
^operator_declaration: 		attributes?   operator_modifiers   operator_declarator   operator_body;
operator_modifiers: 		operator_modifier+;
^operator_modifier: 		('public' / 'static' / 'extern' / 'unsafe')S;
operator_declarator: 		unary_operator_declarator / binary_operator_declarator / conversion_operator_declarator;
^unary_operator_declarator: 	type   'operator' S   overloadable_unary_operator   '(' S   type   parameter_name   ')' S;
^overloadable_unary_operator:  	( '++' /  '--' / '+' /   '-' /    '!'  /   '~' /  'true' /   'false') S;
^binary_operator_declarator: 	type   'operator' S   overloadable_binary_operator   '(' S  type   parameter_name   ',' S   type   parameter_name  S ')' S;
^overloadable_binary_operator: 	('+' / '-' / '*' / '/' / '%' / '&' / '|' / '^' / '<<' / '>>' / '==' / '!=' / '>=' / '<=' / '>' / '<'  ) S;
^conversion_operator_declarator: ('implicit' / 'explicit' ) B S   'operator' B S   type   '(' S   type   parameter_name S   ')' S ;
^^operator_body: 		block / ';' S;
^constructor_declaration: 	attributes?   constructor_modifiers?   constructor_declarator   constructor_body;
^constructor_modifiers: 	constructor_modifier+;
^constructor_modifier: 		('public' / 'protected' / 'internal' / 'private' / 'extern' / 'unsafe') B S;
^constructor_declarator: 	name  S '(' S  formal_parameter_list?   ')' S   constructor_initializer?;
^constructor_initializer:  	':' S   (^'base'/^'this') S   '(' S   argument_list?   ')' S ;
^constructor_body: 		block / ';' S;
^static_constructor_declaration: attributes?   static_constructor_modifiers  name S  '(' S  ')' S  static_constructor_body;
^static_constructor_modifiers: 	('extern' B S)? ('unsafe' B S)? 'static' B S / 
				 'static' B S ('unsafe' B S)? ('extern' B S)? /
				'static' B S ('extern' B S) ('unsafe' B S)?/
				('extern' B S)? 'static' B S ('unsafe' B S)?/ 
				('unsafe' B S)? 'static' B S ('extern' B S)? / 
				('unsafe' B S)? ('extern' B S)? 'static' B S  ;
^static_constructor_body: 	block / ';' S;
^destructor_declaration: 	attributes?   ('extern' B S 'unsafe' S / 'unsafe' B S 'extern' S)?   '~' S   name  S '(' S  ')' S    destructor_body;
^^destructor_body: 		block / ';' S;
//A.2.8 Structs
//----------------------
^struct_declaration: 		attributes?   struct_modifiers?   (^'partial' B S)?   'struct' B S   struct_name S   type_parameter_list?
					struct_interfaces?   type_parameter_constraints_clauses?   @struct_body   ';'?;
^^struct_name:			identifier;
struct_modifiers: 		struct_modifier+;
^struct_modifier: 		('new' / 'public' / 'protected' / 'internal' / 'private' / 'unsafe')B S;
^^struct_interfaces: 		':' S   interface_type_list;
^^struct_body:			'{' S   struct_member_declarations?   @'}' S;
struct_member_declarations: 	struct_member_declaration+;
^struct_member_declaration: 	constant_declaration / field_declaration / method_declaration / property_declaration / 		
				event_declaration / indexer_declaration / operator_declaration / 
				constructor_declaration / static_constructor_declaration / type_declaration /fixed_size_buffer_declaration;
^^fixed_size_buffer_declaration:  attributes?   fixed_size_buffer_modifiers?   'fixed'  B S buffer_element_type fixed_size_buffer_declarators   ;
fixed_size_buffer_modifiers:   fixed_size_buffer_modifier+;
^^fixed_size_buffer_modifier:    ('new' / 'public' / 'protected' / 'internal' / 'private' / 'unsafe') B S;
^^buffer_element_type:		type;
fixed_size_buffer_declarators: fixed_size_buffer_declarator+;
fixed_size_buffer_declarator:  name S  '[' S   constant_expression   ']' S;
//A.2.9 Arrays
//----------------------
//array_type: 			non_array_type   rank_specifiers;
//non_array_type: 		type;
//rank_specifiers: 		rank_specifier+;
//rank_specifier:		'[' S   dim_separators?   ']' S;
//dim_separators: 		',' S  (',' S)*;
^^array_initializer:		'{' S  variable_initializer_list? (',' S)?   @'}' S;
variable_initializer_list: 	variable_initializer (',' S variable_initializer)*;
//variable_initializer: 		expression / array_initializer;
//A.2.10 Interfaces
//----------------------
^interface_declaration: 		attributes?   interface_modifiers?   ('partial' B S)?   'interface' B S   @interface_name S   type_parameter_list?
					interface_base?   type_parameter_constraints_clauses?   interface_body   ';'? S;
interface_name:			identifier;
interface_modifiers: 		interface_modifier+;
^interface_modifier: 		('new' / 'public' / 'protected' / 'internal' / 'private' / 'unsafe') B S;
^^interface_base: 		':' S   interface_type_list;
^^interface_body:		'{' S   interface_member_declarations?   '}' S;
interface_member_declarations: 	interface_member_declaration+;
^interface_member_declaration: 	interface_method_declaration / interface_property_declaration / interface_event_declaration / interface_indexer_declaration;
^interface_method_declaration: 	attributes?   ('new' B S)?   return_type   name S  type_parameter_list?
				'('  S formal_parameter_list?   ')' S   type_parameter_constraints_clauses?  ';' S ;
^interface_property_declaration: attributes?   ('new' B S)?   type   name  S '{' S  interface_accessors   '}' S;
^interface_accessors: 		attributes? 
				(  ^'get' S ';' S (attributes? ^'set' S ';' S)? 
				/  ^'set' S ';' S (attributes? ^'get' S ';' S)?
				);
^interface_event_declaration: 	attributes?   ('new' B S)?   'event' B S    type   name  S   ;
^interface_indexer_declaration:  attributes?   ('new' B S)?   type   'this' B S   '[' S   formal_parameter_list   @']' S   '{' S   interface_accessors   @'}' S;
//A.2.11 Enums
//----------------------
^enum_declaration: 		attributes?   enum_modifiers?   'enum' B S   enum_name S   enum_base?   enum_body   (';' S)?;
^^enum_name:			identifier;
^^enum_base: 			':' S integral_type;
^^enum_body:			'{'  S (enum_member_declarations (',' S)?)?   @'}' S;
enum_modifiers: 		enum_modifier+;
^enum_modifier: 			('new' / 'public' / 'protected' / 'internal' / 'private') B S;
enum_member_declarations: 	enum_member_declaration (',' S   enum_member_declaration)*;
^enum_member_declaration: 	attributes?   enumerator_name S ('=' S   @constant_expression )? S;
^^enumerator_name:		identifier;
//A.2.12 Delegates
//----------------------
^delegate_declaration: 		attributes?   delegate_modifiers?   'delegate' B S   return_type   delegate_name  S type_parameter_list?   
				'(' S  formal_parameter_list?   ')' S   type_parameter_constraints_clauses?   ';' S;
^^delegate_name:		identifier;
delegate_modifiers: 		delegate_modifier+;
^delegate_modifier: 		('new' / 'public' / 'protected' / 'internal' / 'private' / 'unsafe') B S;
//A.2.13 Attributes
//----------------------
^^global_attributes: 		global_attribute_sections;
global_attribute_sections: 	global_attribute_section+;
^global_attribute_section:	'[' S   global_attribute_target_specifier   attribute_list  (',' S)?  ']' S;
^^global_attribute_target_specifier: global_attribute_target   ':' S;
^^global_attribute_target: 	('assembly' / 'module') B S;
^^attributes: 			attribute_sections;
attribute_sections: 		attribute_section+;
^^attribute_section:		'[' S   attribute_target_specifier?   attribute_list (',' S)?  ']' S;
^^attribute_target_specifier: 	attribute_target   ':' S;
^attribute_target: 		('field' / 'event' / 'method' / 'param' / 'property' / 'return' / 'type') S;
attribute_list: 		attribute (',' S   attribute)*;
^^attribute: 			attribute_name   attribute_arguments?;
^^attribute_name:  		type_name;
^^attribute_arguments:		'('  S
				(	named_argument_list 
				/	(positional_argument_list   (',' S   named_argument_list)?)?   
				)
				')' S;
positional_argument_list: 	positional_argument  (',' S   positional_argument)*;
^^positional_argument: 		attribute_argument_expression;
named_argument_list: 		named_argument (',' S   named_argument)*;
^^named_argument: 		parameter_name S  '=' S   attribute_argument_expression;
^^parameter_name:               identifier;
attribute_argument_expression: 	expression;

//identifier end boundary B and white space  S
B: ![a-zA-Z_0-9];
S: (comment/whitespace/new_line/pp_directive )*;


//Unicode categories
Zs: [#x0020#x00a0#x1680#x180e#x2000-#x200a#x202f#x205f#x3000];

Lu: [#x0041-#x005a#x00c0-#x00d6#x00d8-#x00de#x0100#x0102#x0104#x0106#x0108#x010a#x010c#x010e#x0110#x0112#x0114#x0116#x0118#x011a#x011c]
/   [#x011e#x0120#x0122#x0124#x0126#x0128#x012a#x012c#x012e#x0130#x0132#x0134#x0136#x0139#x013b#x013d#x013f#x0141#x0143#x0145#x0147]
/   [#x014a#x014c#x014e#x0150#x0152#x0154#x0156#x0158#x015a#x015c#x015e#x0160#x0162#x0164#x0166#x0168#x016a#x016c#x016e#x0170#x0172]
/   [#x0174#x0176#x0178-#x0179#x017b#x017d#x0181-#x0182#x0184#x0186-#x0187#x0189-#x018b#x018e-#x0191#x0193-#x0194#x0196-#x0198#x019c-#x019d]
/   [#x019f-#x01a0#x01a2#x01a4#x01a6-#x01a7#x01a9#x01ac#x01ae-#x01af#x01b1-#x01b3#x01b5#x01b7-#x01b8#x01bc#x01c4#x01c7#x01ca#x01cd#x01cf]
/   [#x01d1#x01d3#x01d5#x01d7#x01d9#x01db#x01de#x01e0#x01e2#x01e4#x01e6#x01e8#x01ea#x01ec#x01ee#x01f1#x01f4#x01f6-#x01f8#x01fa#x01fc#x01fe]
/   [#x0200#x0202#x0204#x0206#x0208#x020a#x020c#x020e#x0210#x0212#x0214#x0216#x0218#x021a#x021c#x021e#x0220#x0222#x0224#x0226#x0228#x022a]
/   [#x022c#x022e#x0230#x0232#x0386#x0388-#x038a#x038c#x038e-#x038f#x0391-#x03a1#x03a3-#x03ab#x03d2-#x03d4#x03d8#x03da#x03dc#x03de#x03e0]
/   [#x03e2#x03e4#x03e6#x03e8#x03ea#x03ec#x03ee#x03f4#x03f7#x03f9-#x03fa#x0400-#x042f#x0460#x0462#x0464#x0466#x0468#x046a#x046c#x046e#x0470]
/   [#x0472#x0474#x0476#x0478#x047a#x047c#x047e#x0480#x048a#x048c#x048e#x0490#x0492#x0494#x0496#x0498#x049a#x049c#x049e#x04a0#x04a2#x04a4]
/   [#x04a6#x04a8#x04aa#x04ac#x04ae#x04b0#x04b2#x04b4#x04b6#x04b8#x04ba#x04bc#x04be#x04c0-#x04c1#x04c3#x04c5#x04c7#x04c9#x04cb#x04cd#x04d0]
/   [#x04d2#x04d4#x04d6#x04d8#x04da#x04dc#x04de#x04e0#x04e2#x04e4#x04e6#x04e8#x04ea#x04ec#x04ee#x04f0#x04f2#x04f4#x04f8#x0500#x0502#x0504]
/   [#x0506#x0508#x050a#x050c#x050e#x0531-#x0556#x10a0-#x10c5#x1e00#x1e02#x1e04#x1e06#x1e08#x1e0a#x1e0c#x1e0e#x1e10#x1e12#x1e14#x1e16#x1e18]
/   [#x1e1a#x1e1c#x1e1e#x1e20#x1e22#x1e24#x1e26#x1e28#x1e2a#x1e2c#x1e2e#x1e30#x1e32#x1e34#x1e36#x1e38#x1e3a#x1e3c#x1e3e#x1e40#x1e42#x1e44]
/   [#x1e46#x1e48#x1e4a#x1e4c#x1e4e#x1e50#x1e52#x1e54#x1e56#x1e58#x1e5a#x1e5c#x1e5e#x1e60#x1e62#x1e64#x1e66#x1e68#x1e6a#x1e6c#x1e6e#x1e70]
/   [#x1e72#x1e74#x1e76#x1e78#x1e7a#x1e7c#x1e7e#x1e80#x1e82#x1e84#x1e86#x1e88#x1e8a#x1e8c#x1e8e#x1e90#x1e92#x1e94#x1ea0#x1ea2#x1ea4#x1ea6]
/   [#x1ea8#x1eaa#x1eac#x1eae#x1eb0#x1eb2#x1eb4#x1eb6#x1eb8#x1eba#x1ebc#x1ebe#x1ec0#x1ec2#x1ec4#x1ec6#x1ec8#x1eca#x1ecc#x1ece#x1ed0#x1ed2]
/   [#x1ed4#x1ed6#x1ed8#x1eda#x1edc#x1ede#x1ee0#x1ee2#x1ee4#x1ee6#x1ee8#x1eea#x1eec#x1eee#x1ef0#x1ef2#x1ef4#x1ef6#x1ef8#x1f08-#x1f0f#x1f18-#x1f1d]
/   [#x1f28-#x1f2f#x1f38-#x1f3f#x1f48-#x1f4d#x1f59#x1f5b#x1f5d#x1f5f#x1f68-#x1f6f#x1fb8-#x1fbb#x1fc8-#x1fcb#x1fd8-#x1fdb#x1fe8-#x1fec#x1ff8-#x1ffb]
/   [#x2102#x2107#x210b-#x210d#x2110-#x2112#x2115#x2119-#x211d#x2124#x2126#x2128#x212a-#x212d#x2130-#x2131#x2133#x213e-#x213f#x2145#xff21-#xff3a];


// Unicode Category Ll, Letter, Lowercase
Ll: [#x0061-#x007a#x00aa#x00b5#x00ba#x00df-#x00f6#x00f8-#x00ff#x0101#x0103#x0105#x0107#x0109#x010b#x010d#x010f#x0111#x0113]
/    [#x0115#x0117#x0119#x011b#x011d#x011f#x0121#x0123#x0125#x0127#x0129#x012b#x012d#x012f#x0131#x0133#x0135#x0137-#x0138#x013a]
/    [#x013c#x013e#x0140#x0142#x0144#x0146#x0148-#x0149#x014b#x014d#x014f#x0151#x0153#x0155#x0157#x0159#x015b#x015d#x015f#x0161]
/    [#x0163#x0165#x0167#x0169#x016b#x016d#x016f#x0171#x0173#x0175#x0177#x017a#x017c#x017e-#x0180#x0183#x0185#x0188#x018c-#x018d]
/    [#x0192#x0195#x0199-#x019b#x019e#x01a1#x01a3#x01a5#x01a8#x01aa-#x01ab#x01ad#x01b0#x01b4#x01b6#x01b9-#x01ba#x01bd-#x01bf#x01c6#x01c9]
/    [#x01cc#x01ce#x01d0#x01d2#x01d4#x01d6#x01d8#x01da#x01dc-#x01dd#x01df#x01e1#x01e3#x01e5#x01e7#x01e9#x01eb#x01ed#x01ef-#x01f0#x01f3#x01f5]
/    [#x01f9#x01fb#x01fd#x01ff#x0201#x0203#x0205#x0207#x0209#x020b#x020d#x020f#x0211#x0213#x0215#x0217#x0219#x021b#x021d#x021f#x0221#x0223]
/    [#x0225#x0227#x0229#x022b#x022d#x022f#x0231#x0233-#x0236#x0250-#x02af#x0390#x03ac-#x03ce#x03d0-#x03d1#x03d5-#x03d7#x03d9#x03db#x03dd]
/   [#x03df#x03e1#x03e3#x03e5#x03e7#x03e9#x03eb#x03ed#x03ef-#x03f3#x03f5#x03f8#x03fb#x0430-#x045f#x0461#x0463#x0465#x0467#x0469]
/   [#x046b#x046d#x046f#x0471#x0473#x0475#x0477#x0479#x047b#x047d#x047f#x0481#x048b#x048d#x048f#x0491#x0493#x0495#x0497#x0499]
/   [#x049b#x049d#x049f#x04a1#x04a3#x04a5#x04a7#x04a9#x04ab#x04ad#x04af#x04b1#x04b3#x04b5#x04b7#x04b9#x04bb#x04bd#x04bf#x04c2]
/   [#x04c4#x04c6#x04c8#x04ca#x04cc#x04ce#x04d1#x04d3#x04d5#x04d7#x04d9#x04db#x04dd#x04df#x04e1#x04e3#x04e5#x04e7#x04e9#x04eb]
/   [#x04ed#x04ef#x04f1#x04f3#x04f5#x04f9#x0501#x0503#x0505#x0507#x0509#x050b#x050d#x050f#x0561-#x0587#x1d00-#x1d2b#x1d62-#x1d6b]
/   [#x1e01#x1e03#x1e05#x1e07#x1e09#x1e0b#x1e0d#x1e0f#x1e11#x1e13#x1e15#x1e17#x1e19#x1e1b#x1e1d#x1e1f#x1e21#x1e23#x1e25#x1e27]
/   [#x1e29#x1e2b#x1e2d#x1e2f#x1e31#x1e33#x1e35#x1e37#x1e39#x1e3b#x1e3d#x1e3f#x1e41#x1e43#x1e45#x1e47#x1e49#x1e4b#x1e4d#x1e4f]
/   [#x1e51#x1e53#x1e55#x1e57#x1e59#x1e5b#x1e5d#x1e5f#x1e61#x1e63#x1e65#x1e67#x1e69#x1e6b#x1e6d#x1e6f#x1e71#x1e73#x1e75#x1e77]
/   [#x1e79#x1e7b#x1e7d#x1e7f#x1e81#x1e83#x1e85#x1e87#x1e89#x1e8b#x1e8d#x1e8f#x1e91#x1e93#x1e95-#x1e9b#x1ea1#x1ea3#x1ea5#x1ea7]
/   [#x1ea9#x1eab#x1ead#x1eaf#x1eb1#x1eb3#x1eb5#x1eb7#x1eb9#x1ebb#x1ebd#x1ebf#x1ec1#x1ec3#x1ec5#x1ec7#x1ec9#x1ecb#x1ecd#x1ecf]
/   [#x1ed1#x1ed3#x1ed5#x1ed7#x1ed9#x1edb#x1edd#x1edf#x1ee1#x1ee3#x1ee5#x1ee7#x1ee9#x1eeb#x1eed#x1eef#x1ef1#x1ef3#x1ef5#x1ef7]
/   [#x1ef9#x1f00-#x1f07#x1f10-#x1f15#x1f20-#x1f27#x1f30-#x1f37#x1f40-#x1f45#x1f50-#x1f57#x1f60-#x1f67#x1f70-#x1f7d#x1f80-#x1f87#x1f90-#x1f97]
/   [#x1fa0-#x1fa7#x1fb0-#x1fb4#x1fb6-#x1fb7#x1fbe#x1fc2-#x1fc4#x1fc6-#x1fc7#x1fd0-#x1fd3#x1fd6-#x1fd7#x1fe0-#x1fe7#x1ff2-#x1ff4]
/   [#x1ff6-#x1ff7#x2071#x207f#x210a#x210e-#x210f#x2113#x212f#x2134#x2139#x213d#x2146-#x2149#xfb00-#xfb06#xfb13-#xfb17#xff41-#xff5a];

// Unicode Category Lt: Letter, Titlecase
Lt: [#x01c5#x01c8#x01cb#x01f2#x1f88-#x1f8f#x1f98-#x1f9f#x1fa8-#x1faf#x1fbc#x1fcc#x1ffc];

// Unicode Category Lm: Letter, Modifier
Lm: 	[#x02b0-#x02c1#x02c6-#x02d1#x02e0-#x02e4#x02ee#x037a#x0559#x0640#x06e5-#x06e6]
/	[#x0e46#x0ec6#x17d7#x1843#x1d2c-#x1d61#x3005#x3031-#x3035#x303b#x309d-#x309e#x30fc-#x30fe#xff70#xff9e-#xff9f];
// Unicode Category Lo: Letter, Other
Lo: [#x01bb#x01c0-#x01c3#x05d0-#x05ea#x05f0-#x05f2#x0621-#x063a#x0641-#x064a#x066e-#x066f#x0671-#x06d3#x06d5#x06ee-#x06ef#x06fa-#x06fc]
/   [#x06ff#x0710#x0712-#x072f#x074d-#x074f#x0780-#x07a5#x07b1#x0904-#x0939#x093d#x0950#x0958-#x0961#x0985-#x098c#x098f-#x0990#x0993-#x09a8]
/   [#x09aa-#x09b0#x09b2#x09b6-#x09b9#x09bd#x09dc-#x09dd#x09df-#x09e1#x09f0-#x09f1#x0a05-#x0a0a#x0a0f-#x0a10#x0a13-#x0a28#x0a2a-#x0a30]
/   [#x0a32-#x0a33#x0a35-#x0a36#x0a38-#x0a39#x0a59-#x0a5c#x0a5e#x0a72-#x0a74#x0a85-#x0a8d#x0a8f-#x0a91#x0a93-#x0aa8#x0aaa-#x0ab0]
/   [#x0ab2-#x0ab3#x0ab5-#x0ab9#x0abd#x0ad0#x0ae0-#x0ae1#x0b05-#x0b0c#x0b0f-#x0b10#x0b13-#x0b28#x0b2a-#x0b30#x0b32-#x0b33#x0b35-#x0b39]
/   [#x0b3d#x0b5c-#x0b5d#x0b5f-#x0b61#x0b71#x0b83#x0b85-#x0b8a#x0b8e-#x0b90#x0b92-#x0b95#x0b99-#x0b9a#x0b9c#x0b9e-#x0b9f#x0ba3-#x0ba4]
/   [#x0ba8-#x0baa#x0bae-#x0bb5#x0bb7-#x0bb9#x0c05-#x0c0c#x0c0e-#x0c10#x0c12-#x0c28#x0c2a-#x0c33#x0c35-#x0c39#x0c60-#x0c61#x0c85-#x0c8c]
/   [#x0c8e-#x0c90#x0c92-#x0ca8#x0caa-#x0cb3#x0cb5-#x0cb9#x0cbd#x0cde#x0ce0-#x0ce1#x0d05-#x0d0c#x0d0e-#x0d10#x0d12-#x0d28#x0d2a-#x0d39]
/   [#x0d60-#x0d61#x0d85-#x0d96#x0d9a-#x0db1#x0db3-#x0dbb#x0dbd#x0dc0-#x0dc6#x0e01-#x0e30#x0e32-#x0e33#x0e40-#x0e45#x0e81-#x0e82#x0e84]
/   [#x0e87-#x0e88#x0e8a#x0e8d#x0e94-#x0e97#x0e99-#x0e9f#x0ea1-#x0ea3#x0ea5#x0ea7#x0eaa-#x0eab#x0ead-#x0eb0#x0eb2-#x0eb3#x0ebd#x0ec0-#x0ec4]
/   [#x0edc-#x0edd#x0f00#x0f40-#x0f47#x0f49-#x0f6a#x0f88-#x0f8b#x1000-#x1021#x1023-#x1027#x1029-#x102a#x1050-#x1055#x10d0-#x10f8]
/   [#x1100-#x1159#x115f-#x11a2#x11a8-#x11f9#x1200-#x1206#x1208-#x1246#x1248#x124a-#x124d#x1250-#x1256#x1258#x125a-#x125d#x1260-#x1286]
/   [#x1288#x128a-#x128d#x1290-#x12ae#x12b0#x12b2-#x12b5#x12b8-#x12be#x12c0#x12c2-#x12c5#x12c8-#x12ce#x12d0-#x12d6#x12d8-#x12ee#x12f0-#x130e]
/   [#x1310#x1312-#x1315#x1318-#x131e#x1320-#x1346#x1348-#x135a#x13a0-#x13f4#x1401-#x166c#x166f-#x1676#x1681-#x169a#x16a0-#x16ea]
/   [#x1700-#x170c#x170e-#x1711#x1720-#x1731#x1740-#x1751#x1760-#x176c#x176e-#x1770#x1780-#x17b3#x17dc#x1820-#x1842#x1844-#x1877#x1880-#x18a8]
/   [#x1900-#x191c#x1950-#x196d#x2135-#x2138#x3006#x303c#x3041-#x3096#x309f#x30a1-#x30fa#x30ff#x3105-#x312c#x3131-#x318e#x31a0-#x31b7]
/   [#x31f0-#x31ff#x3400#x4db5#x4e00#x9fa5#xa000-#xa48c#xac00#xd7a3#xfb1d#xfb1f-#xfb28#xfb2a-#xfb36#xfb38-#xfb3c#xfb3e#xfb40-#xfb41]
/   [#xfb43-#xfb44#xfb46-#xfbb1#xfbd3-#xfd3d#xfd50-#xfd8f#xfd92-#xfdc7#xfdf0-#xfdfb#xfe70-#xfe74#xfe76-#xfefc#xff66-#xff6f#xff71-#xff9d]
/   [#xffa0-#xffbe#xffc2-#xffc7#xffca-#xffcf#xffd2-#xffd7#xffda-#xffdc];


// Unicode Category Nl: Number, Letter
Nl: [#x16ee-#x16f0#x2160-#x2183#x3007#x3021-#x3029#x3038-#x303a];

// Unicode Cateogry Mn: Mark, Nonspacing
Mn:[#x0300-#x0357#x035d-#x036f#x0483-#x0486#x0591-#x05a1#x05a3-#x05b9#x05bb-#x05bd#x05bf#x05c1-#x05c2#x05c4#x0610-#x0615#x064b-#x0658]
/   [#x0670#x06d6-#x06dc#x06df-#x06e4#x06e7-#x06e8#x06ea-#x06ed#x0711#x0730-#x074a#x07a6-#x07b0#x0901-#x0902#x093c#x0941-#x0948#x094d]
/   [#x0951-#x0954#x0962-#x0963#x0981#x09bc#x09c1-#x09c4#x09cd#x09e2-#x09e3#x0a01-#x0a02#x0a3c#x0a41-#x0a42#x0a47-#x0a48#x0a4b-#x0a4d]
/   [#x0a70-#x0a71#x0a81-#x0a82#x0abc#x0ac1-#x0ac5#x0ac7-#x0ac8#x0acd#x0ae2-#x0ae3#x0b01#x0b3c#x0b3f#x0b41-#x0b43#x0b4d#x0b56#x0b82]
/   [#x0bc0#x0bcd#x0c3e-#x0c40#x0c46-#x0c48#x0c4a-#x0c4d#x0c55-#x0c56#x0cbc#x0cbf#x0cc6#x0ccc-#x0ccd#x0d41-#x0d43#x0d4d#x0dca#x0dd2-#x0dd4]
/   [#x0dd6#x0e31#x0e34-#x0e3a#x0e47-#x0e4e#x0eb1#x0eb4-#x0eb9#x0ebb-#x0ebc#x0ec8-#x0ecd#x0f18-#x0f19#x0f35#x0f37#x0f39#x0f71-#x0f7e]
/   [#x0f80-#x0f84#x0f86-#x0f87#x0f90-#x0f97#x0f99-#x0fbc#x0fc6#x102d-#x1030#x1032#x1036-#x1037#x1039#x1058-#x1059#x1712-#x1714]
/   [#x1732-#x1734#x1752-#x1753#x1772-#x1773#x17b7-#x17bd#x17c6#x17c9-#x17d3#x17dd#x180b-#x180d#x18a9#x1920-#x1922#x1927-#x1928#x1932]
/   [#x1939-#x193b#x20d0-#x20dc#x20e1#x20e5-#x20ea#x302a-#x302f#x3099-#x309a#xfb1e#xfe20-#xfe23];

// Unicode Category Mc: Mark, Spacing Combining
Mc:[#x0903#x093e-#x0940#x0949-#x094c#x0982-#x0983#x09be-#x09c0#x09c7-#x09c8#x09cb-#x09cc#x09d7#x0a03#x0a3e-#x0a40#x0a83#x0abe-#x0ac0]
/   [#x0ac9#x0acb-#x0acc#x0b02-#x0b03#x0b3e#x0b40#x0b47-#x0b48#x0b4b-#x0b4c#x0b57#x0bbe-#x0bbf#x0bc1-#x0bc2#x0bc6-#x0bc8#x0bca-#x0bcc]
/   [#x0bd7#x0c01-#x0c03#x0c41-#x0c44#x0c82-#x0c83#x0cbe#x0cc0-#x0cc4#x0cc7-#x0cc8#x0cca-#x0ccb#x0cd5-#x0cd6#x0d02-#x0d03#x0d3e-#x0d40]
/   [#x0d46-#x0d48#x0d4a-#x0d4c#x0d57#x0d82-#x0d83#x0dcf-#x0dd1#x0dd8-#x0ddf#x0df2-#x0df3#x0f3e-#x0f3f#x0f7f#x102c#x1031#x1038#x1056-#x1057]
/   [#x17b6#x17be-#x17c5#x17c7-#x17c8#x1923-#x1926#x1929-#x192b#x1930-#x1931#x1933-#x1938];

// Unicode Category Nd: Number, Decimal Digit
Nd:[#x0030-#x0039#x0660-#x0669#x06f0-#x06f9#x0966-#x096f#x09e6-#x09ef#x0a66-#x0a6f#x0ae6-#x0aef#x0b66-#x0b6f#x0be7-#x0bef#x0c66-#x0c6f]
/   [#x0ce6-#x0cef#x0d66-#x0d6f#x0e50-#x0e59#x0ed0-#x0ed9#x0f20-#x0f29#x1040-#x1049#x1369-#x1371#x17e0-#x17e9#x1810-#x1819#x1946-#x194f#xff10-#xff19];

// Unicode Category Pc: Punctuation, Connector
Pc:  [#x005f#x203f-#x2040#x2054#x30fb#xfe33-#xfe34#xfe4d-#xfe4f#xff3f#xff65];

  
// Unicode Category Cf: Other, Format
Cf: [#x00ad#x0600-#x0603#x06dd#x070f#x17b4-#x17b5#x200b-#x200f#x202a-#x202e#x2060-#x2063#x206a-#x206f#xfeff#xfff9-#xfffb];
<</Grammar>>

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Switzerland Switzerland
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions