Browse Source

Merge pull request #400 from jplag/csharp-overhaul

Replace C# frontend
Timur Sağlam 4 years ago
parent
commit
8ad4f42bad
19 changed files with 3354 additions and 2380 deletions
  1. 0 2032
      jplag.frontend.csharp-1.2/src/main/antlr/csharp.g
  2. 0 69
      jplag.frontend.csharp-1.2/src/main/java/de/jplag/csharp/CSharpToken.java
  3. 0 60
      jplag.frontend.csharp-1.2/src/main/java/de/jplag/csharp/CSharpTokenConstants.java
  4. 0 74
      jplag.frontend.csharp-1.2/src/main/java/de/jplag/csharp/Parser.java
  5. 0 113
      jplag.frontend.csharp-1.2/src/main/java/de/jplag/csharp/UnicodeReader.java
  6. 8 14
      jplag.frontend.csharp-6/pom.xml
  7. 1058 0
      jplag.frontend.csharp-6/src/main/antlr4/de/jplag/csharp/grammar/CSharpLexer.g4
  8. 1245 0
      jplag.frontend.csharp-6/src/main/antlr4/de/jplag/csharp/grammar/CSharpParser.g4
  9. 40 0
      jplag.frontend.csharp-6/src/main/antlr4/de/jplag/csharp/grammar/CSharpPreprocessorParser.g4
  10. 423 0
      jplag.frontend.csharp-6/src/main/java/de/jplag/csharp/CSharpListener.java
  11. 84 0
      jplag.frontend.csharp-6/src/main/java/de/jplag/csharp/CSharpParserAdapter.java
  12. 90 0
      jplag.frontend.csharp-6/src/main/java/de/jplag/csharp/CSharpToken.java
  13. 78 0
      jplag.frontend.csharp-6/src/main/java/de/jplag/csharp/CSharpTokenConstants.java
  14. 17 7
      jplag.frontend.csharp-6/src/main/java/de/jplag/csharp/Language.java
  15. 90 0
      jplag.frontend.csharp-6/src/main/java/de/jplag/csharp/grammar/CSharpLexerBase.java
  16. 26 0
      jplag.frontend.csharp-6/src/main/java/de/jplag/csharp/grammar/CSharpParserBase.java
  17. 177 0
      jplag.frontend.csharp-6/src/main/java/de/jplag/csharp/grammar/CSharpPreprocessorParserBase.java
  18. 1 1
      jplag/pom.xml
  19. 17 10
      pom.xml

+ 0 - 2032
jplag.frontend.csharp-1.2/src/main/antlr/csharp.g

