diff options
-rw-r--r-- | src/packrat-errors.adb | 20 |
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; |