summaryrefslogtreecommitdiff
path: root/main.lisp
diff options
context:
space:
mode:
Diffstat (limited to 'main.lisp')
-rw-r--r--main.lisp15
1 files changed, 9 insertions, 6 deletions
diff --git a/main.lisp b/main.lisp
index 3e6f255..683b70f 100644
--- a/main.lisp
+++ b/main.lisp
@@ -18,9 +18,12 @@
(defmacro defparser (name args parser)
(let ((message (format nil "In ~a:~&" name)))
- (cond ((equal args :const)
- `(defparameter ,name (append-on-failure ,parser ,message)))
- ((listp args)
- `(defun ,name ,args (append-on-failure ,parser ,message)))
- (t (error
- (format nil "Cannot define ~a: ~a is not :const or a list." name args))))))
+ (if (and (listp args) (every #'symbolp args))
+ (let (definition)
+ (when (= (length args) 0)
+ (push `(defparameter ,name (,name)) definition))
+ (push `(defun ,name (,@args) (append-on-failure ,parser ,message))
+ definition)
+ (push 'progn definition)
+ definition)
+ (error "Malformed argument list."))))