@@ -1,2032 +0,0 @@
-
-
-header 
-{
-package de.jplag.csharp.grammar;
-
-}
-
-options 
-{	
-	language = "Java";
-	//namespace = "DDW.CSharp";
-}
-
-class CSharpParser extends Parser;
-
-options 
-{
-	k = 2;                           	// two token lookahead
-	defaultErrorHandler = false;		// don't generate parser error handlers
-	buildAST = false;   
- 	exportVocab=CSharp;
-    classHeaderSuffix = "de.jplag.csharp.CSharpTokenConstants";
-}
-
-
-tokens 
-{
-		
-// ===== Tokens =====
-
-	CompileUnit;
-	UsingNode;
-
-// ======== DECLARATIONS =========================
-
-	TypeNode;				
-	NamespaceNode;
-	ClassNode;
-	InterfaceNode;
-	StructNode;
-	EnumNode;
-	DelegateNode;
-	BaseTypes;
-	
-	BooleanLiteral;
-	IntegerLiteral;
-	RealLiteral;
-	CharLiteral;
-	StringLiteral;
-	NullLiteral;
-
-// ======== MEMBERS ==============================
-
-	Types;
-	Members;
-	TypeMemberNode;
-	MethodNode;
-	FieldNode;
-	PropertyNode;
-	EventNode;
-	ConstantNode;
-	IndexerNode;
-	OperatorNode;
-	ConstructorNode;
-	DestructorNode;
-	AccessorNode;
-																		  
-// ======== REFERENCES ===========================						  
-
-	Ident;
-	QualIdent;
-	TypeRef;
-	Args;
-	Arg;
-	ArgDirection;
-	Op;
-																	
-// ======== STATEMENTS ===========================					
-																	
-	Statements;
-	Statement;
-	ExprStmt;
-	AssignStmt;
-	Comment;
-	TryCatchFinallyStmt;
-	 TryStmt;
-	 CatchClause;
-	 FinallyStmt;
-	ConditionStmt;
-	 SwitchSection;
-	 TrueSection;
-	 FalseSection;
-	IterationStmt;
-	 InitStmt;
-	 IncStmt;
-	 TestExpr;
-	 
-	GotoStmt;
-	ReturnStmt;
-	BreakStmt;
-	ContinueStmt;
-	ThrowStmt;
-	
-	CheckedStmt;
-	UncheckedStmt;
-	LockStmt;
-	UsingStmt;
-	
-	LabeledStmt;
-	VariableDeclStmt;
-
-// ======== EXPRESSIONS ==========================
-
-	Expressions;
-	Expression;
-	SubExpression;
-	
-	TypeRefExpr;			
-	PrimitiveExpr;
-	CastExpr;
-	ThisRefExpr;
-	BaseRefExpr;
-	MemberAccessExpr;
-	UnaryExpr;
-	
-	ArrayCreateExpr;
-	ObjectCreateExpr;
-	TypeOfExpr;
-	PostfixExpr;
-	CheckedExpr;
-	UncheckedExpr;
-	
-	InvokeExpr;
-	IndexerExpr;
-	ArrayRankExpr;
-	ArrayInitExpr;
-
-// ======== MISC =================================
-
-	AttributeNode;
-	GlobalAttributeNode;
-	CustomAttributeNode;
-	ModifierAttributes;
-	LinePragma;
-}
-	// Emeric 22.01.05 feld de.jplag.java.Parser parser
-	
-	
-// extended consume routine:
-{
-public de.jplag.csharp.Parser parser ;
-    private Token lastConsumedToken = null;
-    public void consume() {
-        try {
-            lastConsumedToken = LT(1);
-        	super.consume();
-        } catch(antlr.TokenStreamException e) {
-            lastConsumedToken = null;
-        }
-    }
-
-    public Token getLastConsumedToken() {
-        return lastConsumedToken;
-    }
-}
-
-
-
-identifier
-	:	IDENTIFIER
-	;
-
-// ***** A.1.8 Literals *****
-
-literal
-	:	boolean_literal
-	|	INTEGER_LITERAL
-	|	HEXADECIMAL_INTEGER_LITERAL
-	|	REAL_LITERAL				
-	|	CHARACTER_LITERAL			
-	|	STRING_LITERAL				
-	|	null_literal				
-	;
-	
-boolean_literal
-	:	TRUE
-	|	FALSE
-	;
-	
-null_literal
-	:	NULL
-	;
-	
-
-// ***** A.2.1 Basic concepts *****
-namespace_name
-	:	namespace_or_type_name
-	;
-type_name
-	:	namespace_or_type_name
-	;
-namespace_or_type_name
-	:	simple_name (DOT simple_name)*
-	;
-	
-
-// ***** A.2.2 Types *****
-
-type
-	:	{ LA(2)!=LBRACK }?	// guard against array	
-		value_type
-	|	{ LA(2)!=LBRACK }?	
-		type_name			// may be struct, enum, class, interface, array, or delegate type
-	|	{ LA(2)==STAR }? pointer_type
-	|	reference_type
-	;
-
-value_type
-	:	struct_type
-//	|	enum_type	// enum can only be a type_name
-	;
-
-struct_type
-	:	simple_type
-	;
-
-simple_type
-	:	numeric_type
-	|	BOOL
-	;
-
-numeric_type
-	:	integral_type
-	|	floating_point_type
-	|	DECIMAL
-	;
-
-integral_type
-	:	SBYTE 
-	|	BYTE 
-	|	SHORT 
-	|	USHORT 
-	|	INT 
-	|	UINT 
-	|	LONG 
-	|	ULONG 
-	|	CHAR
-	;
-
-floating_point_type
-	:	FLOAT 
-	|	DOUBLE
-	;
-
-	
-reference_type
-	:	(class_type)=>class_type
-	|	(array_type)=>array_type
-//	|	interface_type	// interface_type can only be a type_name
-//	|	delegate_type	// delegate_type  can only be a type_name
-	;
-
-pointer_type
-	:	(type_name | struct_type | VOID) (STAR)+
-	;
-	
-unmanaged_type
-	:	(type_name | struct_type | VOID) (STAR)*
-	;
-
-class_type
-	:	/*{LA(2)==LTHAN}? type_name LTHAN class_type (COMMA class_type)* GTHAN
-	|	*/type_name
-	|	OBJECT
-	|	STRING 
-	;	
-	
-array_type
-	:	non_array_type rank_specifiers
-	;
-	
-interface_type
-	:	type_name
-	;
-	
-delegate_type
-	:	type_name
-	;
-	
-non_array_type
-	:	class_type
-	|	value_type
-//	|	type_name
-//	|	interface_type // determine interface and delegates later
-//	|	delegate_type
-	;
-	
-rank_specifiers
-	:	(options{greedy=true;}:LBRACK (COMMA)* RBRACK)+
-	;
-// ***** A.2.3 Variables *****
-
-variable_reference
-	:	expression
-	;
-	
-	
-// ***** A.2.4 Expressions *****
-
-argument_list
-	:	argument (COMMA argument)*
-	;
-		
-argument
-	:	expression
-	|	parameter_direction variable_reference
-	;
-
-simple_name
-	:	identifier
-	;
-parenthesized_expression
-	:	LPAREN expression RPAREN
-	;
-primary_start
-	:	literal	
-	|	simple_name	
-	|	parenthesized_expression
-	|	this_access	
-	|	base_access	
-	|	(array_creation_expression)=>array_creation_expression
-	|	object_creation_expression
-	|	typeof_expression
-	|	sizeof_expression
-	|	checked_expression
-	|	unchecked_expression
-	|	predefined_type_access
-	;
-primary_expression
-	:   primary_start 
-		(	options {greedy=true;}:	
-			unchecked_expression
-		|	checked_expression			
-		|	sizeof_expression
-		|	typeof_expression
-		|	object_creation_expression	
-		|	postfix_expression			
-		|	base_access	
-		|	this_access	
-		|	element_access				
-//		|	pointer_element_access			// same as element_access
-		|	(invocation_expression)=>invocation_expression
-		|	member_access 
-		|	pointer_member_access
-		|	parenthesized_expression
-		|	simple_name			
-		|	literal			
-		)*
-	;		
-
-member_access
-	:	DOT identifier 
-	;
-predefined_type_access
-	:(	BOOL	|	BYTE	|	CHAR	|	DECIMAL	|	DOUBLE	
-	|	FLOAT	|	INT		|	LONG	|	OBJECT	|	SBYTE	
-	|	SHORT	|	STRING	|	UINT	|	ULONG	|	USHORT)
-	DOT  identifier
-	;
-
-invocation_expression
-	:	LPAREN { parser.add(_INVOCATION, this); }
-        (argument_list)? RPAREN
-	;	
-element_access
-	:	LBRACK expression_list RBRACK
-	;
-expression_list
-	:	expression (COMMA expression)*
-	;
-this_access
-	:	THIS
-	;
-base_access
-	:	BASE DOT identifier
-	|	BASE element_access										
-	;																		
-postfix_expression															
-	:	postfix_op													
-	;	
-postfix_op
-	:	INC { parser.add(_ASSIGNMENT, this); }
-	|	DEC { parser.add(_ASSIGNMENT, this); }
-	;
-object_creation_expression
-	:	NEW { parser.add(_OBJECT_CREATION, this); }
-        type LPAREN (argument_list)? RPAREN
-	;
-typeof_expression
-	:	TYPEOF LPAREN
-		typeof_types
-		RPAREN
-	;	
-typeof_types
-	:	({LA(2)!=STAR}? VOID | type)
-	;
-checked_expression
-	:	CHECKED LPAREN expression RPAREN
-	;
-
-unchecked_expression
-	:	UNCHECKED LPAREN expression RPAREN
-	;
-array_creation_expression
-	:	(NEW array_type array_initializer)=>
-		 NEW  { parser.add(_ARRAY_CREATION, this); } 
-		 array_type 
-		 array_initializer
-		 
-	|	NEW  { parser.add(_ARRAY_CREATION, this); }
-		non_array_type 
-		LBRACK 
-		expression_list 
-		RBRACK 
-		(options{greedy=true;}:rank_specifiers )? 
-		(array_initializer)?
-		
-	;
-// until types are discovered, delegate and object creation are the same
-//delegate_creation_expression
-//	:	NEW delegate_type LPAREN expression RPAREN 
-//	;
-
-
-pointer_member_access
-	:	ARROW identifier
-	;
-
-/* same as element_access
-pointer_element_access
-	:	LBRACK expression RBRACK
-	;
-*/
-
-addressof_expression
-	:	BAND unary_expression
-	;
-
-sizeof_expression
-	:	SIZEOF LPAREN unmanaged_type RPAREN
-	;
-
-// ============================
-
-unary_expression
-	:	(cast_expression unary_expression) => cast_expression unary_expression
-	|	primary_expression 
-	|	unary_op unary_expression
-//	|	pointer_indirection_expression
-//	|	addressof_expression
-	;
-unary_op	// includes operators for unsafe (* and &)
-	: PLUS | MINUS | LNOT | BNOT | STAR | BAND
-	| INC { parser.add(_ASSIGNMENT, this); }
-	| DEC { parser.add(_ASSIGNMENT, this); }
-	;
-	
-pre_increment_expression
-	:	INC  { parser.add(_ASSIGNMENT, this); }  unary_expression
-	;
-
-pre_decrement_expression
-	:	DEC  { parser.add(_ASSIGNMENT, this); }  unary_expression
-	;
-
-cast_expression
-	:	LPAREN type RPAREN 
-	;
-
-// ============================
-
-sub_expression
-	:	unary_expression
-	;
-
-multiplicative_expression
-	:	sub_expression
-	(	STAR^ sub_expression
-	|	DIV^ sub_expression
-	|	MOD^ sub_expression
-	)*
-	;
-
-additive_expression
-	:	multiplicative_expression
-	(	PLUS^ multiplicative_expression
-	|	MINUS^ multiplicative_expression
-	)*
-	;
-
-shift_expression
-	:	additive_expression
-	(	SL^ additive_expression
-	|	SR^ additive_expression
-	)*
-	;
-
-relational_expression
-	:	shift_expression
-	(	LTHAN^ shift_expression
-	|	GTHAN^ shift_expression
-	|	LE^ shift_expression
-	|	GE^ shift_expression
-	|	IS^ type
-	|	AS^ type
-	)*
-	;
-
-equality_expression
-	:	relational_expression
-	(	EQUAL^ relational_expression
-	|	NOT_EQUAL^ relational_expression
-	)*
-	;
-
-and_expression
-	:	equality_expression
-		(BAND^ equality_expression)*
-	;
-
-exclusive_or_expression
-	:	and_expression
-		(BXOR^ and_expression)*
-	;
-
-inclusive_or_expression
-	:	exclusive_or_expression
-		(BOR^ exclusive_or_expression)*
-	;
-	
-conditional_and_expression
-	:	inclusive_or_expression
-		(LAND^ inclusive_or_expression)*
-	;
-
-conditional_or_expression
-	:	conditional_and_expression
-		(LOR^ conditional_and_expression)*
-	;
-
-conditional_expression
-	:	conditional_or_expression
-		(QUESTION^ expression COLON^ expression)?
-	;
-// ============================
-
-assignment
-	:	unary_expression
-        assignment_operator  { parser.add(_ASSIGNMENT, this); }
-        expression
-	;
-
-assignment_operator
-	:	ASSIGN | PLUS_ASN | MINUS_ASN | STAR_ASN | DIV_ASN
-    |	MOD_ASN | BAND_ASN | BOR_ASN | BXOR_ASN | SL_ASN
-    |	SR_ASN
-        
-	;
-
-expression
-	:	(conditional_expression) => conditional_expression
-	|	assignment
-	;
-
-constant_expression
-	:	expression
-	;
-
-boolean_expression
-	:	expression
-	;
-
-
-
-// ***** A.2.5 Statements *****
-
-statement
-	:	labeled_statement
-	|	(declaration_statement) => declaration_statement
-	|	embedded_statement
-	;
-
-embedded_statement
-	:	block
-	|	empty_statement
-	|	expression_statement
-	|	selection_statement
-	|	iteration_statement
-	|	jump_statement
-	|	try_statement
-	|	checked_statement
-	|	unchecked_statement
-	|	lock_statement
-	|	using_statement
-	|	unsafe_statement
-	|	fixed_statement
-	;
-
-block
-	:	LBRACE  { parser.add(_L_BRACE, this); }
-        statement_list RBRACE { parser.add(_R_BRACE, this); }
-	;
-	
-statement_list
-	:	(statement)*
-	;
-
-empty_statement
-	:	SEMI
-	; 
-
-labeled_statement
-	:	identifier COLON statement
-	;
-	
-declaration_statement
-	:	local_variable_declaration SEMI
-	|	local_constant_declaration SEMI 
-	;
-
-local_variable_declaration
-	:	type local_variable_declarators
-	;
-
-local_variable_declarators
-	:	local_variable_declarator (COMMA local_variable_declarator)*
-	;
-
-local_variable_declarator
-	:	identifier  { parser.add(_DECLARE_VAR, this); }
-        (ASSIGN local_variable_initializer)?
-	;
-
-local_variable_initializer
-	:	expression
-	|	array_initializer
-	|	stackalloc_initializer
-	;
-
-stackalloc_initializer
-	:	STACKALLOC unmanaged_type LBRACK expression RBRACK
-	;
-
-local_constant_declaration
-	:	CONST type constant_declarators
-	;
-	
-constant_declarators
-	:	constant_declarator (COMMA constant_declarator)*
-	;
-
-constant_declarator
-	:	identifier  { parser.add(_DECLARE_CONST, this); }
-        ASSIGN constant_expression
-	;
-	
-expression_statement
-	:	statement_expression SEMI
-	;
-	
-statement_expression
-	:	(assignment)=> assignment	// TODO: this pe can only be	
-	|	primary_expression			// a) invocation_expression 
-	|	pre_increment_expression	// b) object_creation_expression
-	|	pre_decrement_expression	// c) postfix_expression
-	;																
-	
-selection_statement
-	:	if_statement
-	|	switch_statement
-	;
-	
-// 'if' is just a subset of switch...
-if_statement
-	:	IF { parser.add(_IF, this); }
-        LPAREN boolean_expression RPAREN embedded_statement
-		(	options {warnWhenFollowAmbig = false;} // dangling else
-		:	ELSE  { parser.add(_ELSE, this); }
-            embedded_statement
-		)?        { parser.add(_END_IF, this); }
-	;
-
-switch_statement
-	:	SWITCH  { parser.add(_SWITCH_BEGIN, this); }
-        LPAREN expression RPAREN switch_block
-	;
-	
-switch_block
-	:	LBRACE ( (switch_section)+ )?
-        RBRACE  { parser.add(_SWITCH_END, this); }
-	;
-	
-switch_section
-	:	(	options {warnWhenFollowAmbig=false;}: switch_label COLON )+ 
-		statement_list
-	;	
-switch_label
-	:	CASE  { parser.add(_CASE, this); }
-        constant_expression
-	|	DEFAULT	 { parser.add(_CASE, this); }
-	;
-	
-iteration_statement
-	:	while_statement
-	|	do_statement
-	|	for_statement
-	|	foreach_statement
-	;
-
-while_statement
-	:	WHILE  { parser.add(_WHILE, this); }
-        LPAREN boolean_expression RPAREN embedded_statement
-	;
-
-do_statement
-	:	DO  { parser.add(_DO, this); }
-        embedded_statement WHILE LPAREN boolean_expression RPAREN SEMI 
-	;
-for_statement
-	:	FOR  { parser.add(_FOR, this); }
-        LPAREN 
-		(for_initializer)? SEMI 
-		(for_condition)? 	SEMI 
-		(for_iterator)? 	RPAREN 
-        embedded_statement
-    ;
-
-for_initializer
-	:	(local_variable_declaration) => local_variable_declaration
-	|	statement_expression_list
-	;
-
-for_condition
-	:	boolean_expression
-	;
-
-for_iterator
-	:	statement_expression_list
-	;
-
-statement_expression_list
-	:	statement_expression (COMMA statement_expression)*
-	;
-
-foreach_statement
-	:	FOREACH  { parser.add(_FOREACH, this); }
-        LPAREN 
-        type 
-        identifier 	IN 
-        expression 	RPAREN 
-        embedded_statement
-	;
-jump_statement
-	:	break_statement
-	|	continue_statement
-	|	goto_statement
-	|	return_statement
-	|	throw_statement
-	;
-
-break_statement	
-	:	BREAK { parser.add(_BREAK, this); } SEMI		
-	;
-continue_statement
-	:	CONTINUE { parser.add(_CONTINUE, this); } SEMI
-	;
-goto_statement
-	:	GOTO { parser.add(_GOTO, this); } identifier SEMI
-	|	GOTO { parser.add(_GOTO, this); } CASE constant_expression SEMI
-	|	GOTO { parser.add(_GOTO, this); } DEFAULT SEMI
-	;
-return_statement
-	:	RETURN { parser.add(_RETURN, this); } (expression)? SEMI 
-	; 	
-throw_statement
-	:	THROW { parser.add(_THROW, this); } (expression)? SEMI 
-	;	
-	
-checked_statement
-	:	CHECKED { parser.add(_CHECKED, this); } block
-	;
-unchecked_statement
-	:	UNCHECKED { parser.add(_UNCHECKED, this); } block
-	;
-lock_statement
-	:	LOCK { parser.add(_LOCK, this); }
-        LPAREN expression RPAREN embedded_statement
-	;
-using_statement
-	:	USING { parser.add(_USING, this); }
-        LPAREN resource_acquisition RPAREN embedded_statement
-	;
-resource_acquisition
-	:	(local_variable_declaration) => local_variable_declaration
-	|	expression
-	;
-try_statement
-	:	TRY { parser.add(_TRY, this); }
-        block catch_clauses (finally_clause)?
-	;
-catch_clauses
-	:	(catch_clause)*
-	;
-catch_clause
-	:	CATCH { parser.add(_CATCH, this); }
-        (LPAREN class_type (identifier)? RPAREN)? block
-	;
-finally_clause
-	:	FINALLY { parser.add(_FINALLY, this); } block
-	;
-
-unsafe_statement
-	:	UNSAFE { parser.add(_UNSAFE, this); } block
-	;
-
-fixed_statement
-	:	FIXED { parser.add(_FIXED, this); }
-		LPAREN pointer_type fixed_pointer_declarators RPAREN embedded_statement
-	;
-
-fixed_pointer_declarators
-	:	fixed_pointer_declarator (COMMA fixed_pointer_declarator)*
-	;
-
-fixed_pointer_declarator
-	:	identifier { parser.add(_DECLARE_VAR, this); }
-		ASSIGN fixed_pointer_initializer
-	;
-
-fixed_pointer_initializer
-	:	{LA(1)==BAND}? BAND variable_reference
-	|	expression
-	;
-
-// ***** A.2.5b Namespaces *****	
-
-compilation_unit
-	:	(using_directive)*  (global_attributes)*  (namespace_member_declaration)* 
-	;
-
-namespace_declaration
-	:	NAMESPACE   { parser.add(_NAMESPACE_BEGIN, this); }
-		qualified_identifier  
-		namespace_body   
-		(SEMI)?
-	;
-	
-qualified_identifier
-	:	identifier (DOT identifier)*
-	;
-namespace_body
-	:	LBRACE   (using_directive)*  (namespace_member_declaration)* r:RBRACE
-        { parser.add(_NAMESPACE_END, this); }
-	;
-using_directive
-	:	USING   { parser.add(_USING_DIRECTIVE, this); }
-		(	identifier   ASSIGN   namespace_or_type_name   SEMI
-		|	namespace_name	SEMI
-		)
-		
-	;
-namespace_member_declaration
-	:	namespace_declaration | type_declaration
-	;
-
-type_declaration
-	:	(attributes)?
-		(	(class_declaration) => class_declaration
-		|	(struct_declaration) => struct_declaration 
-		|	(interface_declaration) => interface_declaration
-		|	(enum_declaration) => enum_declaration
-		|	(delegate_declaration SEMI) => delegate_declaration SEMI
-		) 
-		(SEMI)?
-	;
-	
-// ***** Generics stuff *****
-
-type_parameter_list
-	:	LTHAN type_parameters GTHAN
-	;
-	
-type_parameters
-	:	type_parameter (COMMA type_parameter)*
-	;
-	
-type_parameter
-	:	identifier
-	;
-
-type_parameter_constraints_clauses
-	:	(type_parameter_constraints_clause)+
-	;
-
-type_parameter_constraints_clause
-	:	{ LT(1).getText().equals("where") }? identifier type_parameter COLON type_parameter_constraints
-	;
-
-type_parameter_constraints
-	:	primary_constraint (COMMA
-		(
-			secondary_constraints (COMMA constructor_constraint)?
-		|
-			constructor_constraint
-		))?
-//	|	secondary_constraints (COMMA constructor_constraint)?
-	|	constructor_constraint
-	;
-
-primary_constraint
-	:	class_type
-	|	CLASS
-	|	STRUCT
-	;
-	
-secondary_constraints
-	:	interface_type ({LA(1) == COMMA}? COMMA secondary_constraints)?
-//	|	type_parameter (COMMA secondary_constraints)?
-	;
-
-constructor_constraint
-	:	NEW LPAREN RPAREN
-	;
-	
-// ***** A.2.6 Classes *****
-
-class_declaration
-	:	(class_modifiers)*
-		(partial_modifier)?
-		CLASS
-        identifier  { parser.add(_CLASS_BEGIN, this); }
-        (type_parameter_list)?
-		(class_base)? 
-		(type_parameter_constraints_clauses)?
-        class_body
-                        { parser.add(_CLASS_END, this); }
-	;
-	
-	
-class_modifiers
-	:	NEW 	|	PUBLIC	 |	PROTECTED  |	INTERNAL 
-	|	PRIVATE |	ABSTRACT |	SEALED     |    UNSAFE
-	;
-
-partial_modifier
-	:	{ LT(1).getText().equals("partial")}? identifier		
-	;
-
-class_base
-	:	COLON 
-		(	class_type (COMMA class_type)*
-//		|	interface_type_list
-//		|	class_type COMMA interface_type_list
-		)
-	;
-//interface_type_list
-//	:	interface_type (COMMA interface_type)*
-//	;
-class_body
-	:	LBRACE (class_member_declaration)* RBRACE
-	;
-
-class_member_declaration
-	:	(constant_declaration) 		=> constant_declaration
-	|	(field_declaration) 		=> field_declaration 
-	|	(method_declaration) 		=> method_declaration 
-	|	(property_declaration) 		=> property_declaration
-	|	(event_declaration) 		=> event_declaration
-	|	(indexer_declaration) 		=> indexer_declaration
-	|	(operator_declaration) 		=> operator_declaration
-	|	(constructor_declaration) 	=> constructor_declaration 
-	|	(destructor_declaration) 	=> destructor_declaration
-	|	(static_constructor_declaration) => static_constructor_declaration
-	|	type_declaration
-	;
-	
-	
-constant_declaration
-	:	(attributes)? 
-		constant_modifiers 
-		CONST  { parser.add(_DECLARE_CONST, this); }
-		type 
-		constant_declarators // consts can declare more than one field
-		SEMI
-	;
-constant_modifiers
-	:	(NEW
-	|	PUBLIC
-	|	PROTECTED 
-	|	INTERNAL
-	|	PRIVATE)*
-	;
-field_declaration
-	:	(attributes)? 
-		field_modifiers 
-		type 
-		variable_declarators
-		SEMI
-	;
-field_modifiers
-	 : (NEW | PUBLIC | PROTECTED | INTERNAL | PRIVATE | STATIC | READONLY | VOLATILE | UNSAFE)*
-	;
-variable_declarators
-	:	variable_declarator (COMMA variable_declarator)* 
-	;
-variable_declarator
-	:	identifier { parser.add(_DECLARE_VAR, this); }
-	|	identifier { parser.add(_DECLARE_VAR, this); }
-        ASSIGN variable_initializer
-	;
-variable_initializer
-	:	expression 	
-	|	array_initializer
-	;
-	
-method_declaration
-	:	method_header 
-		method_body
-	;
-method_header
-	:	(attributes)? 
-		method_modifiers 
-		return_type 
-		member_name  { parser.add(_METHOD, this); }
-		LPAREN (formal_parameter_list)? RPAREN
-	;
-method_modifiers
-	:	(NEW	|	PUBLIC	|	PROTECTED	|	INTERNAL
-	|	PRIVATE |	STATIC	|	VIRTUAL		|	SEALED	
-	|	OVERRIDE|	ABSTRACT|	EXTERN | UNSAFE)*
-	;
-return_type
-	:	{LA(2)!=STAR}? VOID
-	|	type
-	;
-member_name
-	:	type_name	// identifier
-					// interface_type DOT identifier 
-	;
-method_body
-	:	block
-	|	SEMI
-	;
-	
-// TODO: insure later that PARAMS is last one and single dimension
-formal_parameter_list
-	:	method_parameter
-		(COMMA method_parameter)*
-	;
-method_parameter
-		// fixed_parameter
-	:	((attributes)? (parameter_direction)? type identifier) =>
-		 (attributes)? 
-		 (parameter_direction)? 
-		  type 
-		  identifier
-		//  parameter_array
-	|	((attributes)? PARAMS array_type identifier) =>
-		 (attributes)? 
-		  PARAMS 
-		  array_type 
-		  identifier
-	;
-parameter_direction
-	:	REF
-	| 	OUT
-	;
-	
-property_declaration
-	:	(attributes)? 
-        property_modifiers 
-        type 
-        type_name    { parser.add(_PROPERTY, this); }
-		LBRACE
-        accessor_declarations 
-		RBRACE
-	;
-property_modifiers
- : 	(	NEW		|	PUBLIC	|	PROTECTED	|	INTERNAL	|	PRIVATE	|	STATIC	
-	|	VIRTUAL	|	SEALED	|	OVERRIDE	|	ABSTRACT	|	EXTERN | UNSAFE
- 	)*
-	;
-// TODO: can't be two gets etc.
-accessor_declarations
-	:	 accessor_declaration (accessor_declaration)?
-	;
-accessor_declaration
-	:	(attributes)? accessor_modifier (block | SEMI)
-	;
-accessor_modifier
-	:	{ LT(1).getText().equals("get") || LT(1).getText().equals("set")}? 
-		identifier		
-	;
-event_declaration
-	:	(attributes)? 
-        event_modifiers 
-		EVENT  { parser.add(_EVENT, this); }
-        type 
-		(	(variable_declarator)+ SEMI
-		|	member_name LBRACE event_accessor_declarations RBRACE
-		)
-	;
-event_modifiers
-	:	(NEW 	 |	PUBLIC 	 |	PROTECTED |	INTERNAL 
-	|	PRIVATE	 |	STATIC 	 |	VIRTUAL   |	SEALED 
-	|	OVERRIDE |	ABSTRACT |	EXTERN | UNSAFE)*
-	;
-// TODO: insure not two PLUS_ASN's etc
-event_accessor_declarations
-	:	 event_accessor_declaration	(event_accessor_declaration)?
-	;
-event_accessor_declaration
-	:	(attributes)? event_accessor_modifiers block
-	;
-event_accessor_modifiers
-	:	{ LT(1).getText().equals("add") || LT(1).getText().equals("remove")}? 
-		identifier		
-	;
-	
-indexer_declaration
-	:	(attributes)? 
-		 indexer_modifiers 
-		 indexer_declarator 
-		LBRACE accessor_declarations RBRACE 
-	;
-indexer_modifiers
-	:	(NEW 	 |	PUBLIC  |	PROTECTED |	INTERNAL  
-	|	PRIVATE  |	VIRTUAL |	SEALED    |	OVERRIDE  
-	|	ABSTRACT |	EXTERN | UNSAFE)*
-	;
-indexer_declarator
-	:	type 
-		(simple_name DOT)?
-		THIS 	{ parser.add(_INDEXER, this); }
-		LBRACK (formal_parameter_list)? RBRACK
-	;
-operator_declaration
-	:	(attributes)? operator_modifiers operator_declarator operator_body 
-	;
-operator_modifiers
-	:	(PUBLIC 	|	STATIC 	|	EXTERN  | UNSAFE)*
-	;
-operator_declarator
-	:	(unary_operator_declarator) 	 => unary_operator_declarator
-	|	(binary_operator_declarator) 	 => binary_operator_declarator
-	|	(conversion_operator_declarator) => conversion_operator_declarator
-	;
-unary_operator_declarator
-	:	type 
-		OPERATOR  { parser.add(_OPERATOR, this); }
-		overloadable_unary_operator 
-		LPAREN 
-		type 
-		identifier 
-		RPAREN 
-	;	
-overloadable_unary_operator
-	:	PLUS	|	MINUS	|	LNOT	|	BNOT	|	STAR 
-	|	INC		|	DEC		|	TRUE	|	FALSE
-	;	
-binary_operator_declarator
-	:	type 
-		OPERATOR  { parser.add(_OPERATOR, this); }
-		overloadable_binary_operator 
-		LPAREN 
-		type 
-		identifier 
-		COMMA 
-		type 
-		identifier 
-		RPAREN
-	;
-	
-overloadable_binary_operator
-	:	PLUS	|	MINUS	|	STAR	|	DIV	|	MOD 
-	|	BAND	|	BOR		|	BXOR	|	SL	|	SR
-	|	EQUAL	|	NOT_EQUAL			
-	|	GTHAN	|	LTHAN
-	|	GE		|	LE
-	;
-conversion_operator_declarator
-	:	conversion_classification 
-		OPERATOR   { parser.add(_OPERATOR, this); }
-		type 
-		LPAREN 
-		type 		
-		identifier 
-		RPAREN
-	;
-conversion_classification
-	:	IMPLICIT | EXPLICIT
-	;
-operator_body
-	:	block
-	|	SEMI
-	; 
-	
-constructor_declaration
-	:	(attributes)? 
-		 constructor_modifiers 
-		 constructor_declarator 
-		 constructor_body
-	;
-		
-constructor_modifiers
-	:	(PUBLIC  |	PROTECTED |	INTERNAL |	PRIVATE  |	EXTERN | UNSAFE)*
-	;
-constructor_declarator
-	:	identifier  { parser.add(_CONSTRUCTOR, this); }
-		LPAREN 
-		(formal_parameter_list)? 
-		RPAREN 
-		(constructor_initializer)?
-	;
-constructor_initializer
-	:	COLON (BASE^ | THIS^ ) LPAREN (argument_list)? RPAREN 
-	;
-constructor_body
-	:	block
-	|	SEMI
-	; 
-static_constructor_declaration
-	:	(attributes)? 
-		 static_constructor_modifiers 
-		 identifier { parser.add(_STATIC_CONSTR, this); } LPAREN RPAREN 
-		 static_constructor_body
-	;
-static_constructor_modifiers
-	:	(EXTERN | STATIC | UNSAFE)*
-	;
-
-static_constructor_body
-	:	block
-	|	SEMI
-	;
-
-destructor_declaration
-	:	(attributes)? 
-		(EXTERN UNSAFE | UNSAFE EXTERN)? 
-		BNOT
-        identifier { parser.add(_DESTRUCTOR, this); } LPAREN RPAREN  
-        destructor_body
-	;
-destructor_body
-	:	block
-	|	SEMI
-	;
-
-
-// ***** A.2.7 Structs *****
-
-struct_declaration
-	:	struct_modifiers
-		(partial_modifier)?
-		STRUCT   { parser.add(_STRUCT_BEGIN, this); }
-		identifier 
-		(struct_interfaces)? 
-        struct_body		
-	;
-struct_modifiers
-	:	(NEW | PUBLIC | PROTECTED | INTERNAL | PRIVATE | UNSAFE)*
-	;
-
-struct_interfaces
-	:	COLON class_type (COMMA class_type)*
-	;
-
-struct_body
-	:	LBRACE (struct_member_declaration)* RBRACE
-        { parser.add(_STRUCT_END, this); }
-	;
-	
-struct_member_declaration	
-	:	(constant_declaration) 		=> constant_declaration
-	|	(field_declaration) 		=> field_declaration
-	|	(method_declaration) 		=> method_declaration 
-	|	(property_declaration) 		=> property_declaration
-	|	(event_declaration) 		=> event_declaration
-	|	(indexer_declaration) 		=> indexer_declaration
-	|	(operator_declaration) 		=> operator_declaration
-	|	(constructor_declaration) 	=> constructor_declaration 
-	|	(static_constructor_declaration) => static_constructor_declaration
-	|	 type_declaration
-	;
-
-
-// ***** A.2.8 Arrays *****
-
-// array_type
-// non_array_type
-// rank_specifiers
-
-array_initializer
-	:	LBRACE 
-		(
-			variable_initializer
-			(
-				options {greedy=true;}: {LA(1)==COMMA && LA(2)!=RBRACE}?
-			 	COMMA variable_initializer
-			)*
-			({LA(1)==COMMA && LA(2)==RBRACE}? COMMA)?
-		)?
-		RBRACE
-	;
-
-
-// ***** A.2.9 Interfaces *****
-
-interface_declaration
-	:	interface_modifiers 
-		(partial_modifier)?
-		INTERFACE   { parser.add(_INTERFACE_BEGIN, this); }
-		identifier 
-		(interface_base)? 
-        interface_body
-	;
-	
-interface_modifiers
-	:	(NEW | PUBLIC | PROTECTED | INTERNAL | PRIVATE | UNSAFE)*
-	;
-interface_base
-	:	COLON class_type (COMMA class_type)* //interface_type_list
-	;
-interface_body
-	:	LBRACE (interface_member_declaration)* RBRACE
-        { parser.add(_INTERFACE_END, this); }
-	;
-interface_member_declaration
-	:	(interface_method_declaration)	=> interface_method_declaration
-	|	(interface_property_declaration)=> interface_property_declaration
-	|	(interface_event_declaration)	=> interface_event_declaration
-	|	(interface_indexer_declaration)	=> interface_indexer_declaration
-	;
-
-interface_method_declaration
-	:	(attributes)? 
-		(NEW)? 
-		return_type 
-		identifier  { parser.add(_METHOD, this); }
-		LPAREN (formal_parameter_list)? RPAREN SEMI
-	;
-interface_property_declaration
-	:	(attributes)? 
-		(NEW)? 
-		type 
-		identifier  { parser.add(_PROPERTY, this); }
-		LBRACE interface_accessors RBRACE
-	;
-interface_accessors
-	:	 (attributes)? accessor_modifier SEMI
-		((attributes)? accessor_modifier SEMI)?
-	;
-interface_event_declaration
-	:	(attributes)? (NEW)? EVENT { parser.add(_EVENT, this); }
-        type identifier SEMI 
-	;
-interface_indexer_declaration
-	:	(attributes)? (NEW)? type THIS { parser.add(_INDEXER, this); }
-		LBRACK (formal_parameter_list)? RBRACK 
-		LBRACE interface_accessors RBRACE 
-	;
-
-	
-// ***** A.2.10 Enums *****
-
-enum_declaration
-	:	 enum_modifiers 
-		ENUM    { parser.add(_ENUM, this); }
-		 identifier 
-		(enum_base)? 
-		 enum_body	
-	;
-	
-enum_base
-	:	COLON integral_type
-	;
-
-enum_body
-	:	(LBRACE (enum_member_declaration  (COMMA enum_member_declaration)* )? COMMA RBRACE) =>
-		 LBRACE (enum_member_declaration (COMMA enum_member_declaration)* )? COMMA RBRACE
-	|	 LBRACE (enum_member_declaration (COMMA enum_member_declaration)* )? RBRACE
-	;
-	
-enum_modifiers
-	:	(NEW | PUBLIC | PROTECTED | INTERNAL | PRIVATE)*
-	;
-
-enum_member_declaration
-	:	(attributes)? identifier (ASSIGN constant_expression)?  
-	;
-
-
-// ***** A.2.11 Delegates *****
-
-delegate_declaration
-	:	delegate_modifiers
-		DELEGATE    { parser.add(_DELEGATE, this); }
-		return_type  // note: this must include VOID (vs C# spec, 'type')
-		identifier 
-		LPAREN (formal_parameter_list)?	RPAREN
-	;
-		 
-delegate_modifiers
-	:	(NEW | PUBLIC | PROTECTED | INTERNAL | PRIVATE | UNSAFE)*
-	;
-
-
-
-// ***** A.2.12 Attributes *****
-
-global_attributes
-	:	LBRACK "assembly" COLON attribute_list RBRACK
-	;
-
-attributes
-	:	(attribute_section)+
-		//{ #attributes = #( [ATTRIBUTE_DEF], as); }
-	;
-	
-attribute_section
-	:	LBRACK (attribute_target COLON)? attribute_list RBRACK  
-	;
-
-attribute_target
-	:	FIELD
-	|	EVENT
-	|	METHOD
-	|	MODULE
-	|	PARAM
-	|	PROPERTY
-	|	RETURN 
-	|	TYPE 
-	;
-
-attribute_list
-	:	(attribute (COMMA attribute)* COMMA) => 
-		 attribute (COMMA attribute)* COMMA
-	|	 attribute (COMMA attribute)*
-	;
-
-attribute
-	:	type_name { parser.add(_ATTRIBUTE, this); }
-        (attribute_arguments)?
-	;
-
-// args must be positional, then named - not mixed
-// (x=5) can be positional, but not x=5 
-// TODO: must enforce (2,4,x=5,y=6) order 
-attribute_arguments
-	:	LPAREN (attribute_argument_list)? RPAREN
-	;
-	
- // an expression can be an expression_list
-attribute_argument_list
-	:	expression (COMMA expression)* 
-	;
-	
-/* // unused for now
-positional_argument_list
-	:	expression (COMMA expression)* 
-		{#positional_argument_list = #( #[Args], #positional_argument_list);}
-	;
-
-// unused for now
-named_argument_list
-	:	identifier ASSIGN expression (COMMA identifier ASSIGN expression)*
-	;
-*/	
-
-
-// ***** A.3 Grammar extensions for unsafe code *****
-// added where needed
-	
-	
-// =======================================================
-// == LEXER ==============================================
-// =======================================================
-	
-class CSharpLexer extends Lexer;
-
-options 
-{
-	k=4;                       // four characters of lookahead
-	// Allow any char but \uFFFF (16 bit -1 == CharParser.EOF .....)
-	charVocabulary='\u0003'..'\uFFFE';
-	exportVocab=CSharp;
-	testLiterals=false;
-}
-
-	
-// ***** A.1.7 Keywords *****
-tokens
-{
-	ABSTRACT	=	"abstract";			LONG		=	"long";
-	AS			=	"as";				NAMESPACE	=	"namespace";
-	BASE		=	"base";				NEW			=	"new";
-	BOOL		=	"bool";				NULL		=	"null";
-	BREAK		=	"break";			OBJECT		=	"object";
-	BYTE		=	"byte";				OPERATOR	=	"operator";
-	CASE		=	"case";				OUT			=	"out";
-	CATCH		=	"catch";			OVERRIDE	=	"override";
-	CHAR		=	"char";				PARAMS		=	"params";
-	CHECKED		=	"checked";			PRIVATE		=	"private";
-	CLASS		=	"class";			PROTECTED	=	"protected";
-	CONST		=	"const";			PUBLIC		=	"public";
-	CONTINUE	=	"continue";			READONLY	=	"readonly";
-	DECIMAL		=	"decimal";			REF			=	"ref";
-	DEFAULT		=	"default";			RETURN		=	"return";
-	DELEGATE	=	"delegate";			SBYTE		=	"sbyte";
-	DO			=	"do";				SEALED		=	"sealed";
-	DOUBLE		=	"double";			SHORT		=	"short";
-	ELSE		=	"else";				SIZEOF		=	"sizeof";
-	ENUM		=	"enum";				STACKALLOC	=	"stackalloc";
-	EVENT		=	"event";			STATIC		=	"static";
-	EXPLICIT	=	"explicit";			STRING		=	"string";
-	EXTERN		=	"extern";			STRUCT		=	"struct";
-	FALSE		=	"false";			SWITCH		=	"switch";
-	FINALLY		=	"finally";			THIS		=	"this";
-	FIXED		=	"fixed";			THROW		=	"throw";
-	FLOAT		=	"float";			TRUE		=	"true";
-	FOR			=	"for";				TRY			=	"try";
-	FOREACH		=	"foreach";			TYPEOF		=	"typeof";
-	GOTO		=	"goto";				UINT		=	"uint";
-	IF			=	"if";				ULONG		=	"ulong";
-	IMPLICIT	=	"implicit";			UNCHECKED	=	"unchecked";
-	IN			=	"in";				UNSAFE		=	"unsafe";
-	INT			=	"int";				USHORT		=	"ushort";
-	INTERFACE	=	"interface";		USING		=	"using";
-	INTERNAL	=	"internal";			VIRTUAL		=	"virtual";
-	IS			=	"is";				VOID		=	"void";
-	LOCK		=	"lock";				WHILE		=	"while";
-//	GET			=	"get";				SET			=	"set";
-//	ADD			=	"add";				REMOVE		=	"remove";
-}
-
-
-// ***** Lexical Grammar *****
-/*
-Input
-	:	(Input_section)*
-	;
-Input_section
-	:	(Input_element)*   New_line
-	;
-Input_element
-	:	Whitespace
-	|	Comment
-	|	Token
-	;
-*/
-// ***** A.1.1 LINE TERMINATORS *****
-protected
-NEW_LINE
-	:	(	// carriage return character followed by possible line feed character	
-			{ LA(2)=='\n' }? '\r' '\n'			
-		|	'\r'			// line feed character							
-		|	'\n'			// line feed character							
-		|	'\u2028'			// line separator character
-		|	'\u2029'			// paragraph separator character 
-		)
-		{newline();}
-	;
-	
-protected
-NEW_LINE_CHARACTER
-	:	('\r' | '\n' | '\u2028' | '\u2029')
-	;
-	
-protected
-NOT_NEW_LINE
-	:	~( '\r' | '\n' | '\u2028' | '\u2029')
-	;
-	
-	
-// ***** A.1.2 WHITESPACE *****
-WHITESPACE
-	:	(	' '
-		|	'\u0009' // horizontal tab character
-		|	'\u000B' // vertical tab character
-		|	'\u000C' // form feed character 
-		|	NEW_LINE 
-		)+
-		{ _ttype = Token.SKIP; }
-	;	
-	
-	
-// ***** A.1.3 COMMENTS *****
-SINGLE_LINE_COMMENT
-	:	"//" 
-		(NOT_NEW_LINE)* 
-		(NEW_LINE)?
-		{_ttype = Token.SKIP;}
-	;
-	
-DELIMITED_COMMENT
-	:	"/*"  
-		(	{ LA(2)!='/' }? '*'
-		|	NEW_LINE		
-		|	~('*'|'\r'|'\n'|'\u2028'|'\u2029')
-		)*
-		"*/"
-		{ _ttype = Token.SKIP; }
-	;	
-
-/*	
-// ***** A.1.4 TOKENS *****
-TOKEN
-	:	identifier
-	|	KEYWORD
-	|	INTEGER_LITERAL
-	|	REAL_LITERAL
-	|	CHARACTER_LITERAL
-	|	STRING_LITERAL
-	|	OPERATOR_OR_PUNCTUATOR
-	;
-*/	
-	
-// ***** A.1.5 UNICODE character escape sequences *****
-UNICODE_ESCAPE_SEQUENCE
-	:	('\\' 'u'   HEX_DIGIT   HEX_DIGIT   HEX_DIGIT  HEX_DIGIT)
-	|	('\\' 'U'   HEX_DIGIT   HEX_DIGIT   HEX_DIGIT  HEX_DIGIT  
-					HEX_DIGIT   HEX_DIGIT   HEX_DIGIT  HEX_DIGIT)
-	;
-
-// ***** A.1.6 IDENTIFIERS *****
-
-IDENTIFIER
-options { testLiterals=true; }
-	:	IDENTIFIER_START_CHARACTER (IDENTIFIER_PART_CHARACTER)*
-//	|	'@' (IDENTIFIER_PART_CHARACTER)*
-	;
-	
-protected
-IDENTIFIER_START_CHARACTER
-	:	('a'..'z'|'A'..'Z'|'_'|'$') //|'@') //TODO: identifier literals can have starting @
-	;
-	
-protected
-IDENTIFIER_PART_CHARACTER
-	:	('a'..'z'|'A'..'Z'|'_'|'0'..'9'|'$') 
-	;
-	
-// ***** A.1.8 LITERALS *****
-
-/* // move to parser - TODO: look into this...
-
-BOOLEAN_LITERAL
-	:	TRUE
-	|	FALSE
-	;
-NULL_LITERAL
-	:	NULL
-	;
-*/
-
-NUMERIC_LITERAL
-
-	// real
-	:	('.' DECIMAL_DIGIT) =>
-		 '.' (DECIMAL_DIGIT)+ (EXPONENT_PART)? (REAL_TYPE_SUFFIX)?
-		{$setType(REAL_LITERAL);}
-			
-	|	((DECIMAL_DIGIT)+ '.' DECIMAL_DIGIT) =>
-		 (DECIMAL_DIGIT)+ '.' (DECIMAL_DIGIT)+ (EXPONENT_PART)? (REAL_TYPE_SUFFIX)?
-		{$setType(REAL_LITERAL);}
-		
-	|	((DECIMAL_DIGIT)+ (EXPONENT_PART)) =>
-		 (DECIMAL_DIGIT)+ (EXPONENT_PART) (REAL_TYPE_SUFFIX)?
-		{$setType(REAL_LITERAL);}
-		
-	|	((DECIMAL_DIGIT)+ (REAL_TYPE_SUFFIX)) =>
-		 (DECIMAL_DIGIT)+ (REAL_TYPE_SUFFIX)		
-		{$setType(REAL_LITERAL);}
-		 
-	// integer
-	|	 (DECIMAL_DIGIT)+ (INTEGER_TYPE_SUFFIX)?	
-		{$setType(INTEGER_LITERAL);}
-	
-	// just a dot
-	| '.'{$setType(DOT);}
-	;
-
-	
-HEXADECIMAL_INTEGER_LITERAL
-	:	"0x"   (HEX_DIGIT)+   (INTEGER_TYPE_SUFFIX)?
-	|	"0X"   (HEX_DIGIT)+   (INTEGER_TYPE_SUFFIX)?
-	;
-
-CHARACTER_LITERAL
-	:	"'"!   CHARACTER   "'"!
-	;	
-
-STRING_LITERAL
-	:	REGULAR_STRING_LITERAL
-	|	VERBATIM_STRING_LITERAL
-	;
-
-	
-// ===== literal (protected) helpers ============
-
-// nums
-protected
-DECIMAL_DIGIT
-	: 	'0'	|	'1'	|	'2'	|	'3'	|	'4'	|	'5'	|	'6'	|	'7'	|	'8'	|	'9'
-	;
-protected	
-INTEGER_TYPE_SUFFIX
-	:
-	(	options {generateAmbigWarnings=false;}
-		:	"UL"	| "LU" 	| "ul"	| "lu"
-		|	"UL"	| "LU" 	| "uL"	| "lU"
-		|	"U"		| "L"	| "u"	| "l"
-	)
-	;
-		
-protected
-HEX_DIGIT
-	:	'0' | '1' | '2' | '3' | '4' | '5' | '6' | '7' | '8' | '9' | 
-		'A' | 'B' | 'C' | 'D' | 'E' | 'F'  |
-		'a' | 'b' | 'c' | 'd' | 'e' | 'f'
-	;	
-	
-protected	
-EXPONENT_PART
-	:	"e"  (SIGN)*  (DECIMAL_DIGIT)+
-	|	"E"  (SIGN)*  (DECIMAL_DIGIT)+
-	;	
-	
-protected
-SIGN
-	:	'+' | '-'
-	;
-	
-protected
-REAL_TYPE_SUFFIX
-	: 'F' | 'f' | 'D' | 'd' | 'M' | 'm'
-	;
-
-// chars
-protected
-CHARACTER
-	:	SINGLE_CHARACTER
-	|	SIMPLE_ESCAPE_SEQUENCE
-	|	HEXADECIMAL_ESCAPE_SEQUENCE
-	|	UNICODE_ESCAPE_SEQUENCE
-	;
-
-protected
-SINGLE_CHARACTER
-	:	 ~( '\'' | '\\' | '\r' | '\n' | '\u2028' | '\u2029')
-	;
-	
-protected
-SIMPLE_ESCAPE_SEQUENCE
-	:	"\\'" | "\\\"" | "\\\\" | "\\0" | "\\a"  
-	|	"\\b" | "\\f"  | "\\n"  | "\\r" | "\\t" | "\\v"
-	;
-	
-protected	
-HEXADECIMAL_ESCAPE_SEQUENCE	
-	:	('\\' 'x' HEX_DIGIT)
-		( options {warnWhenFollowAmbig = false;}: 
-		HEX_DIGIT 
-			( options {warnWhenFollowAmbig = false;}:
-			HEX_DIGIT 
-				( options {warnWhenFollowAmbig = false;}:
-				HEX_DIGIT
-				)?
-			)?
-		)? // oh antlr syntax
-	;
-
-// strings
-protected	
-REGULAR_STRING_LITERAL
-	:	'\"'!   
-		(	rs:REGULAR_STRING_LITERAL_CHARACTER
-		)*   
-		'\"'!
-	;
-	
-protected	
-REGULAR_STRING_LITERAL_CHARACTER
-	:	SINGLE_REGULAR_STRING_LITERAL_CHARACTER
-	|	SIMPLE_ESCAPE_SEQUENCE
-	|	HEXADECIMAL_ESCAPE_SEQUENCE
-	|	UNICODE_ESCAPE_SEQUENCE
-	;
-	
-protected	
-SINGLE_REGULAR_STRING_LITERAL_CHARACTER
-	:	 ~( '\"' | '\\' | '\r' | '\n' | '\u2028' | '\u2029')
-	;
-	
-protected	
-VERBATIM_STRING_LITERAL
-{String s="";}
-	:	 '@' "\""  	
-		(	"\"\""				{s+=("\"");}
-		|	"\\"				{s+=("\\\\");}
-		|	ch:~('\"' | '\\')	{s+=(ch);}
-		)* 
-		"\""	
-		{$setText(s);}
-	;
-			
-	
-// ***** A.1.9 Operators and punctuators *****
-/*
-Operator_or_punctuator
-	:	'{'	|	'}'	|	'['	|	']'	|	'('	|	')'	|			','	|	':'	|	';'
-	|	'+'	|	'-'	|	'*'	|	'/'	|	'%'	|	'&'	|	'|'	|	'^'	|	'!'	|	'~'
-	|	'='	|	'<'	|	'>'	|	'?'	|	"++"|	"--"|	"&&"|	"||"|	"<<"|	">>"
-	|	"=="|	"!="|	"<="|	">="|	"+="|	"-="|	"*="|	"/="|	"%="|	"&="
-	|	"|="|	"^="| "<<="	| ">>=" |	"->"
-	;
-*/
-LBRACE		:	'{'		;	RBRACE		:	'}'		;
-LBRACK		:	'['		;	RBRACK		:	']'		;
-LPAREN		:	'('		;	RPAREN		:	')'		;
-
-
-PLUS		:	'+'		;	PLUS_ASN	:	"+="	;	
-MINUS		:	'-'		;	MINUS_ASN	:	"-="	;	
-STAR		:	'*'		;	STAR_ASN	:	"*="	;
-DIV			:	'/'		;	DIV_ASN		:	"/="	;
-MOD			:	'%'		;	MOD_ASN		:	"%="	;
-INC			:	"++"	;	DEC			:	"--"	;
-
-SL			:	"<<"	;	SL_ASN		:	"<<="	;
-SR			:	">>"	;	SR_ASN		:	">>="	;
-BSR			:	">>>"	;	BSR_ASN		:	">>>="	;
-
-BAND		:	'&'		;	BAND_ASN	:	"&="	;	
-BOR			:	'|'		;	BOR_ASN		:	"|="	;	
-BXOR		:	'^'		;	BXOR_ASN	:	"^="	;
-BNOT		:	'~'		;
-
-ASSIGN		:	'='		;	EQUAL		:	"=="	;
-LTHAN		:	'<'		;	LE			:	"<="	;
-GTHAN		:	">"		;	GE			:	">="	;
-LNOT		:	'!'		;	NOT_EQUAL	:	"!="	;
-LOR			:	"||"	;	LAND		:	"&&"	;
-
-COMMA		:	','		;	COLON		:	':'		;	
-SEMI		:	';'		;
-QUOTE		:	"\""    ;	QUESTION	:	'?'		;
-
-ARROW		:	"->"	;
-
-
-// ***** A.1.10 Pre_processing directives *****
-
-// ignore all pp directives
-PP_DIRECTIVE
-	:	"#" (NOT_NEW_LINE)* (NEW_LINE)? { _ttype = Token.SKIP; }
-	;
-
-/*protected	
-PP_NEW_LINE
-	:	(SINGLE_LINE_COMMENT | NEW_LINE_CHARACTER)
-	;
-protected	
-PP_WHITESPACE
-	:	(	' '
-		|	'\u0009' // horizontal tab character
-		|	'\u000B' // vertical tab character
-		|	'\u000C' // form feed character 
-		)+
-		{ _ttype = Token.SKIP; }
-	;
-
-PP_DIRECTIVE
-	:	 HASH (PP_WHITESPACE)?
-		(	dc:PP_DECLARATION//{System.out.println("===>decl: "+dc.getText());}
-		| 	(PPT_REGION || PPT_END_REGION) => rg:PP_REGION	 //{System.out.println("===>regn: "+rg.getText());}
-		|	PP_CONDITIONAL
-//		|	PP_LINE
-//		|	PP_DIAGNOSTIC
-		)
-	{ _ttype = Token.SKIP; }
-	;
-protected	
-PP_DECLARATION
-	:	(PPT_DEFINE | PPT_UNDEF) PP_WHITESPACE CONDITIONAL_SYMBOL (PP_WHITESPACE)? PP_NEW_LINE
-	;
-protected	
-PP_REGION
-	:	(PPT_REGION | PPT_END_REGION) PP_MESSAGE	
-	;
-protected
-PP_MESSAGE
-	:	(NOT_NEW_LINE)* NEW_LINE?
-	;
-protected
-CONDITIONAL_SYMBOL
-	:	IDENTIFIER_START_CHARACTER (IDENTIFIER_PART_CHARACTER)*
-	;
-protected
-PPT_DEFINE
-	:	"define"
-	;
-protected
-PPT_UNDEF
-	:	"undef"
-	;
-protected
-PPT_REGION
-	:	"region"
-	;
-protected
-PPT_END_REGION
-	:	"endregion"
-	;
-
-protected	
-PP_CONDITIONAL
-	:	PP_IF_SECTION
-	|	PP_ELIF_SECTION
-	|	PP_ELSE_SECTION
-	|	PP_ENDIF
-	;
-protected	
-PP_IF_SECTION
-	:	PPT_IF PP_WHITESPACE PP_EXPRESSION PP_NEW_LINE // (CONDITIONAL_SECTION)?
-	;
-protected
-PP_ELIF_SECTION
-	:	PPT_ELIF PP_WHITESPACE PP_EXPRESSION PP_NEW_LINE // (CONDITIONAL_SECTION)?
-	;
-protected
-PP_ELSE_SECTION
-	:	PPT_ELSE (PP_WHITESPACE)? PP_NEW_LINE // (CONDITIONAL_SECTION)?
-	;
-protected
-PP_ENDIF
-	:	PPT_ENDIF (PP_WHITESPACE)? PP_NEW_LINE
-	;
-	
-protected	
-PP_EXPRESSION  
-	:	PP_OR_EXPRESSION
-	;
-
-protected	
-PP_OR_EXPRESSION
-	:	PP_AND_EXPRESSION (LOR (PP_WHITESPACE)? PP_AND_EXPRESSION)*
-	;
-protected	
-PP_AND_EXPRESSION
-	:	PP_EQUALITY_EXPRESSION (LAND (PP_WHITESPACE)? PP_EQUALITY_EXPRESSION)*
-	;
-protected	
-PP_EQUALITY_EXPRESSION
-	:	PP_UNARY_EXPRESSION ((EQUAL | NOT_EQUAL) (PP_WHITESPACE)? PP_UNARY_EXPRESSION)*
-	;
-protected	
-PP_UNARY_EXPRESSION
-	:	//PP_PRIMARY_EXPRESSION (LNOT PP_PRIMARY_EXPRESSION)?
-	(LNOT (PP_WHITESPACE)?)* PP_PRIMARY_EXPRESSION
-	;
-
-protected	
-PP_PRIMARY_EXPRESSION
-	:	((PPT_TRUE)=>PPT_TRUE 		{System.out.println("  ===>true ");}
-	|	(PPT_FALSE)=>PPT_FALSE 		{System.out.println("  ===>false ");}
-	|	LPAREN
-		(PP_WHITESPACE)?
-		ex:PP_EXPRESSION 
-		RPAREN 						{System.out.println("  ===>expr "+ex.getText());}
-	|	cs:CONDITIONAL_SYMBOL 		{System.out.println("  ===>symbol "+cs.getText());}
-	) (PP_WHITESPACE)?
-	;
-
-	
-protected
-PPT_IF
-	:	"if"
-	;
-protected
-PPT_ELIF
-	:	"elif"
-	;
-protected
-PPT_ELSE
-	:	"else"
-	;
-protected
-PPT_ENDIF
-	:	"endif"
-	;
-protected
-PPT_TRUE
-	:	"true"
-	;
-protected
-PPT_FALSE
-	:	"false"
-	;*/
-
-// =======================================================
-// == TREE WALKER ========================================
-// =======================================================
-
-// TODO: treewalker: move AST to non antlr code dom structure (must be cls compliant).	
-class CSharpTreeWalker extends TreeParser;
-compilation_unit returns [String s]
-{
-//	string tabs = "\t\t\t";
-	s = "";
-}	
-	:	((any:.) 
-//		{	int tabCount = 3-((int)(any.getText().Length / 8)); 
-//			s += "\n"+any.getText()+tabs.Substring(3-tabCount)+any.Type;}
-		)*
-	{return s;}
-	;
-	
-	
-	
-	

