mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-11 09:26:15 +02:00
Three XPath scanner fixes:
* #12 is not a whitespace char; * '!' is not valid unless it is a part of '!=' token; * Accept full XML 1.0 name character range as identifiers. git-svn-id: trunk@13109 -
This commit is contained in:
parent
b340822af2
commit
9fe4f59c5a
@ -1548,8 +1548,6 @@ function TXPathScanner.NextToken: TXPathToken;
|
|||||||
Result := tkNumber;
|
Result := tkNumber;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
const
|
|
||||||
IdentifierChars = ['A'..'Z', 'a'..'z', '0'..'9', '.', '-', '_'];
|
|
||||||
begin
|
begin
|
||||||
if FCurToken = tkEndOfStream then
|
if FCurToken = tkEndOfStream then
|
||||||
begin
|
begin
|
||||||
@ -1561,7 +1559,7 @@ begin
|
|||||||
versions will use WideStrings -sg }
|
versions will use WideStrings -sg }
|
||||||
|
|
||||||
// Skip whitespace
|
// Skip whitespace
|
||||||
while (FCurData[0] < #255) and (char(ord(FCurData[0])) in [#9, #10, #12, #13, ' ']) do
|
while (FCurData[0] < #255) and (char(ord(FCurData[0])) in [#9, #10, #13, ' ']) do
|
||||||
Inc(FCurData);
|
Inc(FCurData);
|
||||||
|
|
||||||
FTokenStart := FCurData;
|
FTokenStart := FCurData;
|
||||||
@ -1575,7 +1573,9 @@ begin
|
|||||||
begin
|
begin
|
||||||
Inc(FCurData);
|
Inc(FCurData);
|
||||||
Result := tkNotEqual;
|
Result := tkNotEqual;
|
||||||
end;
|
end
|
||||||
|
else
|
||||||
|
Error(SScannerInvalidChar);
|
||||||
'"':
|
'"':
|
||||||
begin
|
begin
|
||||||
FTokenLength := 0;
|
FTokenLength := 0;
|
||||||
@ -1661,16 +1661,6 @@ begin
|
|||||||
Result := tkGreater;
|
Result := tkGreater;
|
||||||
'@':
|
'@':
|
||||||
Result := tkAt;
|
Result := tkAt;
|
||||||
'A'..'Z', 'a'..'z':
|
|
||||||
begin
|
|
||||||
FTokenLength := 1;
|
|
||||||
Result := tkIdentifier;
|
|
||||||
while (FCurData[1] < #255) and (char(ord(FCurData[1])) in IdentifierChars) do
|
|
||||||
begin
|
|
||||||
Inc(FCurData);
|
|
||||||
Inc(FTokenLength);
|
|
||||||
end;
|
|
||||||
end;
|
|
||||||
'[':
|
'[':
|
||||||
Result := tkLeftSquareBracket;
|
Result := tkLeftSquareBracket;
|
||||||
']':
|
']':
|
||||||
@ -1678,7 +1668,19 @@ begin
|
|||||||
'|':
|
'|':
|
||||||
Result := tkPipe;
|
Result := tkPipe;
|
||||||
else
|
else
|
||||||
Error(SScannerInvalidChar);
|
// TODO: no surrogate pairs/XML 1.1 support yet
|
||||||
|
if Byte(FCurData^) in NamingBitmap[NamePages[hi(Word(FCurData^))]] then
|
||||||
|
begin
|
||||||
|
FTokenLength := 1;
|
||||||
|
Result := tkIdentifier;
|
||||||
|
while Byte(FCurData[1]) in NamingBitmap[NamePages[$100+hi(Word(FCurData[1]))]] do
|
||||||
|
begin
|
||||||
|
Inc(FCurData);
|
||||||
|
Inc(FTokenLength);
|
||||||
|
end;
|
||||||
|
end
|
||||||
|
else
|
||||||
|
Error(SScannerInvalidChar);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
// We have processed at least one character now; eat it:
|
// We have processed at least one character now; eat it:
|
||||||
|
Loading…
Reference in New Issue
Block a user