From e9862fcf976878cdec96b5f00adee010fd1c8382 Mon Sep 17 00:00:00 2001 From: Jed Barber Date: Wed, 9 Jan 2019 20:54:12 +1100 Subject: Relaxed validity rules on error identifiers due to inability to have enum-specific generic parameter --- src/packrat-errors.adb | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) (limited to 'src/packrat-errors.adb') 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; -- cgit