+ 0 - 69
jplag.frontend.csharp-1.2/src/main/java/de/jplag/csharp/CSharpToken.java

@@ -1,69 +0,0 @@
-package de.jplag.csharp;
-
-import de.jplag.Token;
-
-public class CSharpToken extends Token implements CSharpTokenConstants {
-
-    public CSharpToken(int type, String file, int line, int column, int length) {
-        super(type, file, line, column, length);
-    }
-
-    protected String type2string() {
-        return switch (type) {
-            case CSharpTokenConstants.FILE_END -> "EOF";
-            case _INVOCATION -> "INVOCATION";
-            case _OBJECT_CREATION -> "OBJECT_CRE";
-            case _ARRAY_CREATION -> "ARRAY_CREA";
-            case _ASSIGNMENT -> "ASSIGNMENT";
-            case _L_BRACE -> "L_BRACE { ";
-            case _R_BRACE -> "R_BRACE } ";
-            case _DECLARE_VAR -> "DECLAREVAR";
-            case _DECLARE_CONST -> "DECLARE_CO";
-            case _IF -> "IF {      ";
-            case _ELSE -> "ELSE      ";
-            case _END_IF -> "IF }      ";
-            case _SWITCH_BEGIN -> "SWITCH {  ";
-            case _SWITCH_END -> "SWITCH }  ";
-            case _CASE -> "CASE      ";
-            case _DO -> "DO        ";
-            case _WHILE -> "WHILE     ";
-            case _FOR -> "FOR       ";
-            case _FOREACH -> "FOREACH   ";
-            case _BREAK -> "BREAK     ";
-            case _CONTINUE -> "CONTINUE  ";
-            case _GOTO -> "GOTO      ";
-            case _RETURN -> "RETURN    ";
-            case _THROW -> "THROW     ";
-            case _CHECKED -> "CHECKED   ";
-            case _UNCHECKED -> "UNCHECKED ";
-            case _LOCK -> "LOCK      ";
-            case _USING -> "USING     ";
-            case _TRY -> "TRY       ";
-            case _CATCH -> "CATCH     ";
-            case _FINALLY -> "FINALLY   ";
-            case _NAMESPACE_BEGIN -> "NAMESPACE{";
-            case _NAMESPACE_END -> "NAMESPACE}";
-            case _USING_DIRECTIVE -> "USING_DIR ";
-            case _CLASS_BEGIN -> "CLASS {   ";
-            case _CLASS_END -> "CLASS }   ";
-            case _METHOD -> "METHOD    ";
-            case _PROPERTY -> "PROPERTY  ";
-            case _EVENT -> "EVENT     ";
-            case _INDEXER -> "INDEXER   ";
-            case _OPERATOR -> "OPERATOR  ";
-            case _CONSTRUCTOR -> "CONSTR    ";
-            case _STATIC_CONSTR -> "ST_CONSTR ";
-            case _DESTRUCTOR -> "DESTRUCTOR";
-            case _STRUCT_BEGIN -> "STRUCT {  ";
-            case _STRUCT_END -> "STRUCT }  ";
-            case _INTERFACE_BEGIN -> "INTERFACE{";
-            case _INTERFACE_END -> "INTERFACE}";
-            case _ENUM -> "ENUM      ";
-            case _DELEGATE -> "DELEGATE  ";
-            case _ATTRIBUTE -> "ATTRIBUTE ";
-            case _UNSAFE -> "UNSAFE    ";
-            case _FIXED -> "FIXED     ";
-            default -> "<UNKNOWN> ";
-        };
-    }
-}

+ 0 - 60
jplag.frontend.csharp-1.2/src/main/java/de/jplag/csharp/CSharpTokenConstants.java

@@ -1,60 +0,0 @@
-package de.jplag.csharp;
-
-import de.jplag.TokenConstants;
-
-public interface CSharpTokenConstants extends TokenConstants {
-    int _INVOCATION = 2;
-    int _OBJECT_CREATION = 3;
-    int _ARRAY_CREATION = 4;
-    int _ASSIGNMENT = 5;
-    int _L_BRACE = 6;
-    int _R_BRACE = 7;
-    int _DECLARE_VAR = 8;
-    int _DECLARE_CONST = 9;
-    int _IF = 10;
-    int _ELSE = 11;
-    int _SWITCH_BEGIN = 12;
-    int _SWITCH_END = 13;
-    int _CASE = 14;
-    int _DO = 15;
-    int _WHILE = 16;
-    int _FOR = 17;
-    int _FOREACH = 18;
-    int _BREAK = 19;
-    int _CONTINUE = 20;
-    int _GOTO = 21;
-    int _RETURN = 22;
-    int _THROW = 23;
-    int _CHECKED = 24;
-    int _UNCHECKED = 25;
-    int _LOCK = 26;
-    int _USING = 27;
-    int _TRY = 28;
-    int _CATCH = 29;
-    int _FINALLY = 30;
-    int _NAMESPACE_BEGIN = 31;
-    int _NAMESPACE_END = 32;
-    int _USING_DIRECTIVE = 33;
-    int _CLASS_BEGIN = 34;
-    int _CLASS_END = 35;
-    int _METHOD = 36;
-    int _PROPERTY = 37;
-    int _EVENT = 38;
-    int _INDEXER = 39;
-    int _OPERATOR = 40;
-    int _CONSTRUCTOR = 41;
-    int _STATIC_CONSTR = 42;
-    int _DESTRUCTOR = 43;
-    int _STRUCT_BEGIN = 44;
-    int _STRUCT_END = 45;
-    int _INTERFACE_BEGIN = 46;
-    int _INTERFACE_END = 47;
-    int _ENUM = 48;
-    int _DELEGATE = 49;
-    int _ATTRIBUTE = 50;
-    int _END_IF = 51;
-    int _UNSAFE = 52;
-    int _FIXED = 53;
-
-    int NUM_DIFF_TOKENS = 54;
-}

+ 0 - 74
jplag.frontend.csharp-1.2/src/main/java/de/jplag/csharp/Parser.java

@@ -1,74 +0,0 @@
-package de.jplag.csharp;
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.nio.charset.StandardCharsets;
-
-import antlr.Token;
-
-import de.jplag.AbstractParser;
-import de.jplag.ErrorConsumer;
-import de.jplag.TokenList;
-import de.jplag.csharp.grammar.CSharpLexer;
-import de.jplag.csharp.grammar.CSharpParser;
-
-public class Parser extends AbstractParser {
-    private TokenList tokens;
-    private String currentFile;
-
-    /**
-     * Creates the parser.
-     * @param errorConsumer is the consumer for any occurring errors.
-     */
-    public Parser(ErrorConsumer errorConsumer) {
-        super(errorConsumer);
-    }
-
-    public TokenList parse(File directory, String[] files) {
-        tokens = new TokenList();
-        errors = 0;
-        for (int i = 0; i < files.length; i++) {
-            if (!parseFile(directory, files[i]))
-                errors++;
-            tokens.addToken(new CSharpToken(CSharpTokenConstants.FILE_END, files[i], -1, -1, -1));
-        }
-        return tokens;
-    }
-
-    private boolean parseFile(File dir, String file) {
-        try {
-            FileInputStream input = new FileInputStream(new File(dir, file));
-            currentFile = file;
-            // Create a scanner that reads from the input stream passed to us
-            CSharpLexer lexer = new CSharpLexer(new UnicodeReader(input, StandardCharsets.UTF_8));
-            lexer.setFilename(file);
-            lexer.setTabSize(1);
-
-            // Create a parser that reads from the scanner
-            CSharpParser parser = new CSharpParser(lexer);
-            parser.setFilename(file);
-            parser.parser = this;// Added by emeric 22.01.05
-            // start parsing at the compilationUnit rule
-            parser.compilation_unit();
-
-            // close file
-            input.close();
-        } catch (Exception e) {
-            getErrorConsumer().addError("  Parsing Error in '" + file + "':\n  " + e.toString());
-            return false;
-        }
-        return true;
-    }
-
-    private void add(int type, Token token) {
-        if (token == null) {
-            System.out.println("tok == null  ERROR!");
-            return;
-        }
-        tokens.addToken(new CSharpToken(type, currentFile, token.getLine(), token.getColumn(), token.getText().length()));
-    }
-
-    public void add(int type, CSharpParser parser) {
-        add(type, parser.getLastConsumedToken());
-    }
-}

+ 0 - 113
jplag.frontend.csharp-1.2/src/main/java/de/jplag/csharp/UnicodeReader.java

@@ -1,113 +0,0 @@
-package de.jplag.csharp;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.io.PushbackInputStream;
-import java.io.Reader;
-import java.nio.charset.Charset;
-import java.nio.charset.StandardCharsets;
-import java.util.Objects;
-
-/**
- * Generic unicode text reader, which will use BOM mark to identify the encoding to be used. If BOM is not found then
- * use a given default encoding. UTF-8 is used if: BOM mark is not found and defaultEnc is NULL. Usage pattern:
- *
- * <pre>
- * String defaultEnc = "UTF-16BE"; // or NULL to use system default
- * FileInputStream fis = new FileInputStream(file);
- * Reader in = new UnicodeReader(fis, defaultEnc);
- * 
- * Original pseudocode   : Thomas Weidenfeller
- * Implementation tweaked: Aki Nieminen
- *
- * http://www.unicode.org/unicode/faq/utf_bom.html
- * BOMs:
- * 00 00 FE FF    = UTF-32, big-endian
- * FF FE 00 00    = UTF-32, little-endian
- * FE FF          = UTF-16, big-endian
- * FF FE          = UTF-16, little-endian
- * EF BB BF       = UTF-8
- *
- * Win2k Notepad:
- * Unicode format = UTF-16LE
- * </pre>
- */
-public class UnicodeReader extends Reader {
-    private final PushbackInputStream internalIn;
-
-    private InputStreamReader internalIn2 = null;
-
-    private final Charset defaultEnc;
-
-    private static final int BOM_SIZE = 4;
-
-    public UnicodeReader(InputStream in, Charset defaultEnc) {
-        internalIn = new PushbackInputStream(in, BOM_SIZE);
-        this.defaultEnc = defaultEnc;
-    }
-
-    public Charset getDefaultEncoding() {
-        return defaultEnc;
-    }
-
-    public String getEncoding() {
-        if (internalIn2 == null)
-            return null;
-        return internalIn2.getEncoding();
-    }
-
-    /**
-     * Read-ahead four bytes and check for BOM marks. Extra bytes are unread back to the stream, only BOM bytes are skipped.
-     */
-    private void init() throws IOException {
-        if (internalIn2 != null)
-            return;
-
-        Charset encoding;
-        byte[] bom = new byte[BOM_SIZE];
-        int n, unread;
-        n = internalIn.read(bom, 0, bom.length);
-
-        if ((bom[0] == (byte) 0xEF) && (bom[1] == (byte) 0xBB) && (bom[2] == (byte) 0xBF)) {
-            encoding = StandardCharsets.UTF_8;
-            unread = n - 3;
-        } else if ((bom[0] == (byte) 0xFE) && (bom[1] == (byte) 0xFF)) {
-            encoding = StandardCharsets.UTF_16BE;
-            unread = n - 2;
-        } else if ((bom[0] == (byte) 0xFF) && (bom[1] == (byte) 0xFE)) {
-            encoding = StandardCharsets.UTF_16LE;
-            unread = n - 2;
-        } else if ((bom[0] == (byte) 0x00) && (bom[1] == (byte) 0x00) && (bom[2] == (byte) 0xFE) && (bom[3] == (byte) 0xFF)) {
-            encoding = Charset.forName("UTF-32BE");
-            unread = n - 4;
-        }
-        // TODO WARNING: This line will evaluate always to false. Maybe that's an issue
-        else if ((bom[0] == (byte) 0xFF) && (bom[1] == (byte) 0xFE) && (bom[2] == (byte) 0x00) && (bom[3] == (byte) 0x00)) {
-            encoding = Charset.forName("UTF-32LE");
-            unread = n - 4;
-        } else {
-            // Unicode BOM mark not found, unread all bytes
-            encoding = defaultEnc;
-            unread = n;
-        }
-
-        if (unread > 0)
-            internalIn.unread(bom, (n - unread), unread);
-
-        // Use given encoding
-        internalIn2 = new InputStreamReader(internalIn, Objects.requireNonNullElse(encoding, StandardCharsets.UTF_8));
-    }
-
-    @Override
-    public void close() throws IOException {
-        init();
-        internalIn2.close();
-    }
-
-    @Override
-    public int read(char[] cbuf, int off, int len) throws IOException {
-        init();
-        return internalIn2.read(cbuf, off, len);
-    }
-}

+ 8 - 14
jplag.frontend.csharp-1.2/pom.xml → jplag.frontend.csharp-6/pom.xml

@@ -6,34 +6,28 @@
         <artifactId>aggregator</artifactId>
         <version>${revision}</version>
     </parent>
-    <artifactId>csharp-1.2</artifactId>
+    <artifactId>csharp-6</artifactId>
 
     <dependencies>
-        <dependency>
-            <groupId>antlr</groupId>
-            <artifactId>antlr</artifactId>
-        </dependency>
         <dependency>
             <groupId>de.jplag</groupId>
             <artifactId>frontend-utils</artifactId>
         </dependency>
+        <dependency>
+            <groupId>org.antlr</groupId>
+            <artifactId>antlr4-runtime</artifactId>
+        </dependency>
     </dependencies>
 
     <build>
         <plugins>
             <plugin>
-                <groupId>org.codehaus.mojo</groupId>
-                <artifactId>antlr-maven-plugin</artifactId>
-                <configuration>
-                    <!-- Comma separated list of grammar files or pattern grammar files 
-						By default, grammar file(s) is in ${basedir}/src/main/antlr -->
-                    <grammars>csharp.g</grammars>
-                    <!-- <grammars>*.g</grammars> -->
-                </configuration>
+                <groupId>org.antlr</groupId>
+                <artifactId>antlr4-maven-plugin</artifactId>
                 <executions>
                     <execution>
                         <goals>
-                            <goal>generate</goal>
+                            <goal>antlr4</goal>
                         </goals>
                     </execution>
                 </executions>

+ 1058 - 0
jplag.frontend.csharp-6/src/main/antlr4/de/jplag/csharp/grammar/CSharpLexer.g4

