Browse Source

fixed infinite loop in VBNetExpressionFinder

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/branches/vbnet@6063 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
pull/1/head
Siegfried Pammer 16 years ago
parent
commit
e168d1dd17
  1. 16
      src/Libraries/NRefactory/Test/Lexer/VBNet/LexerContextTests.cs
  2. 8
      src/Main/ICSharpCode.SharpDevelop.Dom/Project/Src/VBNet/VBNetExpressionFinder.cs

16
src/Libraries/NRefactory/Test/Lexer/VBNet/LexerContextTests.cs

@ -113,7 +113,7 @@ Class Test
End Sub End Sub
End Class End Class
", ",
@"enter Global @"enter Global
enter Attribute enter Attribute
exit Attribute exit Attribute
enter IdentifierExpected enter IdentifierExpected
@ -146,7 +146,7 @@ Class Test
End Sub End Sub
End Class End Class
", ",
@"enter Global @"enter Global
enter Attribute enter Attribute
exit Attribute exit Attribute
enter IdentifierExpected enter IdentifierExpected
@ -179,7 +179,7 @@ exit Global
End Sub End Sub
End Class End Class
", ",
@"enter Global @"enter Global
enter IdentifierExpected enter IdentifierExpected
exit IdentifierExpected exit IdentifierExpected
enter Type enter Type
@ -213,7 +213,7 @@ exit Global
End Sub End Sub
End Class End Class
", ",
@"enter Global @"enter Global
enter IdentifierExpected enter IdentifierExpected
exit IdentifierExpected exit IdentifierExpected
enter Type enter Type
@ -255,7 +255,7 @@ exit Global
End Sub End Sub
End Class End Class
", ",
@"enter Global @"enter Global
enter IdentifierExpected enter IdentifierExpected
exit IdentifierExpected exit IdentifierExpected
enter Type enter Type
@ -301,7 +301,7 @@ exit Global
Next Next
End Sub End Sub
End Class", End Class",
@"enter Global @"enter Global
enter IdentifierExpected enter IdentifierExpected
exit IdentifierExpected exit IdentifierExpected
enter Type enter Type
@ -357,7 +357,7 @@ Module Program
Console.ReadKey() Console.ReadKey()
End Sub End Sub
End Module", End Module",
@"enter Global @"enter Global
enter IdentifierExpected enter IdentifierExpected
exit IdentifierExpected exit IdentifierExpected
enter Type enter Type
@ -419,6 +419,8 @@ exit Global
Console.WriteLine(p.Output); Console.WriteLine(p.Output);
Assert.IsEmpty(p.Errors);
Assert.AreEqual(expectedOutput, p.Output); Assert.AreEqual(expectedOutput, p.Output);
} }
} }

8
src/Main/ICSharpCode.SharpDevelop.Dom/Project/Src/VBNet/VBNetExpressionFinder.cs

@ -61,7 +61,13 @@ namespace ICSharpCode.SharpDevelop.Dom.VBNet
do { do {
t = lexer.NextToken(); t = lexer.NextToken();
p.InformToken(t); p.InformToken(t);
} while (t.Location <= targetPosition); } while (t.Location < targetPosition);
// HACK simulate <= but avoid endless loop at file end.
if (t.Location == targetPosition) {
t = lexer.NextToken();
p.InformToken(t);
}
Block block = p.CurrentBlock; Block block = p.CurrentBlock;

Loading…
Cancel
Save