Browse Source

XML Parser: Bugfix and some optimizations

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@4727 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
shortcuts
David Srbecký 16 years ago
parent
commit
b434bf8dc4
  1. 16
      src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Xml/TokenReader.cs

16
src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Xml/TokenReader.cs

@ -149,7 +149,7 @@ namespace ICSharpCode.AvalonEdit.Xml @@ -149,7 +149,7 @@ namespace ICSharpCode.AvalonEdit.Xml
if (currentLocation == inputLength) return false;
char c = input[currentLocation];
return c == ' ' || c == '\t' || c == '\n' || c == '\r';
return ((int)c <= 0x20) && (c == ' ' || c == '\t' || c == '\n' || c == '\r');
}
// The move functions do not have to move if already at target
@ -217,8 +217,16 @@ namespace ICSharpCode.AvalonEdit.Xml @@ -217,8 +217,16 @@ namespace ICSharpCode.AvalonEdit.Xml
protected bool TryMoveToNonWhiteSpace(int inputLength)
{
while(TryPeekWhiteSpace()) currentLocation++;
return HasMoreData();
while(true) {
if (currentLocation == inputLength) return false; // Reject end of file
char c = input[currentLocation];
if (((int)c <= 0x20) && (c == ' ' || c == '\t' || c == '\n' || c == '\r')) {
currentLocation++; // Accept white-space
continue;
} else {
return true; // Found non-white-space
}
}
}
/// <summary>
@ -237,7 +245,7 @@ namespace ICSharpCode.AvalonEdit.Xml @@ -237,7 +245,7 @@ namespace ICSharpCode.AvalonEdit.Xml
while(true) {
if (currentLocation == inputLength) break; // Reject end of file
char c = input[currentLocation];
if (0x41 <= (int)c && (int)c <= 0x7A) { // Accpet 0x41-0x7A (A-Z[\]^_`a-z)
if (0x41 <= (int)c) { // Accpet from 'A' onwards
currentLocation++;
continue;
}

Loading…
Cancel
Save