Flesh out library idea some more

This commit is contained in:
Folkert Kevelam 2025-07-14 22:13:58 +02:00
parent a0cd38fb82
commit c1304e9714
3 changed files with 25 additions and 0 deletions

2
.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
lib/
obj/

View File

@ -6,6 +6,14 @@ package Argument_Parser is
function Parse (I : String) return Option is abstract; function Parse (I : String) return Option is abstract;
type Argument_Parser is tagged private;
function Parse (T : Argument_Parser) return Boolean;
function Find (T : Argument_Parser; Key : String) return Option'Class;
type Count is range 0 .. 2**31 - 1;
procedure Add_Positional ( procedure Add_Positional (
Parser : in out Argument_Parser; Parser : in out Argument_Parser;
Input_Type : Option'Class; Input_Type : Option'Class;
@ -37,6 +45,8 @@ package Argument_Parser is
overriding overriding
function Parse (I : String) return String_Option; function Parse (I : String) return String_Option;
function Value (O : String_Option) return String;
type Integer_Option is new Option with type Integer_Option is new Option with
record record
Value : Integer; Value : Integer;
@ -45,6 +55,8 @@ package Argument_Parser is
overriding overriding
function Parse (I : String) return Integer_Option; function Parse (I : String) return Integer_Option;
function Value (O : Integer_Option) return Integer;
type Float_Option is new Option with type Float_Option is new Option with
record record
Value : Float; Value : Float;
@ -53,6 +65,8 @@ package Argument_Parser is
overriding overriding
function Parse (I : String) return Float_Option; function Parse (I : String) return Float_Option;
function Value (O : Float_Option) return Float;
private private
type Argument_Parser is tagged null record; type Argument_Parser is tagged null record;

9
argument_parser.gpr Normal file
View File

@ -0,0 +1,9 @@
library project Argument_Parser is
for Source_Dirs use ("Source/Spec", "Source/Impl");
for Object_Dir use "obj";
for Library_Name use "Argument_Parser";
for Library_Dir use "lib";
for Library_Kind use "Static";
end Argument_Parser;