summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJed Barber <jjbarber@y7mail.com>2019-01-09 20:54:12 +1100
committerJed Barber <jjbarber@y7mail.com>2019-01-09 20:54:12 +1100
commite9862fcf976878cdec96b5f00adee010fd1c8382 (patch)
tree318f92c52937040b6bb724fdc36ab93c424411ae /src
parent11f3f26e877210b88f1cadfe2c26d67b4530039c (diff)
Relaxed validity rules on error identifiers due to inability to have enum-specific generic parameter
Diffstat (limited to 'src')
-rw-r--r--src/packrat-errors.adb20
1 files changed, 19 insertions, 1 deletions
diff --git a/src/packrat-errors.adb b/src/packrat-errors.adb
index cb54e97..d59e4c7 100644
--- a/src/packrat-errors.adb
+++ b/src/packrat-errors.adb
@@ -96,11 +96,29 @@ package body Errors is
function Valid_Identifier
(Check : in String)
- return Boolean is
+ return Boolean
+ is
+ All_Digit : Boolean;
begin
if Check'Length < 1 then
return False;
end if;
+
+ -- Have to relax requirements to allow Integers and such
+ -- since there is no way to require a generic parameter to
+ -- *only* be an enumeration.
+ All_Digit := True;
+ for N in Integer range Check'First .. Check'Last loop
+ if not Is_Digit (Check (N)) then
+ All_Digit := False;
+ exit;
+ end if;
+ end loop;
+ if All_Digit then
+ return True;
+ end if;
+
+ -- Regular checks for a valid identifier.
if not Is_Letter (Check (Check'First)) then
return False;
end if;