diff options
Diffstat (limited to 'src/packrat-tokens.ads')
-rw-r--r-- | src/packrat-tokens.ads | 61 |
1 files changed, 46 insertions, 15 deletions
diff --git a/src/packrat-tokens.ads b/src/packrat-tokens.ads index b731b13..5018610 100644 --- a/src/packrat-tokens.ads +++ b/src/packrat-tokens.ads @@ -17,65 +17,96 @@ generic package Packrat.Tokens is - type Token is private; - type Token_Array is array (Positive range <>) of Token; + type Token_Type is private; + type Token_Array is array (Positive range <>) of Token_Type; + + subtype Finish_Type is Natural; + type Finish_Array is array (Positive range <>) of Finish_Type; + + type Finished_Token_Type is record + Token : Token_Type; + Finish : Finish_Type; + end record; + + type Finished_Token_Array is array (Positive range <>) of Finished_Token_Type; + + function "<" - (Left, Right : in Token) + (Left, Right : in Token_Type) return Boolean; function "<" (Left, Right : in Token_Array) return Boolean; + function "<" + (Left, Right : in Finished_Token_Type) + return Boolean; + + function "<" + (Left, Right : in Finished_Token_Array) + return Boolean; + + + + + -- Note: The Start index indicates where the token was found + -- in whatever array it was lexed from. The Value does *not* + -- have to correspond with whatever is found there. function Create (Ident : in Label_Enum; Start : in Positive; Value : in Element_Array) - return Token; + return Token_Type; - -- Note: The Start index indicates where the token was found - -- in whatever array it was lexed from. The Value does *not* - -- have to correspond with whatever is found there. function Debug_String - (This : in Token) + (This : in Token_Type) return String; + function Debug_String + (This : in Finished_Token_Type) + return String; + + + function Label - (This : in Token) + (This : in Token_Type) return Label_Enum; function Start - (This : in Token) + (This : in Token_Type) return Positive; function Value - (This : in Token) + (This : in Token_Type) return Element_Array; + + generic Ident : in Label_Enum; function Is_Label - (This : in Token) + (This : in Token_Type) return Boolean; generic Start : in Positive; function Is_Start - (This : in Token) + (This : in Token_Type) return Boolean; generic Value : in Element_Array; function Is_Value - (This : in Token) + (This : in Token_Type) return Boolean; @@ -90,7 +121,7 @@ private return Boolean; - type Token is record + type Token_Type is record Identifier : Label_Enum; Start_At : Positive; Token_Value : Value_Holders.Holder; |