diff --git a/src/Libraries/NRefactory/Project/Src/Parser/VBNet/Experimental/ExpressionFinder.atg b/src/Libraries/NRefactory/Project/Src/Parser/VBNet/Experimental/ExpressionFinder.atg index 18ed65d135..d4663fb3f4 100644 --- a/src/Libraries/NRefactory/Project/Src/Parser/VBNet/Experimental/ExpressionFinder.atg +++ b/src/Libraries/NRefactory/Project/Src/Parser/VBNet/Experimental/ExpressionFinder.atg @@ -307,6 +307,7 @@ MemberDeclaration = SubOrFunctionDeclaration | ExternalMemberDeclaration | EventMemberDeclaration | + CustomEventMemberDeclaration | OperatorDeclaration ) (. PopContext(); .) @@ -326,17 +327,20 @@ ExternalMemberDeclaration = . EventMemberDeclaration = - [ "Custom" ] "Event" Identifier ( "As" TypeName | [ "(" [ ParameterList ] ")" ] ) - [ "Implements" TypeName "." IdentifierOrKeyword { "," TypeName "." IdentifierOrKeyword } ] + "Event" Identifier ( "As" TypeName | [ "(" [ ParameterList ] ")" ] ) + [ "Implements" TypeName /*"." IdentifierOrKeyword*/ { "," TypeName /*"." IdentifierOrKeyword*/ } ] + /* the TypeName production already allows the "." IdentifierOrKeyword syntax, so to avoid an ambiguous grammer we just leave that out */ StatementTerminator - [ - { - { AttributeBlock } ( "AddHandler" | "RemoveHandler" | "RaiseEvent" ) "(" ParameterList ")" EOL - Block - "End" ( "AddHandler" | "RemoveHandler" | "RaiseEvent" ) StatementTerminator - } +. + +CustomEventMemberDeclaration = + "Custom" EventMemberDeclaration + { + { AttributeBlock } ( "AddHandler" | "RemoveHandler" | "RaiseEvent" ) "(" ParameterList ")" EOL + Block + "End" ( "AddHandler" | "RemoveHandler" | "RaiseEvent" ) StatementTerminator + } "End" "Event" StatementTerminator - ] . OperatorDeclaration = @@ -346,7 +350,7 @@ OperatorDeclaration = . MemberVariableOrConstantDeclaration = - [ "Const" ] Identifier [ "As" TypeName ] [ "=" Expression ] StatementTerminator + [ "Const" ] IdentifierForFieldDeclaration [ "As" TypeName ] [ "=" Expression ] StatementTerminator . ParameterList = @@ -360,8 +364,7 @@ Parameter = Block = (. PushContext(Context.Body, t); .) StatementTerminator - { StatementTerminator } - { Statement { StatementTerminator } } + { [ Statement] StatementTerminator } (. PopContext(); .) . @@ -429,7 +432,7 @@ Statement = . VariableDeclarationStatement = - ( "Dim" | "Static" | "Const" ) Identifier [ "?" ] [ ( "(" { "," } ")" ) ] { "," Identifier [ "?" ] [ ( "(" { "," } ")" ) ] } [ "As" [ "New" ] TypeName [ "(" ")" ] ] [ "=" Expression ] + ( "Dim" | "Static" | "Const" ) Identifier [ "?" ] [ ( "(" { "," } ")" ) ] { "," Identifier [ "?" ] [ ( "(" { "," } ")" ) ] } [ "As" [ "New" ] TypeName ] [ "=" Expression ] . WithOrLockStatement = @@ -445,7 +448,7 @@ RaiseEventStatement = . InvocationStatement = - [ "Call" ] Expression [ "(" [ ArgumentList ] ")" ] [ ( "=" | "^=" | "*=" | "/=" | "\\=" | "+=" | "-=" | "&=" | ">=" ) Expression ] + [ "Call" ] Expression [ ( "=" | "^=" | "*=" | "/=" | "\\=" | "+=" | "-=" | "&=" | ">=" ) Expression ] . ArgumentList = diff --git a/src/Libraries/NRefactory/Project/Src/Parser/VBNet/Experimental/Test/VBParserExperiment.csproj b/src/Libraries/NRefactory/Project/Src/Parser/VBNet/Experimental/Test/VBParserExperiment.csproj index 70b5a99241..f475324855 100644 --- a/src/Libraries/NRefactory/Project/Src/Parser/VBNet/Experimental/Test/VBParserExperiment.csproj +++ b/src/Libraries/NRefactory/Project/Src/Parser/VBNet/Experimental/Test/VBParserExperiment.csproj @@ -31,7 +31,7 @@ - ..\..\..\..\..\..\..\..\..\bin\Tools\NUnit\nunit.framework.dll + ..\..\..\..\..\..\..\..\Tools\NUnit\nunit.framework.dll