mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-24 20:49:16 +02:00
* Patch from Mantis #20046 fixing an issue in rcmatchstring.
git-svn-id: trunk@19072 -
This commit is contained in:
parent
1365467b0d
commit
44bd4470f9
@ -542,10 +542,12 @@ var
|
|||||||
Ch : AnsiChar;
|
Ch : AnsiChar;
|
||||||
State : integer;
|
State : integer;
|
||||||
StrInx : integer;
|
StrInx : integer;
|
||||||
|
LenStr : integer;
|
||||||
begin
|
begin
|
||||||
{assume we fail to match}
|
{assume we fail to match}
|
||||||
Result := false;
|
Result := false;
|
||||||
Len := StartPosn;
|
Len := StartPosn;
|
||||||
|
LenStr := Length(s);
|
||||||
{clear the deque}
|
{clear the deque}
|
||||||
FHead := FCapacity div 2;
|
FHead := FCapacity div 2;
|
||||||
FTail := FHead;
|
FTail := FHead;
|
||||||
@ -628,14 +630,14 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
until (FHead = FTail) or (ch = #0); // deque empty or end of string
|
until (FHead = FTail) or (StrInx > LenStr); // deque empty or end of string
|
||||||
{if we reach this point we've either exhausted the deque or we've
|
{if we reach this point we've either exhausted the deque or we've
|
||||||
run out of string; if the former, the substring did not match
|
run out of string; if the former, the substring did not match
|
||||||
since there are no more states. If the latter, we need to check
|
since there are no more states. If the latter, we need to check
|
||||||
the states left on the deque to see if one is the terminating
|
the states left on the deque to see if one is the terminating
|
||||||
state; if so the string matched the regular expression defined by
|
state; if so the string matched the regular expression defined by
|
||||||
the transition table}
|
the transition table}
|
||||||
while (FHead <> FTail) do begin
|
while (FHead <> FTail) and (StrInx<=LenStr) do begin
|
||||||
State := DequePop;
|
State := DequePop;
|
||||||
with FStateTable[State] do begin
|
with FStateTable[State] do begin
|
||||||
case sdMatchType of
|
case sdMatchType of
|
||||||
|
Loading…
Reference in New Issue
Block a user