LazUtils: Masks: make CompileSpecialChars and CompileEscapeCharPlusLiteral methods of TMaskUtf8 instead of nested procs.

Note: code contains debug writeln's, so it will crash if no console is available.
This commit is contained in:
Bart 2021-11-08 22:07:30 +01:00
parent e76d29f85b
commit a0d01a5922

View File

@ -220,6 +220,8 @@ type
procedure AddLiteral;
procedure AddRange(lFirstRange, lSecondRange: Integer);
procedure CompileRange;
procedure CompileEscapeCharPlusLiteral;
procedure CompileSpecialChar;
function GetMask: String; virtual;
procedure ReverseRange(lFirstRange, lSecondRange: Integer);
procedure SetMask(AValue: String); virtual;
@ -912,9 +914,9 @@ begin
Result := fOriginalMask;
end;
procedure TMaskUTF8.Compile;
procedure CompileEscapeCharPlusLiteral;
begin
procedure TMaskUtf8.CompileEscapeCharPlusLiteral;
begin
inc(fMaskInd,fCPLength);
if fMaskInd<=fMaskLimit then begin
fCPLength:=UTF8CodepointSizeFast(@fMask[fMaskInd]);
@ -923,10 +925,10 @@ procedure TMaskUTF8.Compile;
end
else
Exception_IncompleteMask();
end;
end;
procedure CompileSpecialChar;
begin
procedure TMaskUtf8.CompileSpecialChar;
begin
case fMask[fMaskInd] of
'*':
begin
@ -978,13 +980,9 @@ procedure TMaskUTF8.Compile;
CompileOtherSpecialChars;
end;
end;
end;
end;
//****************************
var
junkbyte: Byte;
junk: integer;
//*****************************
procedure TMaskUTF8.Compile;
begin
inherited Compile;
//if Compile fails and a new call to Matches is made and Mask is unchanged