summaryrefslogtreecommitdiff
path: root/src/packrat-tokens.adb
diff options
context:
space:
mode:
Diffstat (limited to 'src/packrat-tokens.adb')
-rw-r--r--src/packrat-tokens.adb44
1 files changed, 22 insertions, 22 deletions
diff --git a/src/packrat-tokens.adb b/src/packrat-tokens.adb
index 60d03e3..c07408c 100644
--- a/src/packrat-tokens.adb
+++ b/src/packrat-tokens.adb
@@ -16,32 +16,20 @@ package body Packrat.Tokens is
function "<"
+ (Left, Right : in Value_Holders.Holder)
+ return Boolean is
+ begin
+ return Left.Element < Right.Element;
+ end "<";
+
+
+ function "<"
(Left, Right : in Token)
- return Boolean
- is
- Left_Index, Right_Index : Positive;
+ return Boolean is
begin
if Left.Start_At = Right.Start_At then
if Left.Identifier = Right.Identifier then
- Left_Index := Left.Token_Value.Constant_Reference.Element'First;
- Right_Index := Right.Token_Value.Constant_Reference.Element'First;
- while Left_Index <= Left.Token_Value.Constant_Reference.Element'Last and
- Right_Index <= Right.Token_Value.Constant_Reference.Element'Last
- loop
- if Left.Token_Value.Constant_Reference.Element (Left_Index) <
- Right.Token_Value.Constant_Reference.Element (Right_Index)
- then
- return True;
- elsif Left.Token_Value.Constant_Reference.Element (Left_Index) /=
- Right.Token_Value.Constant_Reference.Element (Right_Index)
- then
- return False;
- end if;
- Left_Index := Left_Index + 1;
- Right_Index := Right_Index + 1;
- end loop;
- return Left.Token_Value.Constant_Reference.Element'Length <
- Right.Token_Value.Constant_Reference.Element'Length;
+ return Left.Token_Value < Right.Token_Value;
else
return Left.Identifier < Right.Identifier;
end if;
@@ -51,6 +39,18 @@ package body Packrat.Tokens is
end "<";
+ function "<"
+ (Left, Right : in Token_Array)
+ return Boolean
+ is
+ function LT is new Array_Less_Than
+ (Base_Type => Token,
+ Array_Type => Token_Array);
+ begin
+ return LT (Left, Right);
+ end "<";
+
+