mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-18 04:29:17 +02:00
* Add IsYAMLfileName
This commit is contained in:
parent
2b56b2d725
commit
abeccabdf1
@ -78,6 +78,7 @@ Type
|
|||||||
Constructor Create(const aInput : array of string);
|
Constructor Create(const aInput : array of string);
|
||||||
Constructor Create(const aFileName : string);
|
Constructor Create(const aFileName : string);
|
||||||
Destructor Destroy; override;
|
Destructor Destroy; override;
|
||||||
|
Class function IsYamlFileName(const aFileName : string) : Boolean; inline;
|
||||||
function ParseSingleDocument: TYAMLDocument;
|
function ParseSingleDocument: TYAMLDocument;
|
||||||
Function Parse : TYAMLStream;
|
Function Parse : TYAMLStream;
|
||||||
end;
|
end;
|
||||||
@ -620,11 +621,20 @@ begin
|
|||||||
inherited Destroy;
|
inherited Destroy;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
class function TYAMLParser.IsYamlFileName(const aFileName: string): Boolean;
|
||||||
|
|
||||||
|
begin
|
||||||
|
Result:=fpyaml.types.IsYamlFileName(aFileName);
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
function TYAMLParser.ParseSingleDocument: TYAMLDocument;
|
function TYAMLParser.ParseSingleDocument: TYAMLDocument;
|
||||||
begin
|
begin
|
||||||
Result:=ParseSingleDocument(Nil);
|
Result:=ParseSingleDocument(Nil);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
function TYAMLParser.ParseSingleDocument(aStream : TYAMLStream): TYAMLDocument;
|
function TYAMLParser.ParseSingleDocument(aStream : TYAMLStream): TYAMLDocument;
|
||||||
|
|
||||||
var
|
var
|
||||||
|
@ -18,6 +18,10 @@ unit fpyaml.strings;
|
|||||||
|
|
||||||
interface
|
interface
|
||||||
|
|
||||||
|
const
|
||||||
|
YAMLExt1 = '.yaml';
|
||||||
|
YAMLExt2 = '.yml';
|
||||||
|
|
||||||
resourcestring
|
resourcestring
|
||||||
// Data
|
// Data
|
||||||
SErrIsNotA = '%s is not a valid %s';
|
SErrIsNotA = '%s is not a valid %s';
|
||||||
|
@ -87,6 +87,8 @@ Const
|
|||||||
'tag:yaml.org,2002:seq',
|
'tag:yaml.org,2002:seq',
|
||||||
'tag:yaml.org,2002:map');
|
'tag:yaml.org,2002:map');
|
||||||
|
|
||||||
|
Function IsYAMLFileName(const aFileName : string) : Boolean;
|
||||||
|
|
||||||
implementation
|
implementation
|
||||||
|
|
||||||
|
|
||||||
@ -143,5 +145,16 @@ begin
|
|||||||
Result:=YAMLTagNames[Self];
|
Result:=YAMLTagNames[Self];
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
Function IsYAMLFileName(const aFileName : string) : Boolean;
|
||||||
|
|
||||||
|
var
|
||||||
|
Ext : string;
|
||||||
|
|
||||||
|
begin
|
||||||
|
Ext:=ExtractFileExt(aFileName);
|
||||||
|
Result:=SameText(YamlExt1,Ext) or SameText(YamlExt2,Ext);
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
end.
|
end.
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user