mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-08 07:58:06 +02:00
LazStringUtils: deprecate LazIsValidIdent and use SysUtils.IsValidIdent in it's implementation.
This commit is contained in:
parent
93af67085a
commit
e76c844eee
@ -112,7 +112,7 @@ function LoadStringFromFile(const aFileName: String): String;
|
||||
|
||||
// Like IsValidIdent() in FPC 3.1.
|
||||
function LazIsValidIdent(const Ident: string; AllowDots: Boolean = False;
|
||||
StrictDots: Boolean = False): Boolean;
|
||||
StrictDots: Boolean = False): Boolean; deprecated 'Use SysUtils.IsValidIdent instead'; //Remove in 4.99
|
||||
|
||||
const
|
||||
MaxTextLen = 80;
|
||||
@ -1444,39 +1444,8 @@ end;
|
||||
|
||||
function LazIsValidIdent(const Ident: string; AllowDots: Boolean = False;
|
||||
StrictDots: Boolean = False): Boolean;
|
||||
// This is a copy of IsValidIdent from FPC 3.1.
|
||||
// ToDo: Switch to using IsValidIdent from FPC 3.2 when it is the minimum requirement.
|
||||
const
|
||||
Alpha = ['A'..'Z', 'a'..'z', '_'];
|
||||
AlphaNum = Alpha + ['0'..'9'];
|
||||
var
|
||||
First: Boolean;
|
||||
I, Len: Integer;
|
||||
begin
|
||||
Len := Length(Ident);
|
||||
if Len < 1 then
|
||||
Exit(False);
|
||||
First := True;
|
||||
for I := 1 to Len do
|
||||
begin
|
||||
if First then
|
||||
begin
|
||||
Result := Ident[I] in Alpha;
|
||||
First := False;
|
||||
end
|
||||
else if AllowDots and (Ident[I] = '.') then
|
||||
begin
|
||||
if StrictDots then
|
||||
begin
|
||||
Result := I < Len;
|
||||
First := True;
|
||||
end;
|
||||
end
|
||||
else
|
||||
Result := Ident[I] in AlphaNum;
|
||||
if not Result then
|
||||
Break;
|
||||
end;
|
||||
Result := SysUtils.IsValidIdent(Ident, AllowDots, StrictDots);
|
||||
end;
|
||||
|
||||
end.
|
||||
|
Loading…
Reference in New Issue
Block a user