From fe198da3f5673514778d05aeeaa86cc03b0e0614 Mon Sep 17 00:00:00 2001 From: Siegfried Pammer Date: Sun, 17 Oct 2010 08:58:00 +0200 Subject: [PATCH] fixed http://community.sharpdevelop.net/forums/p/12088/32950.aspx#32950 --- .../Project/Src/Lexer/VBNet/Lexer.cs | 3 ++- .../VBNet/ImplicitLineContinuationTests.cs | 24 +++++++++++++++++++ 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/src/Libraries/NRefactory/Project/Src/Lexer/VBNet/Lexer.cs b/src/Libraries/NRefactory/Project/Src/Lexer/VBNet/Lexer.cs index beac28ac61..60a8bc0354 100644 --- a/src/Libraries/NRefactory/Project/Src/Lexer/VBNet/Lexer.cs +++ b/src/Libraries/NRefactory/Project/Src/Lexer/VBNet/Lexer.cs @@ -436,7 +436,8 @@ namespace ICSharpCode.NRefactory.Parser.VB // 6th rule // after a greater-than (>) in a non-file-level attribute context - if (prevTokenKind == Tokens.GreaterThan && ef.InContext(Context.Attribute)) + // HACK cannot detect if token was end of attribute, just allow all GreaterThan tokens + if (prevTokenKind == Tokens.GreaterThan) return true; // 7th rule diff --git a/src/Libraries/NRefactory/Test/Lexer/VBNet/ImplicitLineContinuationTests.cs b/src/Libraries/NRefactory/Test/Lexer/VBNet/ImplicitLineContinuationTests.cs index 944d4470d2..5b7f78ed63 100644 --- a/src/Libraries/NRefactory/Test/Lexer/VBNet/ImplicitLineContinuationTests.cs +++ b/src/Libraries/NRefactory/Test/Lexer/VBNet/ImplicitLineContinuationTests.cs @@ -161,6 +161,30 @@ End Class"; ); } + [Test] + public void LineContinuationAfterAttributes() + { + string code = @" +Public Class TestContinuation + + Public Sub TestMethod + Assert.Fail + End Sub +End Class"; + + ILexer lexer = GenerateLexer(new StringReader(code)); + + CheckTokens( + lexer, Tokens.LessThan, Tokens.Identifier, Tokens.GreaterThan, + Tokens.Public, Tokens.Class, Tokens.Identifier, Tokens.EOL, + Tokens.LessThan, Tokens.Identifier, Tokens.GreaterThan, + Tokens.Public, Tokens.Sub, Tokens.Identifier, Tokens.EOL, + Tokens.Identifier, Tokens.Dot, Tokens.Identifier, Tokens.EOL, + Tokens.End, Tokens.Sub, Tokens.EOL, + Tokens.End, Tokens.Class + ); + } + #region Helpers ILexer GenerateLexer(StringReader sr) {