mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-13 16:59:11 +02:00
* Refactored, replaced case for if, nested if for and, removed needless
comparision * Removed a Fillchar to clear the statetable, I don't see it's use git-svn-id: trunk@16534 -
This commit is contained in:
parent
f4c31ecf3c
commit
e6e02a6176
@ -458,15 +458,17 @@ begin
|
|||||||
for i := 0 to FStateCount-1 do begin
|
for i := 0 to FStateCount-1 do begin
|
||||||
with FStateTable[i] do begin
|
with FStateTable[i] do begin
|
||||||
if (sdMatchType = mtClass) or
|
if (sdMatchType = mtClass) or
|
||||||
(sdMatchType = mtNegClass) then
|
(sdMatchType = mtNegClass) and
|
||||||
if (sdClass <> nil) then
|
(sdClass <> nil) then
|
||||||
begin
|
begin
|
||||||
for j := i+1 to FStateCount-1 do
|
for j := i+1 to FStateCount-1 do
|
||||||
if (FStateTable[j].sdClass = sdClass) then
|
if (FStateTable[j].sdClass = sdClass) then
|
||||||
FStateTable[j].sdClass := nil;
|
FStateTable[j].sdClass := nil;
|
||||||
FreeMem(sdClass, sizeof(TCharSet));
|
FreeMem(sdClass, sizeof(TCharSet));
|
||||||
end;
|
end;
|
||||||
FillChar(FStateTable[i],SizeOf(FStateTable[i]),#0);
|
// I am not sure if the next line is necessary. rcAddState set all values, so
|
||||||
|
// it shouldn't be necessary to clear its contents?
|
||||||
|
// FillChar(FStateTable[i],SizeOf(FStateTable[i]),#0);
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
{clear the state transition table}
|
{clear the state transition table}
|
||||||
@ -742,22 +744,19 @@ begin
|
|||||||
end;
|
end;
|
||||||
'\' :
|
'\' :
|
||||||
begin
|
begin
|
||||||
case (FPosn+1)^ of
|
if (FPosn+1)^ in ['d','D','s','S','w','W'] then begin
|
||||||
'd','D','s','S','w','W':
|
New(CharClass);
|
||||||
begin
|
CharClass^ := [];
|
||||||
New(CharClass);
|
if not rcParseCharRange(CharClass) then begin
|
||||||
CharClass^ := [];
|
Dispose(CharClass);
|
||||||
if not rcParseCharRange(CharClass) then begin
|
Result := ErrorState;
|
||||||
Dispose(CharClass);
|
Exit;
|
||||||
Result := ErrorState;
|
end;
|
||||||
Exit;
|
Result := rcAddState(mtClass, #0, CharClass,
|
||||||
end;
|
|
||||||
Result := rcAddState(mtClass, #0, CharClass,
|
|
||||||
NewFinalState, UnusedState);
|
NewFinalState, UnusedState);
|
||||||
end;
|
end
|
||||||
else
|
else
|
||||||
Result := rcParseChar;
|
Result := rcParseChar;
|
||||||
end;
|
|
||||||
end;
|
end;
|
||||||
else
|
else
|
||||||
{otherwise parse a single character}
|
{otherwise parse a single character}
|
||||||
@ -816,8 +815,7 @@ begin
|
|||||||
begin
|
begin
|
||||||
inc(FPosn);
|
inc(FPosn);
|
||||||
ch := rcReturnEscapeChar;
|
ch := rcReturnEscapeChar;
|
||||||
if (FRegexType <> rtRegEx) then
|
FRegexType := rtRegEx;
|
||||||
FRegexType := rtRegEx;
|
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
ch :=FPosn^;
|
ch :=FPosn^;
|
||||||
|
Loading…
Reference in New Issue
Block a user