summaryrefslogtreecommitdiff
path: root/src/packrat-util.adb
diff options
context:
space:
mode:
Diffstat (limited to 'src/packrat-util.adb')
-rw-r--r--src/packrat-util.adb47
1 files changed, 35 insertions, 12 deletions
diff --git a/src/packrat-util.adb b/src/packrat-util.adb
index 6ee1d4a..dc9968b 100644
--- a/src/packrat-util.adb
+++ b/src/packrat-util.adb
@@ -1,8 +1,18 @@
+with
+
+ Ada.Characters.Latin_1;
+
+
package body Packrat.Util is
+ package Latin renames Ada.Characters.Latin_1;
+
+
+
+
function In_Set
(Element : in Character)
return Boolean is
@@ -26,7 +36,7 @@ package body Packrat.Util is
(Char : in Character)
return Boolean is
begin
- return False;
+ return (Char >= '0' and Char <= '9');
end Is_Digit;
@@ -34,7 +44,10 @@ package body Packrat.Util is
(Char : in Character)
return Boolean is
begin
- return False;
+ return
+ (Char >= '0' and Char <= '9') or
+ (Char >= 'A' and Char <= 'F') or
+ (Char >= 'a' and Char <= 'f');
end Is_Hex;
@@ -42,7 +55,9 @@ package body Packrat.Util is
(Char : in Character)
return Boolean is
begin
- return False;
+ return
+ (Char >= 'A' and Char <= 'Z') or
+ (Char >= 'a' and Char <= 'z');
end Is_Letter;
@@ -50,7 +65,7 @@ package body Packrat.Util is
(Char : in Character)
return Boolean is
begin
- return False;
+ return Is_Digit (Char) or Is_Letter (Char);
end Is_Alphanumeric;
@@ -58,7 +73,11 @@ package body Packrat.Util is
(Char : in Character)
return Boolean is
begin
- return False;
+ return
+ (Char >= '!' and Char <= '/') or
+ (Char >= ':' and Char <= '@') or
+ (Char >= '[' and Char <= '`') or
+ (Char >= '{' and Char <= '~');
end Is_Punctuation;
@@ -66,7 +85,7 @@ package body Packrat.Util is
(Char : in Character)
return Boolean is
begin
- return False;
+ return Char <= Character'Val (127);
end Is_ASCII;
@@ -74,7 +93,7 @@ package body Packrat.Util is
(Char : in Character)
return Boolean is
begin
- return False;
+ return Char >= Character'Val (128);
end Is_Extended_ASCII;
@@ -82,7 +101,7 @@ package body Packrat.Util is
(Char : in Character)
return Boolean is
begin
- return False;
+ return Char = ' ';
end Is_Space;
@@ -90,7 +109,7 @@ package body Packrat.Util is
(Char : in Character)
return Boolean is
begin
- return False;
+ return (Char = ' ' or Char = Latin.HT);
end Is_Linespace;
@@ -98,7 +117,7 @@ package body Packrat.Util is
(Char : in Character)
return Boolean is
begin
- return False;
+ return (Char = Latin.LF or Char = Latin.CR);
end Is_End_Of_Line;
@@ -106,7 +125,11 @@ package body Packrat.Util is
(Char : in Character)
return Boolean is
begin
- return False;
+ return
+ Char = Latin.HT or
+ Char = Latin.LF or
+ Char = Latin.CR or
+ Char = ' ';
end Is_Whitespace;
@@ -114,7 +137,7 @@ package body Packrat.Util is
(Char : in Character)
return Boolean is
begin
- return False;
+ return not Is_Whitespace (Char);
end Not_Whitespace;