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 @@ -113,7 +113,7 @@ Class Test
End Sub
End Class
",
@"enter Global
@"enter Global
enter Attribute
exit Attribute
enter IdentifierExpected
@ -146,7 +146,7 @@ Class Test @@ -146,7 +146,7 @@ Class Test
End Sub
End Class
",
@"enter Global
@"enter Global
enter Attribute
exit Attribute
enter IdentifierExpected
@ -179,7 +179,7 @@ exit Global @@ -179,7 +179,7 @@ exit Global
End Sub
End Class
",
@"enter Global
@"enter Global
enter IdentifierExpected
exit IdentifierExpected
enter Type
@ -213,7 +213,7 @@ exit Global @@ -213,7 +213,7 @@ exit Global
End Sub
End Class
",
@"enter Global
@"enter Global
enter IdentifierExpected
exit IdentifierExpected
enter Type
@ -255,7 +255,7 @@ exit Global @@ -255,7 +255,7 @@ exit Global
End Sub
End Class
",
@"enter Global
@"enter Global
enter IdentifierExpected
exit IdentifierExpected
enter Type
@ -301,7 +301,7 @@ exit Global @@ -301,7 +301,7 @@ exit Global
Next
End Sub
End Class",
@"enter Global
@"enter Global
enter IdentifierExpected
exit IdentifierExpected
enter Type
@ -357,7 +357,7 @@ Module Program @@ -357,7 +357,7 @@ Module Program
Console.ReadKey()
End Sub
End Module",
@"enter Global
@"enter Global
enter IdentifierExpected
exit IdentifierExpected
enter Type
@ -419,6 +419,8 @@ exit Global @@ -419,6 +419,8 @@ exit Global
Console.WriteLine(p.Output);
Assert.IsEmpty(p.Errors);
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 @@ -61,7 +61,13 @@ namespace ICSharpCode.SharpDevelop.Dom.VBNet
do {
t = lexer.NextToken();
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;

Loading…
Cancel
Save