diff options
author | Jed Barber <jjbarber@y7mail.com> | 2020-12-04 12:55:49 +1100 |
---|---|---|
committer | Jed Barber <jjbarber@y7mail.com> | 2020-12-04 12:55:49 +1100 |
commit | ad215be09de49dfb60245285d6ce20a0b58fdeac (patch) | |
tree | cdd6bdb62212c2017a8b61cfc0b4feda2402783c /src | |
parent | 6c918045828db04960a75494c2d1247dab6a1351 (diff) |
More generic token predicates
Diffstat (limited to 'src')
-rw-r--r-- | src/packrat-tokens.adb | 27 | ||||
-rw-r--r-- | src/packrat-tokens.ads | 19 |
2 files changed, 46 insertions, 0 deletions
diff --git a/src/packrat-tokens.adb b/src/packrat-tokens.adb index c07408c..81d68c3 100644 --- a/src/packrat-tokens.adb +++ b/src/packrat-tokens.adb @@ -111,6 +111,33 @@ package body Packrat.Tokens is end Value; + + + + function Is_Label + (This : in Token) + return Boolean is + begin + return This.Identifier = Ident; + end Is_Label; + + + function Is_Start + (This : in Token) + return Boolean is + begin + return This.Start_At = Start; + end Is_Start; + + + function Is_Value + (This : in Token) + return Boolean is + begin + return This.Token_Value.Element = Value; + end Is_Value; + + end Packrat.Tokens; diff --git a/src/packrat-tokens.ads b/src/packrat-tokens.ads index cd691b5..b731b13 100644 --- a/src/packrat-tokens.ads +++ b/src/packrat-tokens.ads @@ -60,6 +60,25 @@ package Packrat.Tokens is return Element_Array; + generic + Ident : in Label_Enum; + function Is_Label + (This : in Token) + return Boolean; + + generic + Start : in Positive; + function Is_Start + (This : in Token) + return Boolean; + + generic + Value : in Element_Array; + function Is_Value + (This : in Token) + return Boolean; + + private |