diff options
author | Sean Whitton <spwhitton@spwhitton.name> | 2023-03-16 13:18:41 -0700 |
---|---|---|
committer | Sean Whitton <spwhitton@spwhitton.name> | 2023-03-16 19:05:09 -0700 |
commit | 4143535ae5eb9385a86240e152be873cc4348e03 (patch) | |
tree | 13cf54b103ef4d8a4540dc87aad7998797cb41e0 /src/util.lisp | |
parent | a2f0f9376e110d6c930b0cd3cf533c7fd3b7b917 (diff) | |
download | consfigurator-4143535ae5eb9385a86240e152be873cc4348e03.tar.gz |
add regexp trailing option to attempt to parse matches as numbers
Signed-off-by: Sean Whitton <spwhitton@spwhitton.name>
Diffstat (limited to 'src/util.lisp')
-rw-r--r-- | src/util.lisp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/util.lisp b/src/util.lisp index fea974d..ec2f249 100644 --- a/src/util.lisp +++ b/src/util.lisp @@ -333,6 +333,11 @@ expansion as a starting point for your own DEFPACKAGE form for your consfig." else do (princ #\: s) (loop-finish))))))))) +(defun try-parse-number (string &rest args &key &allow-other-keys) + (and string + (handler-case (apply #'parse-number string args) + (parse-error () string)))) + (eval-when (:compile-toplevel :load-toplevel :execute) (define-constant +alphanum+ "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz" |