From 8a12d03745a0879a0f761c7d1ebbf9aef49105c7 Mon Sep 17 00:00:00 2001 From: Daniel Grunwald Date: Sat, 12 Jun 2010 20:56:46 +0000 Subject: [PATCH] Solving some LL(1) conflicts git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/branches/vbnet@5946 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61 --- .../VBNet/Experimental/ExpressionFinder.atg | 31 ++++++++++--------- .../Test/VBParserExperiment.csproj | 2 +- 2 files changed, 18 insertions(+), 15 deletions(-) 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