diff --git a/src/Libraries/NRefactory/Project/Src/Lexer/VBNet/Lexer.cs b/src/Libraries/NRefactory/Project/Src/Lexer/VBNet/Lexer.cs index 94f7cff605..bdd3306fb5 100644 --- a/src/Libraries/NRefactory/Project/Src/Lexer/VBNet/Lexer.cs +++ b/src/Libraries/NRefactory/Project/Src/Lexer/VBNet/Lexer.cs @@ -156,7 +156,7 @@ namespace ICSharpCode.NRefactory.Parser.VB ReadComment(); if (!lineEnd) { lineEnd = true; - return new Token(Tokens.EOL, x, y, "\n"); + return new Token(Tokens.EOL, Col, Line, "\n"); } continue; } @@ -375,7 +375,7 @@ namespace ICSharpCode.NRefactory.Parser.VB digit += (char)ReaderRead(); } } else { - nextToken = new Token(Tokens.Dot, x, y); + nextToken = new Token(Tokens.Dot, Col - 1, Line); } } diff --git a/src/Libraries/NRefactory/Test/Lexer/VBNet/LexerPositionTests.cs b/src/Libraries/NRefactory/Test/Lexer/VBNet/LexerPositionTests.cs index cf4f9b4ae3..d38977665a 100644 --- a/src/Libraries/NRefactory/Test/Lexer/VBNet/LexerPositionTests.cs +++ b/src/Libraries/NRefactory/Test/Lexer/VBNet/LexerPositionTests.cs @@ -38,14 +38,15 @@ namespace ICSharpCode.NRefactory.Tests.Lexer.VB t = l.NextToken(); Assert.AreEqual(new Point(8, 1), t.Location); } -// [Test] -// public void TestReturn() -// { -// ILexer l = GenerateLexer("public\nstatic"); -// Token t = l.NextToken(); -// t = l.NextToken(); -// Assert.AreEqual(new Point(1, 2), t.Location); -// } + [Test] + public void TestReturn() + { + ILexer l = GenerateLexer("public\nstatic"); + Token t = l.NextToken(); + t = l.NextToken(); + t = l.NextToken(); + Assert.AreEqual(new Point(1, 2), t.Location); + } [Test] public void TestSpace() { @@ -60,59 +61,35 @@ namespace ICSharpCode.NRefactory.Tests.Lexer.VB Token t = l.NextToken(); Assert.AreEqual(new Point(1, 1), t.Location); } -// [Test] -// public void TestHexNumber() -// { -// ILexer l = GenerateLexer("0x142 public"); -// Token t = l.NextToken(); -// Assert.AreEqual(new Point(1, 1), t.Location); -// t = l.NextToken(); -// Assert.AreEqual(new Point(7, 1), t.Location); -// } -// [Test] -// public void TestHexNumberChar() -// { -// ILexer l = GenerateLexer("\'\\x224\' public"); -// Token t = l.NextToken(); -// Assert.AreEqual(new Point(1, 1), t.Location); -// t = l.NextToken(); -// Assert.AreEqual(new Point(9, 1), t.Location); -// } -// [Test] -// public void TestFloationPointNumber() -// { -// ILexer l = GenerateLexer("0.142 public"); -// Token t = l.NextToken(); -// Assert.AreEqual(new Point(1, 1), t.Location); -// t = l.NextToken(); -// Assert.AreEqual(new Point(7, 1), t.Location); -// } -// [Test] -// public void TestVerbatimString() -// { -// ILexer l = GenerateLexer("@\"a\"\"a\" public"); -// Token t = l.NextToken(); -// Assert.AreEqual(new Point(1, 1), t.Location); -// t = l.NextToken(); -// Assert.AreEqual(new Point(9, 1), t.Location); -// } -// [Test] -// public void TestNoFloationPointNumber() -// { -// ILexer l = GenerateLexer("0.a"); -// Token t = l.NextToken(); -// Assert.AreEqual(new Point(1, 1), t.Location); -// t = l.NextToken(); -// Assert.AreEqual(new Point(3, 1), t.Location); -// } -// [Test] -// public void TestNumber() -// { -// ILexer l = GenerateLexer("142\nstatic"); -// Token t = l.NextToken(); -// t = l.NextToken(); -// Assert.AreEqual(new Point(1, 2), t.Location); -// } + [Test] + public void TestFloationPointNumber() + { + ILexer l = GenerateLexer("0.142 public"); + Token t = l.NextToken(); + Assert.AreEqual(new Point(1, 1), t.Location); + t = l.NextToken(); + Assert.AreEqual(new Point(7, 1), t.Location); + } + [Test] + public void TestNoFloationPointNumber() + { + ILexer l = GenerateLexer("5.a"); + Token t = l.NextToken(); + Assert.AreEqual(new Point(1, 1), t.Location); + t = l.NextToken(); + Assert.AreEqual(new Point(2, 1), t.Location); + t = l.NextToken(); + Assert.AreEqual(new Point(3, 1), t.Location); + } + [Test] + public void TestNumber() + { + ILexer l = GenerateLexer("142\nstatic"); + Token t = l.NextToken(); + t = l.NextToken(); + t = l.NextToken(); + Assert.AreEqual(new Point(1, 2), t.Location); + } [Test] public void TestNumber2() {