diff options
Diffstat (limited to 'src/packrat-lexers.ads')
-rw-r--r-- | src/packrat-lexers.ads | 123 |
1 files changed, 75 insertions, 48 deletions
diff --git a/src/packrat-lexers.ads b/src/packrat-lexers.ads index 57fc462..68a01d0 100644 --- a/src/packrat-lexers.ads +++ b/src/packrat-lexers.ads @@ -17,6 +17,11 @@ generic package Packrat.Lexers is + type Lexer_Context is private; + + + + type Combinator_Result is private; type Combinator is access function @@ -29,13 +34,6 @@ package Packrat.Lexers is - type Lexer_Context is private; - - Empty_Context : constant Lexer_Context; - - - - type Component_Result is private; type Component is access function @@ -55,68 +53,97 @@ package Packrat.Lexers is generic - Label : in Traits.Label_Enum; - with function Combo - (Input : in Traits.Element_Array; - Start : in Positive) - return Combinator_Result; - function Stamp - (Input : in Traits.Element_Array; - Context : in out Lexer_Context) - return Component_Result; + Components : in Component_Array; + package Scan_Parts is - generic - Label : in Traits.Label_Enum; - with function Combo - (Input : in Traits.Element_Array; - Start : in Positive) - return Combinator_Result; - function Ignore - (Input : in Traits.Element_Array; - Context : in out Lexer_Context) - return Component_Result; + function Scan + (Input : in Traits.Element_Array) + return Traits.Tokens.Token_Array; + procedure Reset; + end Scan_Parts; generic Components : in Component_Array; - function Scan - (Input : in Traits.Element_Array; - Context : in out Lexer_Context) - return Traits.Tokens.Token_Array; + package Scan_Once is + + function Scan + (Input : in Traits.Element_Array) + return Traits.Tokens.Token_Array; + + procedure Reset; + + end Scan_Once; - generic - Components : in Component_Array; - function Scan_Only - (Input : in Traits.Element_Array; - Context : in out Lexer_Context) - return Traits.Tokens.Token_Array; generic Components : in Component_Array; - function Scan_With - (Input : in With_Input; - Context : in out Lexer_Context) - return Traits.Tokens.Token_Array; + package Scan_With is + + function Scan + (Input : in With_Input) + return Traits.Tokens.Token_Array; + + procedure Reset; + + end Scan_With; + generic Components : in Component_Array; Pad_In : in Traits.Element_Type; Pad_Out : in Traits.Tokens.Token; - procedure Scan_Set - (Input : in Traits.Element_Array; - Context : in out Lexer_Context; - Output : out Traits.Tokens.Token_Array); + package Scan_Set is + + procedure Scan + (Input : in Traits.Element_Array; + Output : out Traits.Tokens.Token_Array); + + procedure Reset; + + end Scan_Set; + generic Components : in Component_Array; Pad_In : in Traits.Element_Type; Pad_Out : in Traits.Tokens.Token; - procedure Scan_Set_With - (Input : in With_Input; - Context : in out Lexer_Context; - Output : out Traits.Tokens.Token_Array); + package Scan_Set_With is + + procedure Scan + (Input : in With_Input; + Output : out Traits.Tokens.Token_Array); + + procedure Reset; + + end Scan_Set_With; + + + + + generic + Label : in Traits.Label_Enum; + with function Combo + (Input : in Traits.Element_Array; + Start : in Positive) + return Combinator_Result; + function Stamp + (Input : in Traits.Element_Array; + Context : in out Lexer_Context) + return Component_Result; + + generic + Label : in Traits.Label_Enum; + with function Combo + (Input : in Traits.Element_Array; + Start : in Positive) + return Combinator_Result; + function Ignore + (Input : in Traits.Element_Array; + Context : in out Lexer_Context) + return Component_Result; |