@@ -0,0 +1,1058 @@
+// Eclipse Public License - v 1.0, http://www.eclipse.org/legal/epl-v10.html
+// Copyright (c) 2013, Christian Wulf (chwchw@gmx.de)
+// Copyright (c) 2016-2017, Ivan Kochurkin (kvanttt@gmail.com), Positive Technologies.
+
+lexer grammar CSharpLexer;
+
+channels { COMMENTS_CHANNEL, DIRECTIVE }
+
+options { superClass = CSharpLexerBase; }
+
+BYTE_ORDER_MARK: '\u00EF\u00BB\u00BF';
+
+SINGLE_LINE_DOC_COMMENT: '///' InputCharacter*    -> channel(COMMENTS_CHANNEL);
+EMPTY_DELIMITED_DOC_COMMENT: '/***/'              -> channel(COMMENTS_CHANNEL);
+DELIMITED_DOC_COMMENT:       '/**' ~'/' .*? '*/'  -> channel(COMMENTS_CHANNEL);
+SINGLE_LINE_COMMENT:     '//'  InputCharacter*    -> channel(COMMENTS_CHANNEL);
+DELIMITED_COMMENT:       '/*'  .*? '*/'           -> channel(COMMENTS_CHANNEL);
+WHITESPACES:   (Whitespace | NewLine)+            -> channel(HIDDEN);
+SHARP:         '#'                                -> mode(DIRECTIVE_MODE), skip;
+
+ABSTRACT:      'abstract';
+ADD:           'add';
+ALIAS:         'alias';
+ARGLIST:       '__arglist';
+AS:            'as';
+ASCENDING:     'ascending';
+ASYNC:         'async';
+AWAIT:         'await';
+BASE:          'base';
+BOOL:          'bool';
+BREAK:         'break';
+BY:            'by';
+BYTE:          'byte';
+CASE:          'case';
+CATCH:         'catch';
+CHAR:          'char';
+CHECKED:       'checked';
+CLASS:         'class';
+CONST:         'const';
+CONTINUE:      'continue';
+DECIMAL:       'decimal';
+DEFAULT:       'default';
+DELEGATE:      'delegate';
+DESCENDING:    'descending';
+DO:            'do';
+DOUBLE:        'double';
+DYNAMIC:       'dynamic';
+ELSE:          'else';
+ENUM:          'enum';
+EQUALS:        'equals';
+EVENT:         'event';
+EXPLICIT:      'explicit';
+EXTERN:        'extern';
+FALSE:         'false';
+FINALLY:       'finally';
+FIXED:         'fixed';
+FLOAT:         'float';
+FOR:           'for';
+FOREACH:       'foreach';
+FROM:          'from';
+GET:           'get';
+GOTO:          'goto';
+GROUP:         'group';
+IF:            'if';
+IMPLICIT:      'implicit';
+IN:            'in';
+INT:           'int';
+INTERFACE:     'interface';
+INTERNAL:      'internal';
+INTO:          'into';
+IS:            'is';
+JOIN:          'join';
+LET:           'let';
+LOCK:          'lock';
+LONG:          'long';
+NAMEOF:        'nameof';
+NAMESPACE:     'namespace';
+NEW:           'new';
+NULL_:         'null';
+OBJECT:        'object';
+ON:            'on';
+OPERATOR:      'operator';
+ORDERBY:       'orderby';
+OUT:           'out';
+OVERRIDE:      'override';
+PARAMS:        'params';
+PARTIAL:       'partial';
+PRIVATE:       'private';
+PROTECTED:     'protected';
+PUBLIC:        'public';
+READONLY:      'readonly';
+REF:           'ref';
+REMOVE:        'remove';
+RETURN:        'return';
+SBYTE:         'sbyte';
+SEALED:        'sealed';
+SELECT:        'select';
+SET:           'set';
+SHORT:         'short';
+SIZEOF:        'sizeof';
+STACKALLOC:    'stackalloc';
+STATIC:        'static';
+STRING:        'string';
+STRUCT:        'struct';
+SWITCH:        'switch';
+THIS:          'this';
+THROW:         'throw';
+TRUE:          'true';
+TRY:           'try';
+TYPEOF:        'typeof';
+UINT:          'uint';
+ULONG:         'ulong';
+UNCHECKED:     'unchecked';
+UNMANAGED:     'unmanaged';
+UNSAFE:        'unsafe';
+USHORT:        'ushort';
+USING:         'using';
+VAR:		   'var';
+VIRTUAL:       'virtual';
+VOID:          'void';
+VOLATILE:      'volatile';
+WHEN:          'when';
+WHERE:         'where';
+WHILE:         'while';
+YIELD:         'yield';
+
+//B.1.6 Identifiers
+// must be defined after all keywords so the first branch (Available_identifier) does not match keywords
+// https://msdn.microsoft.com/en-us/library/aa664670(v=vs.71).aspx
+IDENTIFIER:          '@'? IdentifierOrKeyword;
+
+//B.1.8 Literals
+// 0.Equals() would be parsed as an invalid real (1. branch) causing a lexer error
+LITERAL_ACCESS:      [0-9] ('_'* [0-9])* IntegerTypeSuffix? '.' '@'? IdentifierOrKeyword;
+INTEGER_LITERAL:     [0-9] ('_'* [0-9])* IntegerTypeSuffix?;
+HEX_INTEGER_LITERAL: '0' [xX] ('_'* HexDigit)+ IntegerTypeSuffix?;
+BIN_INTEGER_LITERAL: '0' [bB] ('_'* [01])+ IntegerTypeSuffix?;
+REAL_LITERAL:        ([0-9] ('_'* [0-9])*)? '.' [0-9] ('_'* [0-9])* ExponentPart? [FfDdMm]? | [0-9] ('_'* [0-9])* ([FfDdMm] | ExponentPart [FfDdMm]?);
+
+CHARACTER_LITERAL:                   '\'' (~['\\\r\n\u0085\u2028\u2029] | CommonCharacter) '\'';
+REGULAR_STRING:                      '"'  (~["\\\r\n\u0085\u2028\u2029] | CommonCharacter)* '"';
+VERBATIUM_STRING:                    '@"' (~'"' | '""')* '"';
+INTERPOLATED_REGULAR_STRING_START:   '$"' { this.OnInterpolatedRegularStringStart(); } -> pushMode(INTERPOLATION_STRING);
+INTERPOLATED_VERBATIUM_STRING_START: '$@"'  { this.OnInterpolatedVerbatiumStringStart(); }  -> pushMode(INTERPOLATION_STRING);
+
+//B.1.9 Operators And Punctuators
+OPEN_BRACE:               '{' { this.OnOpenBrace(); };
+CLOSE_BRACE:              '}' { this.OnCloseBrace(); };
+OPEN_BRACKET:             '[';
+CLOSE_BRACKET:            ']';
+OPEN_PARENS:              '(';
+CLOSE_PARENS:             ')';
+DOT:                      '.';
+COMMA:                    ',';
+COLON:                    ':' { this.OnColon(); };
+SEMICOLON:                ';';
+PLUS:                     '+';
+MINUS:                    '-';
+STAR:                     '*';
+DIV:                      '/';
+PERCENT:                  '%';
+AMP:                      '&';
+BITWISE_OR:               '|';
+CARET:                    '^';
+BANG:                     '!';
+TILDE:                    '~';
+ASSIGNMENT:               '=';
+LT:                       '<';
+GT:                       '>';
+INTERR:                   '?';
+DOUBLE_COLON:             '::';
+OP_COALESCING:            '??';
+OP_INC:                   '++';
+OP_DEC:                   '--';
+OP_AND:                   '&&';
+OP_OR:                    '||';
+OP_PTR:                   '->';
+OP_EQ:                    '==';
+OP_NE:                    '!=';
+OP_LE:                    '<=';
+OP_GE:                    '>=';
+OP_ADD_ASSIGNMENT:        '+=';
+OP_SUB_ASSIGNMENT:        '-=';
+OP_MULT_ASSIGNMENT:       '*=';
+OP_DIV_ASSIGNMENT:        '/=';
+OP_MOD_ASSIGNMENT:        '%=';
+OP_AND_ASSIGNMENT:        '&=';
+OP_OR_ASSIGNMENT:         '|=';
+OP_XOR_ASSIGNMENT:        '^=';
+OP_LEFT_SHIFT:            '<<';
+OP_LEFT_SHIFT_ASSIGNMENT: '<<=';
+OP_COALESCING_ASSIGNMENT: '??=';
+OP_RANGE:                 '..';
+
+// https://msdn.microsoft.com/en-us/library/dn961160.aspx
+mode INTERPOLATION_STRING;
+
+DOUBLE_CURLY_INSIDE:           '{{';
+OPEN_BRACE_INSIDE:             '{' { this.OpenBraceInside(); } -> skip, pushMode(DEFAULT_MODE);
+REGULAR_CHAR_INSIDE:           { this.IsRegularCharInside() }? SimpleEscapeSequence;
+VERBATIUM_DOUBLE_QUOTE_INSIDE: { this.IsVerbatiumDoubleQuoteInside() }? '""';
+DOUBLE_QUOTE_INSIDE:           '"' { this.OnDoubleQuoteInside(); } -> popMode;
+REGULAR_STRING_INSIDE:         { this.IsRegularCharInside() }? ~('{' | '\\' | '"')+;
+VERBATIUM_INSIDE_STRING:       { this.IsVerbatiumDoubleQuoteInside() }? ~('{' | '"')+;
+
+mode INTERPOLATION_FORMAT;
+
+DOUBLE_CURLY_CLOSE_INSIDE:      '}}' -> type(FORMAT_STRING);
+CLOSE_BRACE_INSIDE:             '}' { this.OnCloseBraceInside(); }   -> skip, popMode;
+FORMAT_STRING:                  ~'}'+;
+
+mode DIRECTIVE_MODE;
+
+DIRECTIVE_WHITESPACES:         Whitespace+                      -> channel(HIDDEN);
+DIGITS:                        [0-9]+                           -> channel(DIRECTIVE);
+DIRECTIVE_TRUE:                'true'                           -> channel(DIRECTIVE), type(TRUE);
+DIRECTIVE_FALSE:               'false'                          -> channel(DIRECTIVE), type(FALSE);
+DEFINE:                        'define'                         -> channel(DIRECTIVE);
+UNDEF:                         'undef'                          -> channel(DIRECTIVE);
+DIRECTIVE_IF:                  'if'                             -> channel(DIRECTIVE), type(IF);
+ELIF:                          'elif'                           -> channel(DIRECTIVE);
+DIRECTIVE_ELSE:                'else'                           -> channel(DIRECTIVE), type(ELSE);
+ENDIF:                         'endif'                          -> channel(DIRECTIVE);
+LINE:                          'line'                           -> channel(DIRECTIVE);
+ERROR:                         'error' Whitespace+              -> channel(DIRECTIVE), mode(DIRECTIVE_TEXT);
+WARNING:                       'warning' Whitespace+            -> channel(DIRECTIVE), mode(DIRECTIVE_TEXT);
+REGION:                        'region' Whitespace*             -> channel(DIRECTIVE), mode(DIRECTIVE_TEXT);
+ENDREGION:                     'endregion' Whitespace*          -> channel(DIRECTIVE), mode(DIRECTIVE_TEXT);
+PRAGMA:                        'pragma' Whitespace+             -> channel(DIRECTIVE), mode(DIRECTIVE_TEXT);
+NULLABLE:                      'nullable' Whitespace+           -> channel(DIRECTIVE), mode(DIRECTIVE_TEXT);
+DIRECTIVE_DEFAULT:             'default'                        -> channel(DIRECTIVE), type(DEFAULT);
+DIRECTIVE_HIDDEN:              'hidden'                         -> channel(DIRECTIVE);
+DIRECTIVE_OPEN_PARENS:         '('                              -> channel(DIRECTIVE), type(OPEN_PARENS);
+DIRECTIVE_CLOSE_PARENS:        ')'                              -> channel(DIRECTIVE), type(CLOSE_PARENS);
+DIRECTIVE_BANG:                '!'                              -> channel(DIRECTIVE), type(BANG);
+DIRECTIVE_OP_EQ:               '=='                             -> channel(DIRECTIVE), type(OP_EQ);
+DIRECTIVE_OP_NE:               '!='                             -> channel(DIRECTIVE), type(OP_NE);
+DIRECTIVE_OP_AND:              '&&'                             -> channel(DIRECTIVE), type(OP_AND);
+DIRECTIVE_OP_OR:               '||'                             -> channel(DIRECTIVE), type(OP_OR);
+DIRECTIVE_STRING:              '"' ~('"' | [\r\n\u0085\u2028\u2029])* '"' -> channel(DIRECTIVE), type(STRING);
+CONDITIONAL_SYMBOL:            IdentifierOrKeyword              -> channel(DIRECTIVE);
+DIRECTIVE_SINGLE_LINE_COMMENT: '//' ~[\r\n\u0085\u2028\u2029]*  -> channel(COMMENTS_CHANNEL), type(SINGLE_LINE_COMMENT);
+DIRECTIVE_NEW_LINE:            NewLine                          -> channel(DIRECTIVE), mode(DEFAULT_MODE);
+
+mode DIRECTIVE_TEXT;
+
+TEXT:                          ~[\r\n\u0085\u2028\u2029]+       -> channel(DIRECTIVE);
+TEXT_NEW_LINE:                 NewLine    -> channel(DIRECTIVE), type(DIRECTIVE_NEW_LINE), mode(DEFAULT_MODE);
+
+// Fragments
+
+fragment InputCharacter:       ~[\r\n\u0085\u2028\u2029];
+
+fragment NewLineCharacter
+	: '\u000D' //'<Carriage Return CHARACTER (U+000D)>'
+	| '\u000A' //'<Line Feed CHARACTER (U+000A)>'
+	| '\u0085' //'<Next Line CHARACTER (U+0085)>'
+	| '\u2028' //'<Line Separator CHARACTER (U+2028)>'
+	| '\u2029' //'<Paragraph Separator CHARACTER (U+2029)>'
+	;
+
+fragment IntegerTypeSuffix:         [lL]? [uU] | [uU]? [lL];
+fragment ExponentPart:              [eE] ('+' | '-')? [0-9] ('_'* [0-9])*;
+
+fragment CommonCharacter
+	: SimpleEscapeSequence
+	| HexEscapeSequence
+	| UnicodeEscapeSequence
+	;
+
+fragment SimpleEscapeSequence
+	: '\\\''
+	| '\\"'
+	| '\\\\'
+	| '\\0'
+	| '\\a'
+	| '\\b'
+	| '\\f'
+	| '\\n'
+	| '\\r'
+	| '\\t'
+	| '\\v'
+	;
+
+fragment HexEscapeSequence
+	: '\\x' HexDigit
+	| '\\x' HexDigit HexDigit
+	| '\\x' HexDigit HexDigit HexDigit
+	| '\\x' HexDigit HexDigit HexDigit HexDigit
+	;
+
+fragment NewLine
+	: '\r\n' | '\r' | '\n'
+	| '\u0085' // <Next Line CHARACTER (U+0085)>'
+	| '\u2028' //'<Line Separator CHARACTER (U+2028)>'
+	| '\u2029' //'<Paragraph Separator CHARACTER (U+2029)>'
+	;
+
+fragment Whitespace
+	: UnicodeClassZS //'<Any Character With Unicode Class Zs>'
+	| '\u0009' //'<Horizontal Tab Character (U+0009)>'
+	| '\u000B' //'<Vertical Tab Character (U+000B)>'
+	| '\u000C' //'<Form Feed Character (U+000C)>'
+	;
+
+fragment UnicodeClassZS
+	: '\u0020' // SPACE
+	| '\u00A0' // NO_BREAK SPACE
+	| '\u1680' // OGHAM SPACE MARK
+	| '\u180E' // MONGOLIAN VOWEL SEPARATOR
+	| '\u2000' // EN QUAD
+	| '\u2001' // EM QUAD
+	| '\u2002' // EN SPACE
+	| '\u2003' // EM SPACE
+	| '\u2004' // THREE_PER_EM SPACE
+	| '\u2005' // FOUR_PER_EM SPACE
+	| '\u2006' // SIX_PER_EM SPACE
+	| '\u2008' // PUNCTUATION SPACE
+	| '\u2009' // THIN SPACE
+	| '\u200A' // HAIR SPACE
+	| '\u202F' // NARROW NO_BREAK SPACE
+	| '\u3000' // IDEOGRAPHIC SPACE
+	| '\u205F' // MEDIUM MATHEMATICAL SPACE
+	;
+
+fragment IdentifierOrKeyword
+	: IdentifierStartCharacter IdentifierPartCharacter*
+	;
+
+fragment IdentifierStartCharacter
+	: LetterCharacter
+	| '_'
+	;
+
+fragment IdentifierPartCharacter
+	: LetterCharacter
+	| DecimalDigitCharacter
+	| ConnectingCharacter
+	| CombiningCharacter
+	| FormattingCharacter
+	;
+
+//'<A Unicode Character Of Classes Lu, Ll, Lt, Lm, Lo, Or Nl>'
+// WARNING: ignores UnicodeEscapeSequence
+fragment LetterCharacter
+	: UnicodeClassLU
+	| UnicodeClassLL
+	| UnicodeClassLT
+	| UnicodeClassLM
+	| UnicodeClassLO
+	| UnicodeClassNL
+	| UnicodeEscapeSequence
+	;
+
+//'<A Unicode Character Of The Class Nd>'
+// WARNING: ignores UnicodeEscapeSequence
+fragment DecimalDigitCharacter
+	: UnicodeClassND
+	| UnicodeEscapeSequence
+	;
+
+//'<A Unicode Character Of The Class Pc>'
+// WARNING: ignores UnicodeEscapeSequence
+fragment ConnectingCharacter
+	: UnicodeClassPC
+	| UnicodeEscapeSequence
+	;
+
+//'<A Unicode Character Of Classes Mn Or Mc>'
+// WARNING: ignores UnicodeEscapeSequence
+fragment CombiningCharacter
+	: UnicodeClassMN
+	| UnicodeClassMC
+	| UnicodeEscapeSequence
+	;
+
+//'<A Unicode Character Of The Class Cf>'
+// WARNING: ignores UnicodeEscapeSequence
+fragment FormattingCharacter
+	: UnicodeClassCF
+	| UnicodeEscapeSequence
+	;
+
+//B.1.5 Unicode Character Escape Sequences
+fragment UnicodeEscapeSequence
+	: '\\u' HexDigit HexDigit HexDigit HexDigit
+	| '\\U' HexDigit HexDigit HexDigit HexDigit HexDigit HexDigit HexDigit HexDigit
+	;
+
+fragment HexDigit : [0-9] | [A-F] | [a-f];
+
+// Unicode character classes
+fragment UnicodeClassLU
+	: '\u0041'..'\u005a'
+	| '\u00c0'..'\u00d6'
+	| '\u00d8'..'\u00de'
+	| '\u0100'..'\u0136'
+	| '\u0139'..'\u0147'
+	| '\u014a'..'\u0178'
+	| '\u0179'..'\u017d'
+	| '\u0181'..'\u0182'
+	| '\u0184'..'\u0186'
+	| '\u0187'..'\u0189'
+	| '\u018a'..'\u018b'
+	| '\u018e'..'\u0191'
+	| '\u0193'..'\u0194'
+	| '\u0196'..'\u0198'
+	| '\u019c'..'\u019d'
+	| '\u019f'..'\u01a0'
+	| '\u01a2'..'\u01a6'
+	| '\u01a7'..'\u01a9'
+	| '\u01ac'..'\u01ae'
+	| '\u01af'..'\u01b1'
+	| '\u01b2'..'\u01b3'
+	| '\u01b5'..'\u01b7'
+	| '\u01b8'..'\u01bc'
+	| '\u01c4'..'\u01cd'
+	| '\u01cf'..'\u01db'
+	| '\u01de'..'\u01ee'
+	| '\u01f1'..'\u01f4'
+	| '\u01f6'..'\u01f8'
+	| '\u01fa'..'\u0232'
+	| '\u023a'..'\u023b'
+	| '\u023d'..'\u023e'
+	| '\u0241'..'\u0243'
+	| '\u0244'..'\u0246'
+	| '\u0248'..'\u024e'
+	| '\u0370'..'\u0372'
+	| '\u0376'..'\u037f'
+	| '\u0386'..'\u0388'
+	| '\u0389'..'\u038a'
+	| '\u038c'..'\u038e'
+	| '\u038f'..'\u0391'
+	| '\u0392'..'\u03a1'
+	| '\u03a3'..'\u03ab'
+	| '\u03cf'..'\u03d2'
+	| '\u03d3'..'\u03d4'
+	| '\u03d8'..'\u03ee'
+	| '\u03f4'..'\u03f7'
+	| '\u03f9'..'\u03fa'
+	| '\u03fd'..'\u042f'
+	| '\u0460'..'\u0480'
+	| '\u048a'..'\u04c0'
+	| '\u04c1'..'\u04cd'
+	| '\u04d0'..'\u052e'
+	| '\u0531'..'\u0556'
+	| '\u10a0'..'\u10c5'
+	| '\u10c7'..'\u10cd'
+	| '\u1e00'..'\u1e94'
+	| '\u1e9e'..'\u1efe'
+	| '\u1f08'..'\u1f0f'
+	| '\u1f18'..'\u1f1d'
+	| '\u1f28'..'\u1f2f'
+	| '\u1f38'..'\u1f3f'
+	| '\u1f48'..'\u1f4d'
+	| '\u1f59'..'\u1f5f'
+	| '\u1f68'..'\u1f6f'
+	| '\u1fb8'..'\u1fbb'
+	| '\u1fc8'..'\u1fcb'
+	| '\u1fd8'..'\u1fdb'
+	| '\u1fe8'..'\u1fec'
+	| '\u1ff8'..'\u1ffb'
+	| '\u2102'..'\u2107'
+	| '\u210b'..'\u210d'
+	| '\u2110'..'\u2112'
+	| '\u2115'..'\u2119'
+	| '\u211a'..'\u211d'
+	| '\u2124'..'\u212a'
+	| '\u212b'..'\u212d'
+	| '\u2130'..'\u2133'
+	| '\u213e'..'\u213f'
+	| '\u2145'..'\u2183'
+	| '\u2c00'..'\u2c2e'
+	| '\u2c60'..'\u2c62'
+	| '\u2c63'..'\u2c64'
+	| '\u2c67'..'\u2c6d'
+	| '\u2c6e'..'\u2c70'
+	| '\u2c72'..'\u2c75'
+	| '\u2c7e'..'\u2c80'
+	| '\u2c82'..'\u2ce2'
+	| '\u2ceb'..'\u2ced'
+	| '\u2cf2'..'\ua640'
+	| '\ua642'..'\ua66c'
+	| '\ua680'..'\ua69a'
+	| '\ua722'..'\ua72e'
+	| '\ua732'..'\ua76e'
+	| '\ua779'..'\ua77d'
+	| '\ua77e'..'\ua786'
+	| '\ua78b'..'\ua78d'
+	| '\ua790'..'\ua792'
+	| '\ua796'..'\ua7aa'
+	| '\ua7ab'..'\ua7ad'
+	| '\ua7b0'..'\ua7b1'
+	| '\uff21'..'\uff3a'
+	;
+
+fragment UnicodeClassLL
+	: '\u0061'..'\u007A'
+	| '\u00b5'..'\u00df'
+	| '\u00e0'..'\u00f6'
+	| '\u00f8'..'\u00ff'
+	| '\u0101'..'\u0137'
+	| '\u0138'..'\u0148'
+	| '\u0149'..'\u0177'
+	| '\u017a'..'\u017e'
+	| '\u017f'..'\u0180'
+	| '\u0183'..'\u0185'
+	| '\u0188'..'\u018c'
+	| '\u018d'..'\u0192'
+	| '\u0195'..'\u0199'
+	| '\u019a'..'\u019b'
+	| '\u019e'..'\u01a1'
+	| '\u01a3'..'\u01a5'
+	| '\u01a8'..'\u01aa'
+	| '\u01ab'..'\u01ad'
+	| '\u01b0'..'\u01b4'
+	| '\u01b6'..'\u01b9'
+	| '\u01ba'..'\u01bd'
+	| '\u01be'..'\u01bf'
+	| '\u01c6'..'\u01cc'
+	| '\u01ce'..'\u01dc'
+	| '\u01dd'..'\u01ef'
+	| '\u01f0'..'\u01f3'
+	| '\u01f5'..'\u01f9'
+	| '\u01fb'..'\u0233'
+	| '\u0234'..'\u0239'
+	| '\u023c'..'\u023f'
+	| '\u0240'..'\u0242'
+	| '\u0247'..'\u024f'
+	| '\u0250'..'\u0293'
+	| '\u0295'..'\u02af'
+	| '\u0371'..'\u0373'
+	| '\u0377'..'\u037b'
+	| '\u037c'..'\u037d'
+	| '\u0390'..'\u03ac'
+	| '\u03ad'..'\u03ce'
+	| '\u03d0'..'\u03d1'
+	| '\u03d5'..'\u03d7'
+	| '\u03d9'..'\u03ef'
+	| '\u03f0'..'\u03f3'
+	| '\u03f5'..'\u03fb'
+	| '\u03fc'..'\u0430'
+	| '\u0431'..'\u045f'
+	| '\u0461'..'\u0481'
+	| '\u048b'..'\u04bf'
+	| '\u04c2'..'\u04ce'
+	| '\u04cf'..'\u052f'
+	| '\u0561'..'\u0587'
+	| '\u1d00'..'\u1d2b'
+	| '\u1d6b'..'\u1d77'
+	| '\u1d79'..'\u1d9a'
+	| '\u1e01'..'\u1e95'
+	| '\u1e96'..'\u1e9d'
+	| '\u1e9f'..'\u1eff'
+	| '\u1f00'..'\u1f07'
+	| '\u1f10'..'\u1f15'
+	| '\u1f20'..'\u1f27'
+	| '\u1f30'..'\u1f37'
+	| '\u1f40'..'\u1f45'
+	| '\u1f50'..'\u1f57'
+	| '\u1f60'..'\u1f67'
+	| '\u1f70'..'\u1f7d'
+	| '\u1f80'..'\u1f87'
+	| '\u1f90'..'\u1f97'
+	| '\u1fa0'..'\u1fa7'
+	| '\u1fb0'..'\u1fb4'
+	| '\u1fb6'..'\u1fb7'
+	| '\u1fbe'..'\u1fc2'
+	| '\u1fc3'..'\u1fc4'
+	| '\u1fc6'..'\u1fc7'
+	| '\u1fd0'..'\u1fd3'
+	| '\u1fd6'..'\u1fd7'
+	| '\u1fe0'..'\u1fe7'
+	| '\u1ff2'..'\u1ff4'
+	| '\u1ff6'..'\u1ff7'
+	| '\u210a'..'\u210e'
+	| '\u210f'..'\u2113'
+	| '\u212f'..'\u2139'
+	| '\u213c'..'\u213d'
+	| '\u2146'..'\u2149'
+	| '\u214e'..'\u2184'
+	| '\u2c30'..'\u2c5e'
+	| '\u2c61'..'\u2c65'
+	| '\u2c66'..'\u2c6c'
+	| '\u2c71'..'\u2c73'
+	| '\u2c74'..'\u2c76'
+	| '\u2c77'..'\u2c7b'
+	| '\u2c81'..'\u2ce3'
+	| '\u2ce4'..'\u2cec'
+	| '\u2cee'..'\u2cf3'
+	| '\u2d00'..'\u2d25'
+	| '\u2d27'..'\u2d2d'
+	| '\ua641'..'\ua66d'
+	| '\ua681'..'\ua69b'
+	| '\ua723'..'\ua72f'
+	| '\ua730'..'\ua731'
+	| '\ua733'..'\ua771'
+	| '\ua772'..'\ua778'
+	| '\ua77a'..'\ua77c'
+	| '\ua77f'..'\ua787'
+	| '\ua78c'..'\ua78e'
+	| '\ua791'..'\ua793'
+	| '\ua794'..'\ua795'
+	| '\ua797'..'\ua7a9'
+	| '\ua7fa'..'\uab30'
+	| '\uab31'..'\uab5a'
+	| '\uab64'..'\uab65'
+	| '\ufb00'..'\ufb06'
+	| '\ufb13'..'\ufb17'
+	| '\uff41'..'\uff5a'
+	;
+
+fragment UnicodeClassLT
+	: '\u01c5'..'\u01cb'
+	| '\u01f2'..'\u1f88'
+	| '\u1f89'..'\u1f8f'
+	| '\u1f98'..'\u1f9f'
+	| '\u1fa8'..'\u1faf'
+	| '\u1fbc'..'\u1fcc'
+	| '\u1ffc'..'\u1ffc'
+	;
+
+fragment UnicodeClassLM
+	: '\u02b0'..'\u02c1'
+	| '\u02c6'..'\u02d1'
+	| '\u02e0'..'\u02e4'
+	| '\u02ec'..'\u02ee'
+	| '\u0374'..'\u037a'
+	| '\u0559'..'\u0640'
+	| '\u06e5'..'\u06e6'
+	| '\u07f4'..'\u07f5'
+	| '\u07fa'..'\u081a'
+	| '\u0824'..'\u0828'
+	| '\u0971'..'\u0e46'
+	| '\u0ec6'..'\u10fc'
+	| '\u17d7'..'\u1843'
+	| '\u1aa7'..'\u1c78'
+	| '\u1c79'..'\u1c7d'
+	| '\u1d2c'..'\u1d6a'
+	| '\u1d78'..'\u1d9b'
+	| '\u1d9c'..'\u1dbf'
+	| '\u2071'..'\u207f'
+	| '\u2090'..'\u209c'
+	| '\u2c7c'..'\u2c7d'
+	| '\u2d6f'..'\u2e2f'
+	| '\u3005'..'\u3031'
+	| '\u3032'..'\u3035'
+	| '\u303b'..'\u309d'
+	| '\u309e'..'\u30fc'
+	| '\u30fd'..'\u30fe'
+	| '\ua015'..'\ua4f8'
+	| '\ua4f9'..'\ua4fd'
+	| '\ua60c'..'\ua67f'
+	| '\ua69c'..'\ua69d'
+	| '\ua717'..'\ua71f'
+	| '\ua770'..'\ua788'
+	| '\ua7f8'..'\ua7f9'
+	| '\ua9cf'..'\ua9e6'
+	| '\uaa70'..'\uaadd'
+	| '\uaaf3'..'\uaaf4'
+	| '\uab5c'..'\uab5f'
+	| '\uff70'..'\uff9e'
+	| '\uff9f'..'\uff9f'
+	;
+
+fragment UnicodeClassLO
+	: '\u00aa'..'\u00ba'
+	| '\u01bb'..'\u01c0'
+	| '\u01c1'..'\u01c3'
+	| '\u0294'..'\u05d0'
+	| '\u05d1'..'\u05ea'
+	| '\u05f0'..'\u05f2'
+	| '\u0620'..'\u063f'
+	| '\u0641'..'\u064a'
+	| '\u066e'..'\u066f'
+	| '\u0671'..'\u06d3'
+	| '\u06d5'..'\u06ee'
+	| '\u06ef'..'\u06fa'
+	| '\u06fb'..'\u06fc'
+	| '\u06ff'..'\u0710'
+	| '\u0712'..'\u072f'
+	| '\u074d'..'\u07a5'
+	| '\u07b1'..'\u07ca'
+	| '\u07cb'..'\u07ea'
+	| '\u0800'..'\u0815'
+	| '\u0840'..'\u0858'
+	| '\u08a0'..'\u08b2'
+	| '\u0904'..'\u0939'
+	| '\u093d'..'\u0950'
+	| '\u0958'..'\u0961'
+	| '\u0972'..'\u0980'
+	| '\u0985'..'\u098c'
+	| '\u098f'..'\u0990'
+	| '\u0993'..'\u09a8'
+	| '\u09aa'..'\u09b0'
+	| '\u09b2'..'\u09b6'
+	| '\u09b7'..'\u09b9'
+	| '\u09bd'..'\u09ce'
+	| '\u09dc'..'\u09dd'
+	| '\u09df'..'\u09e1'
+	| '\u09f0'..'\u09f1'
+	| '\u0a05'..'\u0a0a'
+	| '\u0a0f'..'\u0a10'
+	| '\u0a13'..'\u0a28'
+	| '\u0a2a'..'\u0a30'
+	| '\u0a32'..'\u0a33'
+	| '\u0a35'..'\u0a36'
+	| '\u0a38'..'\u0a39'
+	| '\u0a59'..'\u0a5c'
+	| '\u0a5e'..'\u0a72'
+	| '\u0a73'..'\u0a74'
+	| '\u0a85'..'\u0a8d'
+	| '\u0a8f'..'\u0a91'
+	| '\u0a93'..'\u0aa8'
+	| '\u0aaa'..'\u0ab0'
+	| '\u0ab2'..'\u0ab3'
+	| '\u0ab5'..'\u0ab9'
+	| '\u0abd'..'\u0ad0'
+	| '\u0ae0'..'\u0ae1'
+	| '\u0b05'..'\u0b0c'
+	| '\u0b0f'..'\u0b10'
+	| '\u0b13'..'\u0b28'
+	| '\u0b2a'..'\u0b30'
+	| '\u0b32'..'\u0b33'
+	| '\u0b35'..'\u0b39'
+	| '\u0b3d'..'\u0b5c'
+	| '\u0b5d'..'\u0b5f'
+	| '\u0b60'..'\u0b61'
+	| '\u0b71'..'\u0b83'
+	| '\u0b85'..'\u0b8a'
+	| '\u0b8e'..'\u0b90'
+	| '\u0b92'..'\u0b95'
+	| '\u0b99'..'\u0b9a'
+	| '\u0b9c'..'\u0b9e'
+	| '\u0b9f'..'\u0ba3'
+	| '\u0ba4'..'\u0ba8'
+	| '\u0ba9'..'\u0baa'
+	| '\u0bae'..'\u0bb9'
+	| '\u0bd0'..'\u0c05'
+	| '\u0c06'..'\u0c0c'
+	| '\u0c0e'..'\u0c10'
+	| '\u0c12'..'\u0c28'
+	| '\u0c2a'..'\u0c39'
+	| '\u0c3d'..'\u0c58'
+	| '\u0c59'..'\u0c60'
+	| '\u0c61'..'\u0c85'
+	| '\u0c86'..'\u0c8c'
+	| '\u0c8e'..'\u0c90'
+	| '\u0c92'..'\u0ca8'
+	| '\u0caa'..'\u0cb3'
+	| '\u0cb5'..'\u0cb9'
+	| '\u0cbd'..'\u0cde'
+	| '\u0ce0'..'\u0ce1'
+	| '\u0cf1'..'\u0cf2'
+	| '\u0d05'..'\u0d0c'
+	| '\u0d0e'..'\u0d10'
+	| '\u0d12'..'\u0d3a'
+	| '\u0d3d'..'\u0d4e'
+	| '\u0d60'..'\u0d61'
+	| '\u0d7a'..'\u0d7f'
+	| '\u0d85'..'\u0d96'
+	| '\u0d9a'..'\u0db1'
+	| '\u0db3'..'\u0dbb'
+	| '\u0dbd'..'\u0dc0'
+	| '\u0dc1'..'\u0dc6'
+	| '\u0e01'..'\u0e30'
+	| '\u0e32'..'\u0e33'
+	| '\u0e40'..'\u0e45'
+	| '\u0e81'..'\u0e82'
+	| '\u0e84'..'\u0e87'
+	| '\u0e88'..'\u0e8a'
+	| '\u0e8d'..'\u0e94'
+	| '\u0e95'..'\u0e97'
+	| '\u0e99'..'\u0e9f'
+	| '\u0ea1'..'\u0ea3'
+	| '\u0ea5'..'\u0ea7'
+	| '\u0eaa'..'\u0eab'
+	| '\u0ead'..'\u0eb0'
+	| '\u0eb2'..'\u0eb3'
+	| '\u0ebd'..'\u0ec0'
+	| '\u0ec1'..'\u0ec4'
+	| '\u0edc'..'\u0edf'
+	| '\u0f00'..'\u0f40'
+	| '\u0f41'..'\u0f47'
+	| '\u0f49'..'\u0f6c'
+	| '\u0f88'..'\u0f8c'
+	| '\u1000'..'\u102a'
+	| '\u103f'..'\u1050'
+	| '\u1051'..'\u1055'
+	| '\u105a'..'\u105d'
+	| '\u1061'..'\u1065'
+	| '\u1066'..'\u106e'
+	| '\u106f'..'\u1070'
+	| '\u1075'..'\u1081'
+	| '\u108e'..'\u10d0'
+	| '\u10d1'..'\u10fa'
+	| '\u10fd'..'\u1248'
+	| '\u124a'..'\u124d'
+	| '\u1250'..'\u1256'
+	| '\u1258'..'\u125a'
+	| '\u125b'..'\u125d'
+	| '\u1260'..'\u1288'
+	| '\u128a'..'\u128d'
+	| '\u1290'..'\u12b0'
+	| '\u12b2'..'\u12b5'
+	| '\u12b8'..'\u12be'
+	| '\u12c0'..'\u12c2'
+	| '\u12c3'..'\u12c5'
+	| '\u12c8'..'\u12d6'
+	| '\u12d8'..'\u1310'
+	| '\u1312'..'\u1315'
+	| '\u1318'..'\u135a'
+	| '\u1380'..'\u138f'
+	| '\u13a0'..'\u13f4'
+	| '\u1401'..'\u166c'
+	| '\u166f'..'\u167f'
+	| '\u1681'..'\u169a'
+	| '\u16a0'..'\u16ea'
+	| '\u16f1'..'\u16f8'
+	| '\u1700'..'\u170c'
+	| '\u170e'..'\u1711'
+	| '\u1720'..'\u1731'
+	| '\u1740'..'\u1751'
+	| '\u1760'..'\u176c'
+	| '\u176e'..'\u1770'
+	| '\u1780'..'\u17b3'
+	| '\u17dc'..'\u1820'
+	| '\u1821'..'\u1842'
+	| '\u1844'..'\u1877'
+	| '\u1880'..'\u18a8'
+	| '\u18aa'..'\u18b0'
+	| '\u18b1'..'\u18f5'
+	| '\u1900'..'\u191e'
+	| '\u1950'..'\u196d'
+	| '\u1970'..'\u1974'
+	| '\u1980'..'\u19ab'
+	| '\u19c1'..'\u19c7'
+	| '\u1a00'..'\u1a16'
+	| '\u1a20'..'\u1a54'
+	| '\u1b05'..'\u1b33'
+	| '\u1b45'..'\u1b4b'
+	| '\u1b83'..'\u1ba0'
+	| '\u1bae'..'\u1baf'
+	| '\u1bba'..'\u1be5'
+	| '\u1c00'..'\u1c23'
+	| '\u1c4d'..'\u1c4f'
+	| '\u1c5a'..'\u1c77'
+	| '\u1ce9'..'\u1cec'
+	| '\u1cee'..'\u1cf1'
+	| '\u1cf5'..'\u1cf6'
+	| '\u2135'..'\u2138'
+	| '\u2d30'..'\u2d67'
+	| '\u2d80'..'\u2d96'
+	| '\u2da0'..'\u2da6'
+	| '\u2da8'..'\u2dae'
+	| '\u2db0'..'\u2db6'
+	| '\u2db8'..'\u2dbe'
+	| '\u2dc0'..'\u2dc6'
+	| '\u2dc8'..'\u2dce'
+	| '\u2dd0'..'\u2dd6'
+	| '\u2dd8'..'\u2dde'
+	| '\u3006'..'\u303c'
+	| '\u3041'..'\u3096'
+	| '\u309f'..'\u30a1'
+	| '\u30a2'..'\u30fa'
+	| '\u30ff'..'\u3105'
+	| '\u3106'..'\u312d'
+	| '\u3131'..'\u318e'
+	| '\u31a0'..'\u31ba'
+	| '\u31f0'..'\u31ff'
+	| '\u3400'..'\u4db5'
+	| '\u4e00'..'\u9fcc'
+	| '\ua000'..'\ua014'
+	| '\ua016'..'\ua48c'
+	| '\ua4d0'..'\ua4f7'
+	| '\ua500'..'\ua60b'
+	| '\ua610'..'\ua61f'
+	| '\ua62a'..'\ua62b'
+	| '\ua66e'..'\ua6a0'
+	| '\ua6a1'..'\ua6e5'
+	| '\ua7f7'..'\ua7fb'
+	| '\ua7fc'..'\ua801'
+	| '\ua803'..'\ua805'
+	| '\ua807'..'\ua80a'
+	| '\ua80c'..'\ua822'
+	| '\ua840'..'\ua873'
+	| '\ua882'..'\ua8b3'
+	| '\ua8f2'..'\ua8f7'
+	| '\ua8fb'..'\ua90a'
+	| '\ua90b'..'\ua925'
+	| '\ua930'..'\ua946'
+	| '\ua960'..'\ua97c'
+	| '\ua984'..'\ua9b2'
+	| '\ua9e0'..'\ua9e4'
+	| '\ua9e7'..'\ua9ef'
+	| '\ua9fa'..'\ua9fe'
+	| '\uaa00'..'\uaa28'
+	| '\uaa40'..'\uaa42'
+	| '\uaa44'..'\uaa4b'
+	| '\uaa60'..'\uaa6f'
+	| '\uaa71'..'\uaa76'
+	| '\uaa7a'..'\uaa7e'
+	| '\uaa7f'..'\uaaaf'
+	| '\uaab1'..'\uaab5'
+	| '\uaab6'..'\uaab9'
+	| '\uaaba'..'\uaabd'
+	| '\uaac0'..'\uaac2'
+	| '\uaadb'..'\uaadc'
+	| '\uaae0'..'\uaaea'
+	| '\uaaf2'..'\uab01'
+	| '\uab02'..'\uab06'
+	| '\uab09'..'\uab0e'
+	| '\uab11'..'\uab16'
+	| '\uab20'..'\uab26'
+	| '\uab28'..'\uab2e'
+	| '\uabc0'..'\uabe2'
+	| '\uac00'..'\ud7a3'
+	| '\ud7b0'..'\ud7c6'
+	| '\ud7cb'..'\ud7fb'
+	| '\uf900'..'\ufa6d'
+	| '\ufa70'..'\ufad9'
+	| '\ufb1d'..'\ufb1f'
+	| '\ufb20'..'\ufb28'
+	| '\ufb2a'..'\ufb36'
+	| '\ufb38'..'\ufb3c'
+	| '\ufb3e'..'\ufb40'
+	| '\ufb41'..'\ufb43'
+	| '\ufb44'..'\ufb46'
+	| '\ufb47'..'\ufbb1'
+	| '\ufbd3'..'\ufd3d'
+	| '\ufd50'..'\ufd8f'
+	| '\ufd92'..'\ufdc7'
+	| '\ufdf0'..'\ufdfb'
+	| '\ufe70'..'\ufe74'
+	| '\ufe76'..'\ufefc'
+	| '\uff66'..'\uff6f'
+	| '\uff71'..'\uff9d'
+	| '\uffa0'..'\uffbe'
+	| '\uffc2'..'\uffc7'
+	| '\uffca'..'\uffcf'
+	| '\uffd2'..'\uffd7'
+	| '\uffda'..'\uffdc'
+	;
+
+fragment UnicodeClassNL
+	: '\u16EE' // RUNIC ARLAUG SYMBOL
+	| '\u16EF' // RUNIC TVIMADUR SYMBOL
+	| '\u16F0' // RUNIC BELGTHOR SYMBOL
+	| '\u2160' // ROMAN NUMERAL ONE
+	| '\u2161' // ROMAN NUMERAL TWO
+	| '\u2162' // ROMAN NUMERAL THREE
+	| '\u2163' // ROMAN NUMERAL FOUR
+	| '\u2164' // ROMAN NUMERAL FIVE
+	| '\u2165' // ROMAN NUMERAL SIX
+	| '\u2166' // ROMAN NUMERAL SEVEN
+	| '\u2167' // ROMAN NUMERAL EIGHT
+	| '\u2168' // ROMAN NUMERAL NINE
+	| '\u2169' // ROMAN NUMERAL TEN
+	| '\u216A' // ROMAN NUMERAL ELEVEN
+	| '\u216B' // ROMAN NUMERAL TWELVE
+	| '\u216C' // ROMAN NUMERAL FIFTY
+	| '\u216D' // ROMAN NUMERAL ONE HUNDRED
+	| '\u216E' // ROMAN NUMERAL FIVE HUNDRED
+	| '\u216F' // ROMAN NUMERAL ONE THOUSAND
+	;
+
+fragment UnicodeClassMN
+	: '\u0300' // COMBINING GRAVE ACCENT
+	| '\u0301' // COMBINING ACUTE ACCENT
+	| '\u0302' // COMBINING CIRCUMFLEX ACCENT
+	| '\u0303' // COMBINING TILDE
+	| '\u0304' // COMBINING MACRON
+	| '\u0305' // COMBINING OVERLINE
+	| '\u0306' // COMBINING BREVE
+	| '\u0307' // COMBINING DOT ABOVE
+	| '\u0308' // COMBINING DIAERESIS
+	| '\u0309' // COMBINING HOOK ABOVE
+	| '\u030A' // COMBINING RING ABOVE
+	| '\u030B' // COMBINING DOUBLE ACUTE ACCENT
+	| '\u030C' // COMBINING CARON
+	| '\u030D' // COMBINING VERTICAL LINE ABOVE
+	| '\u030E' // COMBINING DOUBLE VERTICAL LINE ABOVE
+	| '\u030F' // COMBINING DOUBLE GRAVE ACCENT
+	| '\u0310' // COMBINING CANDRABINDU
+	;
+
+fragment UnicodeClassMC
+	: '\u0903' // DEVANAGARI SIGN VISARGA
+	| '\u093E' // DEVANAGARI VOWEL SIGN AA
+	| '\u093F' // DEVANAGARI VOWEL SIGN I
+	| '\u0940' // DEVANAGARI VOWEL SIGN II
+	| '\u0949' // DEVANAGARI VOWEL SIGN CANDRA O
+	| '\u094A' // DEVANAGARI VOWEL SIGN SHORT O
+	| '\u094B' // DEVANAGARI VOWEL SIGN O
+	| '\u094C' // DEVANAGARI VOWEL SIGN AU
+	;
+
+fragment UnicodeClassCF
+	: '\u00AD' // SOFT HYPHEN
+	| '\u0600' // ARABIC NUMBER SIGN
+	| '\u0601' // ARABIC SIGN SANAH
+	| '\u0602' // ARABIC FOOTNOTE MARKER
+	| '\u0603' // ARABIC SIGN SAFHA
+	| '\u06DD' // ARABIC END OF AYAH
+	;
+
+fragment UnicodeClassPC
+	: '\u005F' // LOW LINE
+	| '\u203F' // UNDERTIE
+	| '\u2040' // CHARACTER TIE
+	| '\u2054' // INVERTED UNDERTIE
+	| '\uFE33' // PRESENTATION FORM FOR VERTICAL LOW LINE
+	| '\uFE34' // PRESENTATION FORM FOR VERTICAL WAVY LOW LINE
+	| '\uFE4D' // DASHED LOW LINE
+	| '\uFE4E' // CENTRELINE LOW LINE
+	| '\uFE4F' // WAVY LOW LINE
+	| '\uFF3F' // FULLWIDTH LOW LINE
+	;
+
+fragment UnicodeClassND
+	: '\u0030'..'\u0039'
+	| '\u0660'..'\u0669'
+	| '\u06f0'..'\u06f9'
+	| '\u07c0'..'\u07c9'
+	| '\u0966'..'\u096f'
+	| '\u09e6'..'\u09ef'
+	| '\u0a66'..'\u0a6f'
+	| '\u0ae6'..'\u0aef'
+	| '\u0b66'..'\u0b6f'
+	| '\u0be6'..'\u0bef'
+	| '\u0c66'..'\u0c6f'
+	| '\u0ce6'..'\u0cef'
+	| '\u0d66'..'\u0d6f'
+	| '\u0de6'..'\u0def'
+	| '\u0e50'..'\u0e59'
+	| '\u0ed0'..'\u0ed9'
+	| '\u0f20'..'\u0f29'
+	| '\u1040'..'\u1049'
+	| '\u1090'..'\u1099'
+	| '\u17e0'..'\u17e9'
+	| '\u1810'..'\u1819'
+	| '\u1946'..'\u194f'
+	| '\u19d0'..'\u19d9'
+	| '\u1a80'..'\u1a89'
+	| '\u1a90'..'\u1a99'
+	| '\u1b50'..'\u1b59'
+	| '\u1bb0'..'\u1bb9'
+	| '\u1c40'..'\u1c49'
+	| '\u1c50'..'\u1c59'
+	| '\ua620'..'\ua629'
+	| '\ua8d0'..'\ua8d9'
+	| '\ua900'..'\ua909'
+	| '\ua9d0'..'\ua9d9'
+	| '\ua9f0'..'\ua9f9'
+	| '\uaa50'..'\uaa59'
+	| '\uabf0'..'\uabf9'
+	| '\uff10'..'\uff19'
+	;

+ 1245 - 0
jplag.frontend.csharp-6/src/main/antlr4/de/jplag/csharp/grammar/CSharpParser.g4

@@ -0,0 +1,1245 @@
+// Eclipse Public License - v 1.0, http://www.eclipse.org/legal/epl-v10.html
+// Copyright (c) 2013, Christian Wulf (chwchw@gmx.de)
+// Copyright (c) 2016-2017, Ivan Kochurkin (kvanttt@gmail.com), Positive Technologies.
+
+parser grammar CSharpParser;
+
+options { tokenVocab=CSharpLexer; superClass = CSharpParserBase; }
+
+// entry point
+compilation_unit
+	: BYTE_ORDER_MARK? extern_alias_directives? using_directives?
+	  global_attribute_section* namespace_member_declarations? EOF
+	;
+
+//B.2 Syntactic grammar
+
+//B.2.1 Basic concepts
+
+namespace_or_type_name 
+	: (identifier type_argument_list? | qualified_alias_member) ('.' identifier type_argument_list?)*
+	;
+
+//B.2.2 Types
+type_
+	: base_type ('?' | rank_specifier | '*')*
+	;
+
+base_type
+	: simple_type
+	| class_type  // represents types: enum, class, interface, delegate, type_parameter
+	| VOID '*'
+	| tuple_type
+	;
+
+tuple_type
+    : '(' tuple_element (',' tuple_element)+ ')'
+    ;
+
+tuple_element
+    : type_ identifier?
+    ;
+
+simple_type 
+	: numeric_type
+	| BOOL
+	;
+
+numeric_type 
+	: integral_type
+	| floating_point_type
+	| DECIMAL
+	;
+
+integral_type 
+	: SBYTE
+	| BYTE
+	| SHORT
+	| USHORT
+	| INT
+	| UINT
+	| LONG
+	| ULONG
+	| CHAR
+	;
+
+floating_point_type 
+	: FLOAT
+	| DOUBLE
+	;
+
+/** namespace_or_type_name, OBJECT, STRING */
+class_type 
+	: namespace_or_type_name
+	| OBJECT
+	| DYNAMIC
+	| STRING
+	;
+
+type_argument_list 
+	: '<' type_ ( ',' type_)* '>'
+	;
+
+//B.2.4 Expressions
+argument_list 
+	: argument ( ',' argument)*
+	;
+
+argument
+	: (identifier ':')? refout=(REF | OUT | IN)? (VAR | type_)? expression
+	;
+
+expression
+	: assignment
+	| non_assignment_expression
+	| REF non_assignment_expression
+	;
+
+non_assignment_expression
+	: lambda_expression
+	| query_expression
+	| conditional_expression
+	;
+
+assignment
+	: unary_expression assignment_operator expression
+	| unary_expression '??=' throwable_expression
+	;
+
+assignment_operator
+	: '=' | '+=' | '-=' | '*=' | '/=' | '%=' | '&=' | '|=' | '^=' | '<<=' | right_shift_assignment
+	;
+
+conditional_expression
+	: null_coalescing_expression ('?' throwable_expression ':' throwable_expression)?
+	;
+
+null_coalescing_expression
+	: conditional_or_expression ('??' (null_coalescing_expression | throw_expression))?
+	;
+
+conditional_or_expression
+	: conditional_and_expression (OP_OR conditional_and_expression)*
+	;
+
+conditional_and_expression
+	: inclusive_or_expression (OP_AND inclusive_or_expression)*
+	;
+
+inclusive_or_expression
+	: exclusive_or_expression ('|' exclusive_or_expression)*
+	;
+
+exclusive_or_expression
+	: and_expression ('^' and_expression)*
+	;
+
+and_expression
+	: equality_expression ('&' equality_expression)*
+	;
+
+equality_expression
+	: relational_expression ((OP_EQ | OP_NE)  relational_expression)*
+	;
+
+relational_expression
+	: shift_expression (('<' | '>' | '<=' | '>=') shift_expression | IS isType | AS type_)*
+	;
+
+shift_expression
+	: additive_expression (('<<' | right_shift)  additive_expression)*
+	;
+
+additive_expression
+	: multiplicative_expression (('+' | '-')  multiplicative_expression)*
+	;
+
+multiplicative_expression
+	: switch_expression (('*' | '/' | '%')  switch_expression)*
+	;
+
+switch_expression
+    : range_expression ('switch' '{' (switch_expression_arms ','?)? '}')?
+    ;
+
+switch_expression_arms
+    : switch_expression_arm (',' switch_expression_arm)*
+    ;
+
+switch_expression_arm
+    : expression case_guard? right_arrow throwable_expression
+    ;
+
+range_expression
+    : unary_expression
+    | unary_expression? OP_RANGE unary_expression?
+    ;
+
+// https://msdn.microsoft.com/library/6a71f45d(v=vs.110).aspx
+unary_expression
+	: primary_expression
+	| '+' unary_expression
+	| '-' unary_expression
+	| BANG unary_expression
+	| '~' unary_expression
+	| '++' unary_expression
+	| '--' unary_expression
+	| OPEN_PARENS type_ CLOSE_PARENS unary_expression
+	| AWAIT unary_expression // C# 5
+	| '&' unary_expression
+	| '*' unary_expression
+	| '^' unary_expression // C# 8 ranges
+	;
+
+primary_expression  // Null-conditional operators C# 6: https://msdn.microsoft.com/en-us/library/dn986595.aspx
+	: pe=primary_expression_start '!'? bracket_expression* '!'?
+	  (((member_access | method_invocation | '++' | '--' | '->' identifier) '!'?) bracket_expression* '!'?)*
+	;
+
+primary_expression_start
+	: literal                                   #literalExpression
+	| identifier type_argument_list?            #simpleNameExpression
+	| OPEN_PARENS expression CLOSE_PARENS       #parenthesisExpressions
+	| predefined_type                           #memberAccessExpression
+	| qualified_alias_member                    #memberAccessExpression
+	| LITERAL_ACCESS                            #literalAccessExpression
+	| THIS                                      #thisReferenceExpression
+	| BASE ('.' identifier type_argument_list? | '[' expression_list ']') #baseAccessExpression
+	| NEW (type_ (object_creation_expression
+	             | object_or_collection_initializer
+	             | '[' expression_list ']' rank_specifier* array_initializer?
+	             | rank_specifier+ array_initializer)
+	      | anonymous_object_initializer
+	      | rank_specifier array_initializer)                       #objectCreationExpression
+	| OPEN_PARENS argument ( ',' argument )+ CLOSE_PARENS           #tupleExpression
+	| TYPEOF OPEN_PARENS (unbound_type_name | type_ | VOID) CLOSE_PARENS   #typeofExpression
+	| CHECKED OPEN_PARENS expression CLOSE_PARENS                   #checkedExpression
+	| UNCHECKED OPEN_PARENS expression CLOSE_PARENS                 #uncheckedExpression
+	| DEFAULT (OPEN_PARENS type_ CLOSE_PARENS)?                     #defaultValueExpression
+	| ASYNC? DELEGATE (OPEN_PARENS explicit_anonymous_function_parameter_list? CLOSE_PARENS)? block #anonymousMethodExpression
+	| SIZEOF OPEN_PARENS type_ CLOSE_PARENS                          #sizeofExpression
+	// C# 6: https://msdn.microsoft.com/en-us/library/dn986596.aspx
+	| NAMEOF OPEN_PARENS (identifier '.')* identifier CLOSE_PARENS  #nameofExpression
+	;
+
+throwable_expression
+	: expression
+	| throw_expression
+	;
+
+throw_expression
+	: THROW expression
+	;
+
+member_access
+	: '?'? '.' identifier type_argument_list?
+	;
+
+bracket_expression
+	: '?'? '[' indexer_argument ( ',' indexer_argument)* ']'
+	;
+
+indexer_argument
+	: (identifier ':')? expression
+	;
+
+predefined_type
+	: BOOL | BYTE | CHAR | DECIMAL | DOUBLE | FLOAT | INT | LONG
+	| OBJECT | SBYTE | SHORT | STRING | UINT | ULONG | USHORT
+	;
+
+expression_list
+	: expression (',' expression)*
+	;
+
+object_or_collection_initializer
+	: object_initializer
+	| collection_initializer
+	;
+
+object_initializer
+	: OPEN_BRACE (member_initializer_list ','?)? CLOSE_BRACE
+	;
+
+member_initializer_list
+	: member_initializer (',' member_initializer)*
+	;
+
+member_initializer
+	: (identifier | '[' expression ']') '=' initializer_value // C# 6
+	;
+
+initializer_value
+	: expression
+	| object_or_collection_initializer
+	;
+
+collection_initializer
+	: OPEN_BRACE element_initializer (',' element_initializer)* ','? CLOSE_BRACE
+	;
+
+element_initializer
+	: non_assignment_expression
+	| OPEN_BRACE expression_list CLOSE_BRACE
+	;
+
+anonymous_object_initializer
+	: OPEN_BRACE (member_declarator_list ','?)? CLOSE_BRACE
+	;
+
+member_declarator_list
+	: member_declarator ( ',' member_declarator)*
+	;
+
+member_declarator
+	: primary_expression
+	| identifier '=' expression
+	;
+
+unbound_type_name
+	: identifier ( generic_dimension_specifier? | '::' identifier generic_dimension_specifier?)
+	  ('.' identifier generic_dimension_specifier?)*
+	;
+
+generic_dimension_specifier
+	: '<' ','* '>'
+	;
+
+isType
+	: base_type (rank_specifier | '*')* '?'? isTypePatternArms? identifier?
+	;
+
+isTypePatternArms
+	: '{' isTypePatternArm (',' isTypePatternArm)* '}'
+	;
+
+isTypePatternArm
+	: identifier ':' expression
+	;
+
+lambda_expression
+	: ASYNC? anonymous_function_signature right_arrow anonymous_function_body
+	;
+
+anonymous_function_signature
+	: OPEN_PARENS CLOSE_PARENS
+	| OPEN_PARENS explicit_anonymous_function_parameter_list CLOSE_PARENS
+	| OPEN_PARENS implicit_anonymous_function_parameter_list CLOSE_PARENS
+	| identifier
+	;
+
+explicit_anonymous_function_parameter_list
+	: explicit_anonymous_function_parameter ( ',' explicit_anonymous_function_parameter)*
+	;
+
+explicit_anonymous_function_parameter
+	: refout=(REF | OUT | IN)? type_ identifier
+	;
+
+implicit_anonymous_function_parameter_list
+	: identifier (',' identifier)*
+	;
+
+anonymous_function_body
+	: throwable_expression
+	| block
+	;
+
+query_expression
+	: from_clause query_body
+	;
+
+from_clause
+	: FROM type_? identifier IN expression
+	;
+
+query_body
+	: query_body_clause* select_or_group_clause query_continuation?
+	;
+
+query_body_clause
+	: from_clause
+	| let_clause
+	| where_clause
+	| combined_join_clause
+	| orderby_clause
+	;
+
+let_clause
+	: LET identifier '=' expression
+	;
+
+where_clause
+	: WHERE expression
+	;
+
+combined_join_clause
+	: JOIN type_? identifier IN expression ON expression EQUALS expression (INTO identifier)?
+	;
+
+orderby_clause
+	: ORDERBY ordering (','  ordering)*
+	;
+
+ordering
+	: expression dir=(ASCENDING | DESCENDING)?
+	;
+
+select_or_group_clause
+	: SELECT expression
+	| GROUP expression BY expression
+	;
+
+query_continuation
+	: INTO identifier query_body
+	;
+
+//B.2.5 Statements
+statement
+	: labeled_Statement
+	| declarationStatement
+	| embedded_statement
+	;
+
+declarationStatement
+	: local_variable_declaration ';'
+	| local_constant_declaration ';'
+	| local_function_declaration
+	;
+
+local_function_declaration
+    : local_function_header local_function_body
+    ;
+
+local_function_header
+    : local_function_modifiers? return_type identifier type_parameter_list?
+        OPEN_PARENS formal_parameter_list? CLOSE_PARENS type_parameter_constraints_clauses?
+    ;
+
+local_function_modifiers
+    : (ASYNC | UNSAFE) STATIC?
+    | STATIC (ASYNC | UNSAFE)
+    ;
+
+local_function_body
+    : block
+    | right_arrow throwable_expression ';'
+    ;
+
+labeled_Statement
+	: identifier ':' statement  
+	;
+
+embedded_statement
+	: block
+	| simple_embedded_statement
+	;
+
+simple_embedded_statement
+	: ';'                                                         #theEmptyStatement
+	| expression ';'                                              #expressionStatement
+
+	// selection statements
+	| IF OPEN_PARENS expression CLOSE_PARENS if_body (ELSE if_body)?               #ifStatement
+    | SWITCH OPEN_PARENS expression CLOSE_PARENS OPEN_BRACE switch_section* CLOSE_BRACE           #switchStatement
+
+    // iteration statements
+	| WHILE OPEN_PARENS expression CLOSE_PARENS embedded_statement                                        #whileStatement
+	| DO embedded_statement WHILE OPEN_PARENS expression CLOSE_PARENS ';'                                 #doStatement
+	| FOR OPEN_PARENS for_initializer? ';' expression? ';' for_iterator? CLOSE_PARENS embedded_statement  #forStatement
+	| AWAIT? FOREACH OPEN_PARENS local_variable_type identifier IN expression CLOSE_PARENS embedded_statement    #foreachStatement
+
+    // jump statements
+	| BREAK ';'                                                   #breakStatement
+	| CONTINUE ';'                                                #continueStatement
+	| GOTO (identifier | CASE expression | DEFAULT) ';'           #gotoStatement
+	| RETURN expression? ';'                                      #returnStatement
+	| THROW expression? ';'                                       #throwStatement
+
+	| TRY block (catch_clauses finally_clause? | finally_clause)  #tryStatement
+	| CHECKED block                                               #checkedStatement
+	| UNCHECKED block                                             #uncheckedStatement
+	| LOCK OPEN_PARENS expression CLOSE_PARENS embedded_statement                  #lockStatement
+	| USING OPEN_PARENS resource_acquisition CLOSE_PARENS embedded_statement       #usingStatement
+	| YIELD (RETURN expression | BREAK) ';'                       #yieldStatement
+
+	// unsafe statements
+	| UNSAFE block                                                                       #unsafeStatement
+	| FIXED OPEN_PARENS pointer_type fixed_pointer_declarators CLOSE_PARENS embedded_statement            #fixedStatement
+	;
+
+block
+	: OPEN_BRACE statement_list? CLOSE_BRACE
+	;
+
+local_variable_declaration
+	: (USING | REF | REF READONLY)? local_variable_type local_variable_declarator ( ','  local_variable_declarator { this.IsLocalVariableDeclaration() }? )*
+	| FIXED pointer_type fixed_pointer_declarators
+	;
+
+local_variable_type 
+	: VAR
+	| type_
+	;
+
+local_variable_declarator
+	: identifier ('=' REF? local_variable_initializer )?
+	;
+
+local_variable_initializer
+	: expression
+	| array_initializer
+	| stackalloc_initializer
+	;
+
+local_constant_declaration
+	: CONST type_ constant_declarators
+	;
+
+if_body
+	: block
+	| simple_embedded_statement
+	;
+
+switch_section
+	: switch_label+ statement_list
+	;
+
+switch_label
+	: CASE expression case_guard? ':'
+	| DEFAULT ':'
+	;
+
+case_guard
+	: WHEN expression
+	;
+
+statement_list
+	: statement+
+	;
+
+for_initializer
+	: local_variable_declaration
+	| expression (','  expression)*
+	;
+
+for_iterator
+	: expression (','  expression)*
+	;
+
+catch_clauses
+	: specific_catch_clause (specific_catch_clause)* general_catch_clause?
+	| general_catch_clause
+	;
+
+specific_catch_clause
+	: CATCH OPEN_PARENS class_type identifier? CLOSE_PARENS exception_filter? block
+	;
+
+general_catch_clause
+	: CATCH exception_filter? block
+	;
+
+exception_filter // C# 6
+	: WHEN OPEN_PARENS expression CLOSE_PARENS
+	;
+
+finally_clause
+	: FINALLY block
+	;
+
+resource_acquisition
+	: local_variable_declaration
+	| expression
+	;
+
+//B.2.6 Namespaces;
+namespace_declaration
+	: NAMESPACE qi=qualified_identifier namespace_body ';'?
+	;
+
+qualified_identifier
+	: identifier ( '.'  identifier )*
+	;
+
+namespace_body
+	: OPEN_BRACE extern_alias_directives? using_directives? namespace_member_declarations? CLOSE_BRACE
+	;
+
+extern_alias_directives
+	: extern_alias_directive+
+	;
+
+extern_alias_directive
+	: EXTERN ALIAS identifier ';'
+	;
+
+using_directives
+	: using_directive+
+	;
+
+using_directive
+	: USING identifier '=' namespace_or_type_name ';'            #usingAliasDirective
+	| USING namespace_or_type_name ';'                           #usingNamespaceDirective
+	// C# 6: https://msdn.microsoft.com/en-us/library/ms228593.aspx
+	| USING STATIC namespace_or_type_name ';'                    #usingStaticDirective
+	;
+
+namespace_member_declarations
+	: namespace_member_declaration+
+	;
+
+namespace_member_declaration
+	: namespace_declaration
+	| type_declaration
+	;
+
+type_declaration
+	: attributes? all_member_modifiers?
+      (class_definition | struct_definition | interface_definition | enum_definition | delegate_definition)
+  ;
+
+qualified_alias_member
+	: identifier '::' identifier type_argument_list?
+	;
+
+//B.2.7 Classes;
+type_parameter_list
+	: '<' type_parameter (','  type_parameter)* '>'
+	;
+
+type_parameter
+	: attributes? identifier
+	;
+
+class_base
+	: ':' class_type (','  namespace_or_type_name)*
+	;
+
+interface_type_list
+	: namespace_or_type_name (','  namespace_or_type_name)*
+	;
+
+type_parameter_constraints_clauses
+	: type_parameter_constraints_clause+
+	;
+
+type_parameter_constraints_clause
+	: WHERE identifier ':' type_parameter_constraints
+	;
+
+type_parameter_constraints
+	: constructor_constraint
+	| primary_constraint (',' secondary_constraints)? (',' constructor_constraint)?
+	;
+
+primary_constraint
+	: class_type
+	| CLASS '?'?
+	| STRUCT
+	| UNMANAGED
+	;
+
+// namespace_or_type_name includes identifier
+secondary_constraints
+	: namespace_or_type_name (',' namespace_or_type_name)*
+	;
+
+constructor_constraint
+	: NEW OPEN_PARENS CLOSE_PARENS
+	;
+
+class_body
+	: OPEN_BRACE class_member_declarations? CLOSE_BRACE
+	;
+
+class_member_declarations
+	: class_member_declaration+
+	;
+
+class_member_declaration
+	: attributes? all_member_modifiers? (common_member_declaration | destructor_definition)
+	;
+
+all_member_modifiers
+	: all_member_modifier+
+	;
+
+all_member_modifier
+	: NEW
+	| PUBLIC
+	| PROTECTED
+	| INTERNAL
+	| PRIVATE
+	| READONLY
+	| VOLATILE
+	| VIRTUAL
+	| SEALED
+	| OVERRIDE
+	| ABSTRACT
+	| STATIC
+	| UNSAFE
+	| EXTERN
+	| PARTIAL
+	| ASYNC  // C# 5
+	;
+
+// represents the intersection of struct_member_declaration and class_member_declaration
+common_member_declaration
+	: constant_declaration
+	| typed_member_declaration
+	| event_declaration
+	| conversion_operator_declarator (body | right_arrow throwable_expression ';') // C# 6
+	| constructor_declaration
+	| VOID method_declaration
+	| class_definition
+	| struct_definition
+	| interface_definition
+	| enum_definition
+	| delegate_definition
+	;
+
+typed_member_declaration
+	: (REF | READONLY REF | REF READONLY)? type_
+	  ( namespace_or_type_name '.' indexer_declaration
+	  | method_declaration
+	  | property_declaration
+	  | indexer_declaration
+	  | operator_declaration
+	  | field_declaration
+	  )
+	;
+
+constant_declarators
+	: constant_declarator (','  constant_declarator)*
+	;
+
+constant_declarator
+	: identifier '=' expression
+	;
+
+variable_declarators
+	: variable_declarator (','  variable_declarator)*
+	;
+
+variable_declarator
+	: identifier ('=' variable_initializer)?
+	;
+
+variable_initializer
+	: expression
+	| array_initializer
+	;
+
+return_type
+	: type_
+	| VOID
+	;
+
+member_name
+	: namespace_or_type_name
+	;
+
+method_body
+	: block
+	| ';'
+	;
+
+formal_parameter_list
+	: parameter_array
+	| fixed_parameters (',' parameter_array)?
+	;
+
+fixed_parameters
+	: fixed_parameter ( ',' fixed_parameter )*
+	;
+
+fixed_parameter
+	: attributes? parameter_modifier? arg_declaration
+	| ARGLIST
+	;
+
+parameter_modifier
+	: REF
+	| OUT
+	| IN
+	| REF THIS
+	| IN THIS
+	| THIS
+	;
+
+parameter_array
+	: attributes? PARAMS array_type identifier
+	;
+
+accessor_declarations
+	: attrs=attributes? mods=accessor_modifier?
+	  (GET accessor_body set_accessor_declaration? | SET accessor_body get_accessor_declaration?)
+	;
+
+get_accessor_declaration
+	: attributes? accessor_modifier? GET accessor_body
+	;
+
+set_accessor_declaration
+	: attributes? accessor_modifier? SET accessor_body
+	;
+
+accessor_modifier
+	: PROTECTED
+	| INTERNAL
+	| PRIVATE
+	| PROTECTED INTERNAL
+	| INTERNAL PROTECTED
+	;
+
+accessor_body
+	: block
+	| ';'
+	;
+
+event_accessor_declarations
+	: attributes? (ADD block remove_accessor_declaration | REMOVE block add_accessor_declaration)
+	;
+
+add_accessor_declaration
+	: attributes? ADD block
+	;
+
+remove_accessor_declaration
+	: attributes? REMOVE block
+	;
+
+overloadable_operator
+	: '+'
+	| '-'
+	| BANG
+	| '~'
+	| '++'
+	| '--'
+	| TRUE
+	| FALSE
+	| '*'
+	| '/'
+	| '%'
+	| '&'
+	| '|'
+	| '^'
+	| '<<'
+	| right_shift
+	| OP_EQ
+	| OP_NE
+	| '>'
+	| '<'
+	| '>='
+	| '<='
+	;
+
+conversion_operator_declarator
+	: (IMPLICIT | EXPLICIT) OPERATOR type_ OPEN_PARENS arg_declaration CLOSE_PARENS
+	;
+
+constructor_initializer
+	: ':' (BASE | THIS) OPEN_PARENS argument_list? CLOSE_PARENS
+	;
+
+body
+	: block
+	| ';'
+	;
+
+//B.2.8 Structs
+struct_interfaces
+	: ':' interface_type_list
+	;
+
+struct_body
+	: OPEN_BRACE struct_member_declaration* CLOSE_BRACE
+	;
+
+struct_member_declaration
+	: attributes? all_member_modifiers?
+	  (common_member_declaration | FIXED type_ fixed_size_buffer_declarator+ ';')
+	;
+
+//B.2.9 Arrays
+array_type
+	: base_type (('*' | '?')* rank_specifier)+
+	;
+
+rank_specifier
+	: '[' ','* ']'
+	;
+
+array_initializer
+	: OPEN_BRACE (variable_initializer (','  variable_initializer)* ','?)? CLOSE_BRACE
+	;
+
+//B.2.10 Interfaces
+variant_type_parameter_list
+	: '<' variant_type_parameter (',' variant_type_parameter)* '>'
+	;
+
+variant_type_parameter
+	: attributes? variance_annotation? identifier
+	;
+
+variance_annotation
+	: IN | OUT
+	;
+
+interface_base
+	: ':' interface_type_list
+	;
+
+interface_body // ignored in csharp 8
+	: OPEN_BRACE interface_member_declaration* CLOSE_BRACE
+	;
+
+interface_member_declaration
+	: attributes? NEW?
+	  (UNSAFE? (REF | REF READONLY | READONLY REF)? type_
+	    ( identifier type_parameter_list? OPEN_PARENS formal_parameter_list? CLOSE_PARENS type_parameter_constraints_clauses? ';'
+	    | identifier OPEN_BRACE interface_accessors CLOSE_BRACE
+	    | THIS '[' formal_parameter_list ']' OPEN_BRACE interface_accessors CLOSE_BRACE)
+	  | UNSAFE? VOID identifier type_parameter_list? OPEN_PARENS formal_parameter_list? CLOSE_PARENS type_parameter_constraints_clauses? ';'
+	  | EVENT type_ identifier ';')
+	;
+
+interface_accessors
+	: attributes? (GET ';' (attributes? SET ';')? | SET ';' (attributes? GET ';')?)
+	;
+
+//B.2.11 Enums
+enum_base
+	: ':' type_
+	;
+
+enum_body
+	: OPEN_BRACE (enum_member_declaration (','  enum_member_declaration)* ','?)? CLOSE_BRACE
+	;
+
+enum_member_declaration
+	: attributes? identifier ('=' expression)?
+	;
+
+//B.2.12 Delegates
+
+//B.2.13 Attributes
+global_attribute_section
+	: '[' global_attribute_target ':' attribute_list ','? ']'
+	;
+
+global_attribute_target
+	: keyword
+	| identifier
+	;
+
+attributes
+	: attribute_section+
+	;
+
+attribute_section
+	: '[' (attribute_target ':')? attribute_list ','? ']'
+	;
+
+attribute_target
+	: keyword
+	| identifier
+	;
+
+attribute_list
+	: attribute (','  attribute)*
+	;
+
+attribute
+	: namespace_or_type_name (OPEN_PARENS (attribute_argument (','  attribute_argument)*)? CLOSE_PARENS)?
+	;
+
+attribute_argument
+	: (identifier ':')? expression
+	;
+
+//B.3 Grammar extensions for unsafe code
+pointer_type
+	: (simple_type | class_type) (rank_specifier | '?')* '*'
+	| VOID '*'
+	;
+
+fixed_pointer_declarators
+	: fixed_pointer_declarator (','  fixed_pointer_declarator)*
+	;
+
+fixed_pointer_declarator
+	: identifier '=' fixed_pointer_initializer
+	;
+
+fixed_pointer_initializer
+	: '&'? expression
+	| stackalloc_initializer
+	;
+
+fixed_size_buffer_declarator
+	: identifier '[' expression ']'
+	;
+
+stackalloc_initializer
+	: STACKALLOC type_ '[' expression ']'
+	| STACKALLOC type_? '[' expression? ']' OPEN_BRACE expression (',' expression)* ','? CLOSE_BRACE
+	;
+
+right_arrow
+	: first='=' second='>' {$first.index + 1 == $second.index}? // Nothing between the tokens?
+	;
+
+right_shift
+	: first='>' second='>' {$first.index + 1 == $second.index}? // Nothing between the tokens?
+	;
+
+right_shift_assignment
+	: first='>' second='>=' {$first.index + 1 == $second.index}? // Nothing between the tokens?
+	;
+
+literal
+	: boolean_literal
+	| string_literal
+	| INTEGER_LITERAL
+	| HEX_INTEGER_LITERAL
+	| BIN_INTEGER_LITERAL
+	| REAL_LITERAL
+	| CHARACTER_LITERAL
+	| NULL_
+	;
+
+boolean_literal
+	: TRUE
+	| FALSE
+	;
+
+string_literal
+	: interpolated_regular_string
+	| interpolated_verbatium_string
+	| REGULAR_STRING
+	| VERBATIUM_STRING
+	;
+
+interpolated_regular_string
+	: INTERPOLATED_REGULAR_STRING_START interpolated_regular_string_part* DOUBLE_QUOTE_INSIDE
+	;
+
+
+interpolated_verbatium_string
+	: INTERPOLATED_VERBATIUM_STRING_START interpolated_verbatium_string_part* DOUBLE_QUOTE_INSIDE
+	;
+
+interpolated_regular_string_part
+	: interpolated_string_expression
+	| DOUBLE_CURLY_INSIDE
+	| REGULAR_CHAR_INSIDE
+	| REGULAR_STRING_INSIDE
+	;
+
+interpolated_verbatium_string_part
+	: interpolated_string_expression
+	| DOUBLE_CURLY_INSIDE
+	| VERBATIUM_DOUBLE_QUOTE_INSIDE
+	| VERBATIUM_INSIDE_STRING
+	;
+
+interpolated_string_expression
+	: expression (',' expression)* (':' FORMAT_STRING+)?
+	;
+
+//B.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
+	| UNMANAGED
+	| UNSAFE
+	| USHORT
+	| USING
+	| VIRTUAL
+	| VOID
+	| VOLATILE
+	| WHILE
+	;
+
+// -------------------- extra rules for modularization --------------------------------
+
+class_definition
+	: CLASS identifier type_parameter_list? class_base? type_parameter_constraints_clauses?
+	    class_body ';'?
+	;
+
+struct_definition
+	: (READONLY | REF)? STRUCT identifier type_parameter_list? struct_interfaces? type_parameter_constraints_clauses?
+	    struct_body ';'?
+	;
+
+interface_definition
+	: INTERFACE identifier variant_type_parameter_list? interface_base?
+	    type_parameter_constraints_clauses? class_body ';'?
+	;
+
+enum_definition
+	: ENUM identifier enum_base? enum_body ';'?
+	;
+
+delegate_definition
+	: DELEGATE return_type identifier variant_type_parameter_list?
+	  OPEN_PARENS formal_parameter_list? CLOSE_PARENS type_parameter_constraints_clauses? ';'
+	;
+
+event_declaration
+	: EVENT type_ (variable_declarators ';' | member_name OPEN_BRACE event_accessor_declarations CLOSE_BRACE)
+	;
+
+field_declaration
+	: variable_declarators ';'
+	;
+
+property_declaration // Property initializer & lambda in properties C# 6
+	: member_name (OPEN_BRACE accessor_declarations CLOSE_BRACE ('=' variable_initializer ';')? | right_arrow throwable_expression ';')
+	;
+
+constant_declaration
+	: CONST type_ constant_declarators ';'
+	;
+
+indexer_declaration // lamdas from C# 6
+	: THIS '[' formal_parameter_list ']' (OPEN_BRACE accessor_declarations CLOSE_BRACE | right_arrow throwable_expression ';')
+	;
+
+destructor_definition
+	: '~' identifier OPEN_PARENS CLOSE_PARENS body
+	;
+
+constructor_declaration
+	: identifier OPEN_PARENS formal_parameter_list? CLOSE_PARENS constructor_initializer? body
+	;
+
+method_declaration // lamdas from C# 6
+	: method_member_name type_parameter_list? OPEN_PARENS formal_parameter_list? CLOSE_PARENS
+	    type_parameter_constraints_clauses? (method_body | right_arrow throwable_expression ';')
+	;
+
+method_member_name
+	: (identifier | identifier '::' identifier) (type_argument_list? '.' identifier)*
+	;
+
+operator_declaration // lamdas form C# 6
+	: OPERATOR overloadable_operator OPEN_PARENS IN? arg_declaration
+	       (',' IN? arg_declaration)? CLOSE_PARENS (body | right_arrow throwable_expression ';')
+	;
+
+arg_declaration
+	: type_ identifier ('=' expression)?
+	;
+
+method_invocation
+	: OPEN_PARENS argument_list? CLOSE_PARENS
+	;
+
+object_creation_expression
+	: OPEN_PARENS argument_list? CLOSE_PARENS object_or_collection_initializer?
+	;
+
+identifier
+	: IDENTIFIER
+	| ADD
+	| ALIAS
+	| ARGLIST
+	| ASCENDING
+	| ASYNC
+	| AWAIT
+	| BY
+	| DESCENDING
+	| DYNAMIC
+	| EQUALS
+	| FROM
+	| GET
+	| GROUP
+	| INTO
+	| JOIN
+	| LET
+	| NAMEOF
+	| ON
+	| ORDERBY
+	| PARTIAL
+	| REMOVE
+	| SELECT
+	| SET
+	| UNMANAGED
+	| VAR
+	| WHEN
+	| WHERE
+	| YIELD
+	;

+ 40 - 0
jplag.frontend.csharp-6/src/main/antlr4/de/jplag/csharp/grammar/CSharpPreprocessorParser.g4

@@ -0,0 +1,40 @@
+// Eclipse Public License - v 1.0, http://www.eclipse.org/legal/epl-v10.html
+// Copyright (c) 2013, Christian Wulf (chwchw@gmx.de)
+// Copyright (c) 2016-2017, Ivan Kochurkin (kvanttt@gmail.com), Positive Technologies.
+
+parser grammar CSharpPreprocessorParser;
+
+options { tokenVocab=CSharpLexer; superClass=CSharpPreprocessorParserBase; }
+
+preprocessor_directive returns [Boolean value]
+	: DEFINE CONDITIONAL_SYMBOL directive_new_line_or_sharp { this.OnPreprocessorDirectiveDefine(); }  #preprocessorDeclaration
+	| UNDEF CONDITIONAL_SYMBOL directive_new_line_or_sharp { this.OnPreprocessorDirectiveUndef(); } #preprocessorDeclaration
+	| IF expr=preprocessor_expression directive_new_line_or_sharp { this.OnPreprocessorDirectiveIf(); }	  #preprocessorConditional
+	| ELIF expr=preprocessor_expression directive_new_line_or_sharp { this.OnPreprocessorDirectiveElif(); } #preprocessorConditional
+	| ELSE directive_new_line_or_sharp { this.OnPreprocessorDirectiveElse(); }    #preprocessorConditional
+	| ENDIF directive_new_line_or_sharp { this.OnPreprocessorDirectiveEndif(); } #preprocessorConditional
+	| LINE (DIGITS STRING? | DEFAULT | DIRECTIVE_HIDDEN) directive_new_line_or_sharp { this.OnPreprocessorDirectiveLine(); } #preprocessorLine
+	| ERROR TEXT directive_new_line_or_sharp { this.OnPreprocessorDirectiveError(); }   #preprocessorDiagnostic
+	| WARNING TEXT directive_new_line_or_sharp { this.OnPreprocessorDirectiveWarning(); }   #preprocessorDiagnostic
+	| REGION TEXT? directive_new_line_or_sharp { this.OnPreprocessorDirectiveRegion(); }   #preprocessorRegion
+	| ENDREGION TEXT? directive_new_line_or_sharp { this.OnPreprocessorDirectiveEndregion(); }   #preprocessorRegion
+	| PRAGMA TEXT directive_new_line_or_sharp { this.OnPreprocessorDirectivePragma(); }   #preprocessorPragma
+	| NULLABLE TEXT directive_new_line_or_sharp { this.OnPreprocessorDirectiveNullable(); }   #preprocessorNullable
+	;
+
+directive_new_line_or_sharp
+    : DIRECTIVE_NEW_LINE
+    | EOF
+    ;
+
+preprocessor_expression returns [String value]
+	: TRUE { this.OnPreprocessorExpressionTrue(); }
+	| FALSE { this.OnPreprocessorExpressionFalse(); }
+	| CONDITIONAL_SYMBOL { this.OnPreprocessorExpressionConditionalSymbol(); }
+	| OPEN_PARENS expr=preprocessor_expression CLOSE_PARENS { this.OnPreprocessorExpressionConditionalOpenParens(); }
+	| BANG expr=preprocessor_expression { this.OnPreprocessorExpressionConditionalBang(); }
+	| expr1=preprocessor_expression OP_EQ expr2=preprocessor_expression { this.OnPreprocessorExpressionConditionalEq(); }
+	| expr1=preprocessor_expression OP_NE expr2=preprocessor_expression { this.OnPreprocessorExpressionConditionalNe(); }
+	| expr1=preprocessor_expression OP_AND expr2=preprocessor_expression { this.OnPreprocessorExpressionConditionalAnd(); }
+	| expr1=preprocessor_expression OP_OR expr2=preprocessor_expression { this.OnPreprocessorExpressionConditionalOr(); }
+	;

+ 423 - 0
jplag.frontend.csharp-6/src/main/java/de/jplag/csharp/CSharpListener.java

@@ -0,0 +1,423 @@
+package de.jplag.csharp;
+
+import org.antlr.v4.runtime.Token;
+
+import de.jplag.csharp.grammar.CSharpParser.Array_initializerContext;
+import de.jplag.csharp.grammar.CSharpParser.Assignment_operatorContext;
+import de.jplag.csharp.grammar.CSharpParser.AttributeContext;
+import de.jplag.csharp.grammar.CSharpParser.BreakStatementContext;
+import de.jplag.csharp.grammar.CSharpParser.Catch_clausesContext;
+import de.jplag.csharp.grammar.CSharpParser.CheckedStatementContext;
+import de.jplag.csharp.grammar.CSharpParser.Class_bodyContext;
+import de.jplag.csharp.grammar.CSharpParser.Class_definitionContext;
+import de.jplag.csharp.grammar.CSharpParser.Constant_declaratorContext;
+import de.jplag.csharp.grammar.CSharpParser.Constructor_declarationContext;
+import de.jplag.csharp.grammar.CSharpParser.ContinueStatementContext;
+import de.jplag.csharp.grammar.CSharpParser.Delegate_definitionContext;
+import de.jplag.csharp.grammar.CSharpParser.Destructor_definitionContext;
+import de.jplag.csharp.grammar.CSharpParser.DoStatementContext;
+import de.jplag.csharp.grammar.CSharpParser.Enum_bodyContext;
+import de.jplag.csharp.grammar.CSharpParser.Enum_definitionContext;
+import de.jplag.csharp.grammar.CSharpParser.Enum_member_declarationContext;
+import de.jplag.csharp.grammar.CSharpParser.Event_declarationContext;
+import de.jplag.csharp.grammar.CSharpParser.Finally_clauseContext;
+import de.jplag.csharp.grammar.CSharpParser.FixedStatementContext;
+import de.jplag.csharp.grammar.CSharpParser.ForStatementContext;
+import de.jplag.csharp.grammar.CSharpParser.ForeachStatementContext;
+import de.jplag.csharp.grammar.CSharpParser.GotoStatementContext;
+import de.jplag.csharp.grammar.CSharpParser.IfStatementContext;
+import de.jplag.csharp.grammar.CSharpParser.If_bodyContext;
+import de.jplag.csharp.grammar.CSharpParser.Indexer_declarationContext;
+import de.jplag.csharp.grammar.CSharpParser.Interface_bodyContext;
+import de.jplag.csharp.grammar.CSharpParser.Interface_definitionContext;
+import de.jplag.csharp.grammar.CSharpParser.LockStatementContext;
+import de.jplag.csharp.grammar.CSharpParser.Method_bodyContext;
+import de.jplag.csharp.grammar.CSharpParser.Method_declarationContext;
+import de.jplag.csharp.grammar.CSharpParser.Method_invocationContext;
+import de.jplag.csharp.grammar.CSharpParser.Namespace_bodyContext;
+import de.jplag.csharp.grammar.CSharpParser.Object_creation_expressionContext;
+import de.jplag.csharp.grammar.CSharpParser.Operator_declarationContext;
+import de.jplag.csharp.grammar.CSharpParser.Property_declarationContext;
+import de.jplag.csharp.grammar.CSharpParser.ReturnStatementContext;
+import de.jplag.csharp.grammar.CSharpParser.Struct_bodyContext;
+import de.jplag.csharp.grammar.CSharpParser.Struct_definitionContext;
+import de.jplag.csharp.grammar.CSharpParser.SwitchStatementContext;
+import de.jplag.csharp.grammar.CSharpParser.Switch_sectionContext;
+import de.jplag.csharp.grammar.CSharpParser.ThrowStatementContext;
+import de.jplag.csharp.grammar.CSharpParser.TryStatementContext;
+import de.jplag.csharp.grammar.CSharpParser.UncheckedExpressionContext;
+import de.jplag.csharp.grammar.CSharpParser.UnsafeStatementContext;
+import de.jplag.csharp.grammar.CSharpParser.UsingStatementContext;
+import de.jplag.csharp.grammar.CSharpParser.Using_directivesContext;
+import de.jplag.csharp.grammar.CSharpParser.Variable_declaratorContext;
+import de.jplag.csharp.grammar.CSharpParser.WhileStatementContext;
+import de.jplag.csharp.grammar.CSharpParserBaseListener;
+
+/**
+ * Listener class for visiting the C# ANTLR parse tree. Transforms selected ANTLR token into JPlag tokens.
+ * @author Timur Saglam
+ */
+public class CSharpListener extends CSharpParserBaseListener implements CSharpTokenConstants {
+
+    private final CSharpParserAdapter parserAdapter;
+
+    /**
+     * Creates the listener.
+     * @param parserAdapter is the JPlag parser adapter which receives the transformed tokens.
+     */
+    public CSharpListener(CSharpParserAdapter parserAdapter) {
+        this.parserAdapter = parserAdapter;
+    }
+
+    /**
+     * Transforms an ANTLR Token into a JPlag token and transfers it to the token adapter.
+     * @param targetType is the type of the JPlag token to be created.
+     * @param token is the ANTLR token.
+     */
+    private void transformToken(int targetType, Token token) {
+        parserAdapter.addToken(targetType, token.getLine(), token.getCharPositionInLine() + 1, token.getText().length());
+    }
+
+    @Override
+    public void enterMethod_invocation(Method_invocationContext context) {
+        transformToken(INVOCATION, context.getStart());
+        super.enterMethod_invocation(context);
+    }
+
+    @Override
+    public void enterObject_creation_expression(Object_creation_expressionContext context) {
+        transformToken(OBJECT_CREATION, context.getStart());
+        super.enterObject_creation_expression(context);
+    }
+
+    @Override
+    public void enterArray_initializer(Array_initializerContext context) {
+        transformToken(ARRAY_CREATION, context.getStart());
+        super.enterArray_initializer(context);
+    }
+
+    @Override
+    public void enterAssignment_operator(Assignment_operatorContext context) {
+        transformToken(ASSIGNMENT, context.getStart());
+        super.enterAssignment_operator(context);
+    }
+
+    @Override
+    public void enterVariable_declarator(Variable_declaratorContext context) {
+        transformToken(DECLARE_VAR, context.getStart());
+        super.enterVariable_declarator(context);
+    }
+
+    @Override
+    public void enterConstant_declarator(Constant_declaratorContext context) {
+        transformToken(DECLARE_CONST, context.getStart());
+        super.enterConstant_declarator(context);
+    }
+
+    @Override
+    public void enterIfStatement(IfStatementContext context) {
+        transformToken(IF, context.getStart());
+        super.enterIfStatement(context);
+    }
+
+    @Override
+    public void enterIf_body(If_bodyContext context) {
+        transformToken(IF_BEGIN, context.getStart());
+        super.enterIf_body(context);
+    }
+
+    @Override
+    public void exitIf_body(If_bodyContext context) {
+        transformToken(END_IF, context.getStop());
+        super.exitIf_body(context);
+    }
+
+    @Override
+    public void enterSwitch_section(Switch_sectionContext context) {
+        transformToken(SWITCH_BEGIN, context.getStart());
+        super.enterSwitch_section(context);
+    }
+
+    @Override
+    public void exitSwitch_section(Switch_sectionContext context) {
+        transformToken(SWITCH_END, context.getStop());
+        super.exitSwitch_section(context);
+    }
+
+    @Override
+    public void enterSwitchStatement(SwitchStatementContext context) {
+        transformToken(CASE, context.getStart());
+        super.enterSwitchStatement(context);
+    }
+
+    @Override
+    public void enterDoStatement(DoStatementContext context) {
+        transformToken(DO, context.getStart());
+        super.enterDoStatement(context);
+    }
+
+    @Override
+    public void enterWhileStatement(WhileStatementContext context) {
+        transformToken(WHILE, context.getStart());
+        super.enterWhileStatement(context);
+    }
+
+    @Override
+    public void enterForStatement(ForStatementContext context) {
+        transformToken(FOR, context.getStart());
+        super.enterForStatement(context);
+    }
+
+    @Override
+    public void enterForeachStatement(ForeachStatementContext context) {
+        transformToken(FOREACH, context.getStart());
+        super.enterForeachStatement(context);
+    }
+
+    @Override
+    public void enterBreakStatement(BreakStatementContext context) {
+        transformToken(BREAK, context.getStart());
+        super.enterBreakStatement(context);
+    }
+
+    @Override
+    public void enterContinueStatement(ContinueStatementContext context) {
+        transformToken(CONTINUE, context.getStart());
+        super.enterContinueStatement(context);
+    }
+
+    @Override
+    public void enterGotoStatement(GotoStatementContext context) {
+        transformToken(GOTO, context.getStart());
+        super.enterGotoStatement(context);
+    }
+
+    @Override
+    public void enterReturnStatement(ReturnStatementContext context) {
+        transformToken(RETURN, context.getStart());
+        super.enterReturnStatement(context);
+    }
+
+    @Override
+    public void enterThrowStatement(ThrowStatementContext context) {
+        transformToken(THROW, context.getStart());
+        super.enterThrowStatement(context);
+    }
+
+    @Override
+    public void enterCheckedStatement(CheckedStatementContext context) {
+        transformToken(CHECKED, context.getStart());
+        super.enterCheckedStatement(context);
+    }
+
+    @Override
+    public void enterUncheckedExpression(UncheckedExpressionContext context) {
+        transformToken(UNCHECKED, context.getStart());
+        super.enterUncheckedExpression(context);
+    }
+
+    @Override
+    public void enterLockStatement(LockStatementContext context) {
+        transformToken(LOCK, context.getStart());
+        super.enterLockStatement(context);
+    }
+
+    @Override
+    public void enterUsingStatement(UsingStatementContext context) {
+        transformToken(USING, null);
+        super.enterUsingStatement(context);
+    }
+
+    @Override
+    public void enterTryStatement(TryStatementContext context) {
+        transformToken(TRY, context.getStart());
+        super.enterTryStatement(context);
+    }
+
+    @Override
+    public void enterCatch_clauses(Catch_clausesContext context) {
+        transformToken(CATCH, context.getStart());
+        super.enterCatch_clauses(context);
+    }
+
+    @Override
+    public void enterFinally_clause(Finally_clauseContext context) {
+        transformToken(FINALLY, context.getStart());
+        super.enterFinally_clause(context);
+    }
+
+    @Override
+    public void enterNamespace_body(Namespace_bodyContext context) {
+        transformToken(NAMESPACE_BEGIN, context.getStart());
+        super.enterNamespace_body(context);
+    }
+
+    @Override
+    public void exitNamespace_body(Namespace_bodyContext context) {
+        transformToken(NAMESPACE_END, context.getStop());
+        super.exitNamespace_body(context);
+    }
+
+    @Override
+    public void enterUsing_directives(Using_directivesContext context) {
+        transformToken(USING_DIRECTIVE, context.getStart());
+        super.enterUsing_directives(context);
+    }
+
+    @Override
+    public void enterClass_definition(Class_definitionContext context) {
+        transformToken(CLASS, context.getStart());
+        super.enterClass_definition(context);
+    }
+
+    @Override
+    public void enterClass_body(Class_bodyContext context) {
+        transformToken(CLASS_BEGIN, context.getStart());
+        super.enterClass_body(context);
+    }
+
+    @Override
+    public void exitClass_body(Class_bodyContext context) {
+        transformToken(CLASS_END, context.getStop());
+        super.exitClass_body(context);
+    }
+
+    @Override
+    public void enterMethod_declaration(Method_declarationContext context) {
+        transformToken(METHOD, context.getStart());
+        super.enterMethod_declaration(context);
+    }
+
+    @Override
+    public void enterMethod_body(Method_bodyContext context) {
+        transformToken(METHOD_BEGIN, context.getStart());
+        super.enterMethod_body(context);
+    }
+
+    @Override
+    public void exitMethod_body(Method_bodyContext context) {
+        transformToken(METHOD_END, context.getStop());
+        super.exitMethod_body(context);
+    }
+
+    @Override
+    public void enterProperty_declaration(Property_declarationContext context) {
+        transformToken(PROPERTY, context.getStart());
+        super.enterProperty_declaration(context);
+    }
+
+    @Override
+    public void enterEvent_declaration(Event_declarationContext context) {
+        transformToken(EVENT, context.getStart());
+        super.enterEvent_declaration(context);
+    }
+
+    @Override
+    public void enterIndexer_declaration(Indexer_declarationContext context) {
+        transformToken(INDEXER, context.getStart());
+        super.enterIndexer_declaration(context);
+    }
+
+    @Override
+    public void enterOperator_declaration(Operator_declarationContext context) {
+        transformToken(OPERATOR, context.getStart());
+        super.enterOperator_declaration(context);
+    }
+
+    @Override
+    public void enterConstructor_declaration(Constructor_declarationContext context) {
+        transformToken(CONSTRUCTOR, context.getStart());
+        super.enterConstructor_declaration(context);
+    }
+
+    @Override
+    public void enterDestructor_definition(Destructor_definitionContext context) {
+        transformToken(DESTRUCTOR, context.getStart());
+        super.enterDestructor_definition(context);
+    }
+
+    @Override
+    public void enterStruct_definition(Struct_definitionContext context) {
+        transformToken(STRUCT, context.getStart());
+        super.enterStruct_definition(context);
+    }
+
+    @Override
+    public void enterStruct_body(Struct_bodyContext context) {
+        transformToken(STRUCT_BEGIN, context.getStart());
+        super.enterStruct_body(context);
+    }
+
+    @Override
+    public void exitStruct_body(Struct_bodyContext context) {
+        transformToken(STRUCT_END, context.getStop());
+        super.exitStruct_body(context);
+    }
+
+    @Override
+    public void enterInterface_definition(Interface_definitionContext context) {
+        transformToken(INTERFACE, context.getStart());
+        super.enterInterface_definition(context);
+    }
+
+    @Override
+    public void enterInterface_body(Interface_bodyContext context) {
+        transformToken(INTERFACE_BEGIN, context.getStart());
+        super.enterInterface_body(context);
+    }
+
+    @Override
+    public void exitInterface_body(Interface_bodyContext context) {
+        transformToken(INTERFACE_END, context.getStart());
+        super.exitInterface_body(context);
+    }
+
+    @Override
+    public void enterEnum_definition(Enum_definitionContext context) {
+        transformToken(ENUM, context.getStart());
+        super.enterEnum_definition(context);
+    }
+
+    @Override
+    public void enterEnum_body(Enum_bodyContext context) {
+        transformToken(ENUM_BEGIN, context.getStart());
+        super.enterEnum_body(context);
+    }
+
+    @Override
+    public void exitEnum_body(Enum_bodyContext context) {
+        transformToken(ENUM_END, context.getStop());
+        super.exitEnum_body(context);
+    }
+
+    @Override
+    public void enterEnum_member_declaration(Enum_member_declarationContext context) {
+        transformToken(ENUMERAL, context.getStart());
+        super.enterEnum_member_declaration(context);
+    }
+
+    @Override
+    public void enterAttribute(AttributeContext context) {
+        transformToken(ATTRIBUTE, context.getStart());
+        super.enterAttribute(context);
+    }
+
+    @Override
+    public void enterDelegate_definition(Delegate_definitionContext context) {
+        transformToken(DELEGATE, context.getStart());
+        super.enterDelegate_definition(context);
+    }
+
+    @Override
+    public void enterUnsafeStatement(UnsafeStatementContext context) {
+        transformToken(UNSAFE, context.getStart());
+        super.enterUnsafeStatement(context);
+    }
+
+    @Override
+    public void enterFixedStatement(FixedStatementContext context) {
+        transformToken(FIXED, context.getStart());
+        super.enterFixedStatement(context);
+    }
+
+}

+ 84 - 0
jplag.frontend.csharp-6/src/main/java/de/jplag/csharp/CSharpParserAdapter.java

@@ -0,0 +1,84 @@
+package de.jplag.csharp;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.util.List;
+
+import org.antlr.v4.runtime.CharStreams;
+import org.antlr.v4.runtime.CommonTokenStream;
+import org.antlr.v4.runtime.ParserRuleContext;
+import org.antlr.v4.runtime.tree.ParseTree;
+import org.antlr.v4.runtime.tree.ParseTreeWalker;
+
+import de.jplag.AbstractParser;
+import de.jplag.ErrorConsumer;
+import de.jplag.TokenList;
+import de.jplag.csharp.grammar.CSharpLexer;
+import de.jplag.csharp.grammar.CSharpParser;
+
+/**
+ * Parser adapter for the ANTLR 4 CSharp Parser and Lexer. It receives file to parse and passes them to the ANTLR
+ * pipeline. Then it walks the produced parse tree and creates JPlag token with the {@link CSharpListener}.
+ * @author Timur Saglam
+ */
+public class CSharpParserAdapter extends AbstractParser {
+    private TokenList tokens;
+    private String currentFile;
+
+    /**
+     * Creates the parser adapter.
+     * @param errorConsumer is the consumer for any occurring errors.
+     */
+    public CSharpParserAdapter(ErrorConsumer errorConsumer) {
+        super(errorConsumer);
+    }
+
+    /**
+     * Parses all tokens form a list of files.
+     * @param directory is the base directory.
+     * @param fileNames is the list of file names.
+     * @return the list of parsed tokens.
+     */
+    public TokenList parse(File directory, List<String> fileNames) {
+        tokens = new TokenList();
+        errors = 0;
+        for (String fileName : fileNames) {
+            if (!parseFile(directory, fileName)) {
+                errors++;
+            }
+            tokens.addToken(new CSharpToken(CSharpTokenConstants.FILE_END, fileName, -1, -1, -1));
+        }
+        return tokens;
+    }
+
+    private boolean parseFile(File directory, String fileName) {
+        File file = new File(directory, fileName);
+        try (FileInputStream inputStream = new FileInputStream(file);) {
+            currentFile = fileName;
+
+            // create a lexer, a parser and a buffer between them.
+            CSharpLexer lexer = new CSharpLexer(CharStreams.fromStream(inputStream));
+            CommonTokenStream tokens = new CommonTokenStream(lexer);
+            CSharpParser parser = new CSharpParser(tokens);
+
+            // Create a tree walker and the entry context defined by the parser grammar
+            ParserRuleContext entryContext = parser.compilation_unit();
+            ParseTreeWalker treeWalker = new ParseTreeWalker();
+
+            // Walk over the parse tree:
+            for (int i = 0; i < entryContext.getChildCount(); i++) {
+                ParseTree parseTree = entryContext.getChild(i);
+                treeWalker.walk(new CSharpListener(this), parseTree);
+            }
+        } catch (IOException exception) {
+            getErrorConsumer().addError("Parsing Error in '" + fileName + "':" + File.separator + exception.toString());
+            return false;
+        }
+        return true;
+    }
+
+    /* package-private */ void addToken(int type, int line, int column, int length) {
+        tokens.addToken(new CSharpToken(type, currentFile, line, column, length));
+    }
+}

+ 90 - 0
jplag.frontend.csharp-6/src/main/java/de/jplag/csharp/CSharpToken.java

@@ -0,0 +1,90 @@
+package de.jplag.csharp;
+
+import de.jplag.Token;
+import de.jplag.TokenConstants;
+
+/**
+ * C# token class.
+ * @author Timur Saglam
+ */
+public class CSharpToken extends Token implements CSharpTokenConstants {
+
+    /**
+     * Creates a C# token.
+     * @param type is the corresponding ID of the {@link TokenConstants}.
+     * @param file is the name of the source code file.
+     * @param line is the line index in the source code where the token resides. Cannot be smaller than 1.
+     * @param column is the column index, meaning where the token starts in the line.
+     * @param length is the length of the token in the source code.
+     */
+    public CSharpToken(int type, String file, int line, int column, int length) {
+        super(type, file, line, column, length);
+    }
+
+    @Override
+    protected String type2string() {
+        return switch (type) {
+            case TokenConstants.FILE_END -> "EOF";
+            case INVOCATION -> "INVOC";
+            case OBJECT_CREATION -> "OBJECT";
+            case ARRAY_CREATION -> "ARRAY";
+            case ASSIGNMENT -> "ASSIGN";
+            case DECLARE_VAR -> "VAR";
+            case DECLARE_CONST -> "CONST";
+            case IF -> "IF";
+            case ELSE -> "ELSE";
+            case END_IF -> "}IF";
+            case SWITCH_BEGIN -> "SWITCH{";
+            case SWITCH_END -> "}SWITCH";
+            case CASE -> "CASE";
+            case DO -> "DO";
+            case WHILE -> "WHILE";
+            case FOR -> "FOR";
+            case FOREACH -> "FOREACH";
+            case BREAK -> "BREAK";
+            case CONTINUE -> "CONTINUE";
+            case GOTO -> "GOTO";
+            case RETURN -> "RETURN";
+            case THROW -> "THROW";
+            case CHECKED -> "CHECKED";
+            case UNCHECKED -> "UNCHECKED";
+            case LOCK -> "LOCK";
+            case USING -> "USING";
+            case TRY -> "TRY";
+            case CATCH -> "CATCH";
+            case FINALLY -> "FINALLY";
+            case NAMESPACE_BEGIN -> "NAMESPACE{";
+            case NAMESPACE_END -> "}NAMESPACE";
+            case USING_DIRECTIVE -> "USING";
+            case CLASS_BEGIN -> "CLASS{";
+            case CLASS_END -> "}CLASS";
+            case METHOD -> "METHOD";
+            case PROPERTY -> "PROPERTY";
+            case EVENT -> "EVENT";
+            case INDEXER -> "INDEXER";
+            case OPERATOR -> "OPERATOR";
+            case CONSTRUCTOR -> "CONSTR";
+            case DESTRUCTOR -> "DESTRUCTOR";
+            case STRUCT_BEGIN -> "STRUCT{";
+            case STRUCT_END -> "}STRUCT";
+            case INTERFACE_BEGIN -> "INTERFACE{";
+            case INTERFACE_END -> "}INTERFACE";
+            case ENUM -> "ENUM";
+            case DELEGATE -> "DELEGATE";
+            case ATTRIBUTE -> "ATTRIBUTE";
+            case UNSAFE -> "UNSAFE";
+            case FIXED -> "FIXED";
+            // new:
+            case METHOD_BEGIN -> "METHOD{";
+            case METHOD_END -> "}METHOD";
+            case STRUCT -> "STRUCT";
+            case IF_BEGIN -> "IF{";
+            case CLASS -> "CLASS";
+            case INTERFACE -> "INTERFACE";
+            case ENUM_BEGIN -> "ENUM{";
+            case ENUM_END -> "}ENUM";
+            case ENUMERAL -> "ENUMERAL";
+            default -> "<UNKNOWN>";
+        };
+    }
+}

+ 78 - 0
jplag.frontend.csharp-6/src/main/java/de/jplag/csharp/CSharpTokenConstants.java

@@ -0,0 +1,78 @@
+package de.jplag.csharp;
+
+import de.jplag.TokenConstants;
+
+/**
+ * Based on the legacy CSharp-1.2 constants. The constants L_BRACE, R_BRACE, and STATIC_CONSTR were removed. Moreover,
+ * the following constants were added: METHOD_BEGIN, METHOD_END, STRUCT, IF_BEGIN, CLASS, INTERFACE, ENUM_BEGIN,
+ * ENUM_END and ENUMERAL.
+ * @author Timur Saglam
+ */
+public interface CSharpTokenConstants extends TokenConstants {
+    /*
+     * Token constants:
+     */
+    int INVOCATION = 2;
+    int OBJECT_CREATION = 3;
+    int ARRAY_CREATION = 4;
+    int ASSIGNMENT = 5;
+    int DECLARE_VAR = 6;
+    int DECLARE_CONST = 7;
+    int IF = 8;
+    int ELSE = 9; // TODO TS does not exist
+    int SWITCH_BEGIN = 10;
+    int SWITCH_END = 11;
+    int CASE = 12;
+    int DO = 13;
+    int WHILE = 14;
+    int FOR = 15;
+    int FOREACH = 16;
+    int BREAK = 17;
+    int CONTINUE = 18;
+    int GOTO = 19;
+    int RETURN = 20;
+    int THROW = 21;
+    int CHECKED = 22;
+    int UNCHECKED = 23;
+    int LOCK = 24;
+    int USING = 25;
+    int TRY = 26;
+    int CATCH = 27;
+    int FINALLY = 28;
+    int NAMESPACE_BEGIN = 29;
+    int NAMESPACE_END = 30;
+    int USING_DIRECTIVE = 31;
+    int CLASS_BEGIN = 32;
+    int CLASS_END = 33;
+    int METHOD = 34;
+    int PROPERTY = 35;
+    int EVENT = 36;
+    int INDEXER = 37;
+    int OPERATOR = 38;
+    int CONSTRUCTOR = 39;
+    int DESTRUCTOR = 40;
+    int STRUCT_BEGIN = 41;
+    int STRUCT_END = 42;
+    int INTERFACE_BEGIN = 43;
+    int INTERFACE_END = 44;
+    int ENUM = 45;
+    int DELEGATE = 46;
+    int ATTRIBUTE = 47;
+    int END_IF = 48;
+    int UNSAFE = 49;
+    int FIXED = 50;
+    int METHOD_BEGIN = 51;
+    int METHOD_END = 52;
+    int STRUCT = 53;
+    int IF_BEGIN = 54;
+    int CLASS = 55;
+    int INTERFACE = 56;
+    int ENUM_BEGIN = 57;
+    int ENUM_END = 58;
+    int ENUMERAL = 59;
+
+    /*
+     * Number of token constants:
+     */
+    int NUM_DIFF_TOKENS = 61;
+}

+ 17 - 7
jplag.frontend.csharp-1.2/src/main/java/de/jplag/csharp/Language.java → jplag.frontend.csharp-6/src/main/java/de/jplag/csharp/Language.java

@@ -1,40 +1,50 @@
 package de.jplag.csharp;
 
 import java.io.File;
+import java.util.Arrays;
 
 import de.jplag.ErrorConsumer;
 import de.jplag.TokenList;
 
+/**
+ * C# language with full support of C# 6 features and below.
+ * @author Timur Saglam
+ */
 public class Language implements de.jplag.Language {
-    private final Parser parser;
+    private static final String NAME = "C# 6 Parser";
+    private static final String SHORT_NAME = "C# 6";
+    private static final String[] FILE_ENDINGS = new String[] {".cs", ".CS"};
+    private static final int DEFAULT_MIN_TOKEN_MATCH = 8;
+
+    private final CSharpParserAdapter parser;
 
     public Language(ErrorConsumer program) {
-        parser = new Parser(program);
+        parser = new CSharpParserAdapter(program);
     }
 
     @Override
     public String[] suffixes() {
-        return new String[] {".cs", ".CS"};
+        return FILE_ENDINGS;
     }
 
     @Override
     public String getName() {
-        return "C# 1.2 Parser";
+        return NAME;
     }
 
     @Override
     public String getShortName() {
-        return "c#-1.2";
+        return SHORT_NAME;
     }
 
     @Override
     public int minimumTokenMatch() {
-        return 8;
+        return DEFAULT_MIN_TOKEN_MATCH;
     }
 
     @Override
     public TokenList parse(File dir, String[] files) {
-        return this.parser.parse(dir, files);
+        return parser.parse(dir, Arrays.asList(files));
     }
 
     @Override

+ 90 - 0
jplag.frontend.csharp-6/src/main/java/de/jplag/csharp/grammar/CSharpLexerBase.java

@@ -0,0 +1,90 @@
+package de.jplag.csharp.grammar;
+
+import java.util.Stack;
+
+import org.antlr.v4.runtime.*;
+
+/**
+ * This class was taken from <a href="https://github.com/antlr/grammars-v4/tree/master/csharp">antlr/grammars-v4</a>. It
+ * was originally written by Ken Domino. Note that this class is licensed under Eclipse Public License - v 1.0.
+ */
+abstract class CSharpLexerBase extends Lexer {
+    protected CSharpLexerBase(CharStream input) {
+        super(input);
+    }
+
+    protected int interpolatedStringLevel;
+    protected Stack<Boolean> interpolatedVerbatiums = new Stack<Boolean>();
+    protected Stack<Integer> curlyLevels = new Stack<Integer>();
+    protected boolean verbatium;
+
+    protected void OnInterpolatedRegularStringStart() {
+        interpolatedStringLevel++;
+        interpolatedVerbatiums.push(false);
+        verbatium = false;
+    }
+
+    protected void OnInterpolatedVerbatiumStringStart() {
+        interpolatedStringLevel++;
+        interpolatedVerbatiums.push(true);
+        verbatium = true;
+    }
+
+    protected void OnOpenBrace() {
+        if (interpolatedStringLevel > 0) {
+            curlyLevels.push(curlyLevels.pop() + 1);
+        }
+    }
+
+    protected void OnCloseBrace() {
+
+        if (interpolatedStringLevel > 0) {
+            curlyLevels.push(curlyLevels.pop() - 1);
+            if (curlyLevels.peek() == 0) {
+                curlyLevels.pop();
+                skip();
+                popMode();
+            }
+        }
+    }
+
+    protected void OnColon() {
+
+        if (interpolatedStringLevel > 0) {
+            int ind = 1;
+            boolean switchToFormatString = true;
+            while ((char) _input.LA(ind) != '}') {
+                if (_input.LA(ind) == ':' || _input.LA(ind) == ')') {
+                    switchToFormatString = false;
+                    break;
+                }
+                ind++;
+            }
+            if (switchToFormatString) {
+                mode(CSharpLexer.INTERPOLATION_FORMAT);
+            }
+        }
+    }
+
+    protected void OpenBraceInside() {
+        curlyLevels.push(1);
+    }
+
+    protected void OnDoubleQuoteInside() {
+        interpolatedStringLevel--;
+        interpolatedVerbatiums.pop();
+        verbatium = (interpolatedVerbatiums.size() > 0 ? interpolatedVerbatiums.peek() : false);
+    }
+
+    protected void OnCloseBraceInside() {
+        curlyLevels.pop();
+    }
+
+    protected boolean IsRegularCharInside() {
+        return !verbatium;
+    }
+
+    protected boolean IsVerbatiumDoubleQuoteInside() {
+        return verbatium;
+    }
+}

+ 26 - 0
jplag.frontend.csharp-6/src/main/java/de/jplag/csharp/grammar/CSharpParserBase.java

@@ -0,0 +1,26 @@
+package de.jplag.csharp.grammar;
+
+import org.antlr.v4.runtime.Parser;
+import org.antlr.v4.runtime.TokenStream;
+
+/**
+ * This class was taken from <a href="https://github.com/antlr/grammars-v4/tree/master/csharp">antlr/grammars-v4</a>. It
+ * was originally written by Ken Domino. Note that this class is licensed under Eclipse Public License - v 1.0.
+ */
+public abstract class CSharpParserBase extends Parser {
+    protected CSharpParserBase(TokenStream input) {
+        super(input);
+    }
+
+    protected boolean IsLocalVariableDeclaration() {
+        CSharpParser.Local_variable_declarationContext local_var_decl = (CSharpParser.Local_variable_declarationContext) this._ctx;
+        if (local_var_decl == null)
+            return true;
+        CSharpParser.Local_variable_typeContext local_variable_type = local_var_decl.local_variable_type();
+        if (local_variable_type == null)
+            return true;
+        if (local_variable_type.getText().equals("var"))
+            return false;
+        return true;
+    }
+}

+ 177 - 0
jplag.frontend.csharp-6/src/main/java/de/jplag/csharp/grammar/CSharpPreprocessorParserBase.java

@@ -0,0 +1,177 @@
+package de.jplag.csharp.grammar;
+
+import java.util.HashSet;
+import java.util.Stack;
+
+import org.antlr.v4.runtime.*;
+
+/**
+ * This class was taken from <a href="https://github.com/antlr/grammars-v4/tree/master/csharp">antlr/grammars-v4</a>. It
+ * was originally written by Ken Domino. Note that this class is licensed under Eclipse Public License - v 1.0.
+ */
+abstract class CSharpPreprocessorParserBase extends Parser {
+    protected CSharpPreprocessorParserBase(TokenStream input) {
+        super(input);
+        conditions.push(true);
+        ConditionalSymbols.add("DEBUG");
+    }
+
+    Stack<Boolean> conditions = new Stack<Boolean>();
+    public HashSet<String> ConditionalSymbols = new HashSet<String>();
+
+    protected Boolean AllConditions() {
+        for (Boolean condition : conditions) {
+            if (!condition)
+                return false;
+        }
+        return true;
+    }
+
+    protected void OnPreprocessorDirectiveDefine() {
+        ParserRuleContext c = this._ctx;
+        CSharpPreprocessorParser.PreprocessorDeclarationContext d = (CSharpPreprocessorParser.PreprocessorDeclarationContext) c;
+        ConditionalSymbols.add(d.CONDITIONAL_SYMBOL().getText());
+        d.value = AllConditions();
+    }
+
+    protected void OnPreprocessorDirectiveUndef() {
+        ParserRuleContext c = this._ctx;
+        CSharpPreprocessorParser.PreprocessorDeclarationContext d = (CSharpPreprocessorParser.PreprocessorDeclarationContext) c;
+        ConditionalSymbols.remove(d.CONDITIONAL_SYMBOL().getText());
+        d.value = AllConditions();
+    }
+
+    protected void OnPreprocessorDirectiveIf() {
+        ParserRuleContext c = this._ctx;
+        CSharpPreprocessorParser.PreprocessorConditionalContext d = (CSharpPreprocessorParser.PreprocessorConditionalContext) c;
+        d.value = d.expr.value.equals("true") && AllConditions();
+        conditions.push(d.expr.value.equals("true"));
+    }
+
+    protected void OnPreprocessorDirectiveElif() {
+        ParserRuleContext c = this._ctx;
+        CSharpPreprocessorParser.PreprocessorConditionalContext d = (CSharpPreprocessorParser.PreprocessorConditionalContext) c;
+        if (!conditions.peek()) {
+            conditions.pop();
+            d.value = d.expr.value.equals("true") && AllConditions();
+            conditions.push(d.expr.value.equals("true"));
+        } else {
+            d.value = false;
+        }
+    }
+
+    protected void OnPreprocessorDirectiveElse() {
+        ParserRuleContext c = this._ctx;
+        CSharpPreprocessorParser.PreprocessorConditionalContext d = (CSharpPreprocessorParser.PreprocessorConditionalContext) c;
+        if (!conditions.peek()) {
+            conditions.pop();
+            d.value = true && AllConditions();
+            conditions.push(true);
+        } else {
+            d.value = false;
+        }
+    }
+
+    protected void OnPreprocessorDirectiveEndif() {
+        ParserRuleContext c = this._ctx;
+        CSharpPreprocessorParser.PreprocessorConditionalContext d = (CSharpPreprocessorParser.PreprocessorConditionalContext) c;
+        conditions.pop();
+        d.value = conditions.peek();
+    }
+
+    protected void OnPreprocessorDirectiveLine() {
+        ParserRuleContext c = this._ctx;
+        CSharpPreprocessorParser.PreprocessorLineContext d = (CSharpPreprocessorParser.PreprocessorLineContext) c;
+        d.value = AllConditions();
+    }
+
+    protected void OnPreprocessorDirectiveError() {
+        ParserRuleContext c = this._ctx;
+        CSharpPreprocessorParser.PreprocessorDiagnosticContext d = (CSharpPreprocessorParser.PreprocessorDiagnosticContext) c;
+        d.value = AllConditions();
+    }
+
+    protected void OnPreprocessorDirectiveWarning() {
+        ParserRuleContext c = this._ctx;
+        CSharpPreprocessorParser.PreprocessorDiagnosticContext d = (CSharpPreprocessorParser.PreprocessorDiagnosticContext) c;
+        d.value = AllConditions();
+    }
+
+    protected void OnPreprocessorDirectiveRegion() {
+        ParserRuleContext c = this._ctx;
+        CSharpPreprocessorParser.PreprocessorRegionContext d = (CSharpPreprocessorParser.PreprocessorRegionContext) c;
+        d.value = AllConditions();
+    }
+
+    protected void OnPreprocessorDirectiveEndregion() {
+        ParserRuleContext c = this._ctx;
+        CSharpPreprocessorParser.PreprocessorRegionContext d = (CSharpPreprocessorParser.PreprocessorRegionContext) c;
+        d.value = AllConditions();
+    }
+
+    protected void OnPreprocessorDirectivePragma() {
+        ParserRuleContext c = this._ctx;
+        CSharpPreprocessorParser.PreprocessorPragmaContext d = (CSharpPreprocessorParser.PreprocessorPragmaContext) c;
+        d.value = AllConditions();
+    }
+
+    protected void OnPreprocessorDirectiveNullable() {
+        ParserRuleContext c = this._ctx;
+        CSharpPreprocessorParser.PreprocessorNullableContext d = (CSharpPreprocessorParser.PreprocessorNullableContext) c;
+        d.value = AllConditions();
+    }
+
+    protected void OnPreprocessorExpressionTrue() {
+        ParserRuleContext c = this._ctx;
+        CSharpPreprocessorParser.Preprocessor_expressionContext d = (CSharpPreprocessorParser.Preprocessor_expressionContext) c;
+        d.value = "true";
+    }
+
+    protected void OnPreprocessorExpressionFalse() {
+        ParserRuleContext c = this._ctx;
+        CSharpPreprocessorParser.Preprocessor_expressionContext d = (CSharpPreprocessorParser.Preprocessor_expressionContext) c;
+        d.value = "false";
+    }
+
+    protected void OnPreprocessorExpressionConditionalSymbol() {
+        ParserRuleContext c = this._ctx;
+        CSharpPreprocessorParser.Preprocessor_expressionContext d = (CSharpPreprocessorParser.Preprocessor_expressionContext) c;
+        d.value = ConditionalSymbols.contains(d.CONDITIONAL_SYMBOL().getText()) ? "true" : "false";
+    }
+
+    protected void OnPreprocessorExpressionConditionalOpenParens() {
+        ParserRuleContext c = this._ctx;
+        CSharpPreprocessorParser.Preprocessor_expressionContext d = (CSharpPreprocessorParser.Preprocessor_expressionContext) c;
+        d.value = d.expr.value;
+    }
+
+    protected void OnPreprocessorExpressionConditionalBang() {
+        ParserRuleContext c = this._ctx;
+        CSharpPreprocessorParser.Preprocessor_expressionContext d = (CSharpPreprocessorParser.Preprocessor_expressionContext) c;
+        d.value = d.expr.value.equals("true") ? "false" : "true";
+    }
+
+    protected void OnPreprocessorExpressionConditionalEq() {
+        ParserRuleContext c = this._ctx;
+        CSharpPreprocessorParser.Preprocessor_expressionContext d = (CSharpPreprocessorParser.Preprocessor_expressionContext) c;
+        d.value = (d.expr1.value == d.expr2.value ? "true" : "false");
+    }
+
+    protected void OnPreprocessorExpressionConditionalNe() {
+        ParserRuleContext c = this._ctx;
+        CSharpPreprocessorParser.Preprocessor_expressionContext d = (CSharpPreprocessorParser.Preprocessor_expressionContext) c;
+        d.value = (d.expr1.value != d.expr2.value ? "true" : "false");
+    }
+
+    protected void OnPreprocessorExpressionConditionalAnd() {
+        ParserRuleContext c = this._ctx;
+        CSharpPreprocessorParser.Preprocessor_expressionContext d = (CSharpPreprocessorParser.Preprocessor_expressionContext) c;
+        d.value = (d.expr1.value.equals("true") && d.expr2.value.equals("true") ? "true" : "false");
+    }
+
+    protected void OnPreprocessorExpressionConditionalOr() {
+        ParserRuleContext c = this._ctx;
+        CSharpPreprocessorParser.Preprocessor_expressionContext d = (CSharpPreprocessorParser.Preprocessor_expressionContext) c;
+        d.value = (d.expr1.value.equals("true") || d.expr2.value.equals("true") ? "true" : "false");
+    }
+}

+ 1 - 1
jplag/pom.xml

@@ -55,7 +55,7 @@
         </dependency>
         <dependency>
             <groupId>de.jplag</groupId>
-            <artifactId>csharp-1.2</artifactId>
+            <artifactId>csharp-6</artifactId>
         </dependency>
         <dependency>
             <groupId>de.jplag</groupId>

+ 17 - 10
pom.xml

@@ -22,19 +22,19 @@
 
     <developers>
         <developer>
-            <id>sebinside</id>
-            <name>Sebastian Hahner</name>
-            <email>hahner@kit.edu</email>
-            <url>https://sdq.ipd.kit.edu/people/sebastian-hahner/</url>
+            <id>tsaglam</id>
+            <name>Timur Sağlam</name>
+            <email>saglam@kit.edu</email>
+            <url>https://sdq.ipd.kit.edu/people/timur-saglam/</url>
             <organization>KASTEL</organization>
             <organizationUrl>https://dsis.kastel.kit.edu/</organizationUrl>
             <timezone>GMT+1</timezone>
         </developer>
         <developer>
-            <id>tsaglam</id>
-            <name>Timur Sağlam</name>
-            <email>saglam@kit.edu</email>
-            <url>https://sdq.ipd.kit.edu/people/timur-saglam/</url>
+            <id>sebinside</id>
+            <name>Sebastian Hahner</name>
+            <email>hahner@kit.edu</email>
+            <url>https://sdq.ipd.kit.edu/people/sebastian-hahner/</url>
             <organization>KASTEL</organization>
             <organizationUrl>https://dsis.kastel.kit.edu/</organizationUrl>
             <timezone>GMT+1</timezone>
@@ -45,7 +45,7 @@
         <module>jplag.frontend-utils</module>
         <module>jplag.frontend.chars</module>
         <module>jplag.frontend.cpp</module>
-        <module>jplag.frontend.csharp-1.2</module>
+        <module>jplag.frontend.csharp-6</module>
         <module>jplag.frontend.java</module>
         <module>jplag.frontend.python-3</module>
         <module>jplag.frontend.scheme</module>
@@ -150,7 +150,7 @@
             </dependency>
             <dependency>
                 <groupId>${project.groupId}</groupId>
-                <artifactId>csharp-1.2</artifactId>
+                <artifactId>csharp-6</artifactId>
                 <version>${project.version}</version>
             </dependency>
             <dependency>
@@ -250,6 +250,13 @@
                             </manifest>
                         </archive>
                     </configuration>
+                    <executions>
+                        <execution>
+                            <goals>
+                                <goal>test-jar</goal>
+                            </goals>
+                        </execution>
+                    </executions>
                 </plugin>
                 <plugin>
                     <artifactId>maven-assembly-plugin</artifactId>