summaryrefslogtreecommitdiff
path: root/main.lisp
diff options
context:
space:
mode:
authorJuan Manuel Tomás <jtomas1815@gmail.com>2026-08-28 06:16:12 -0300
committerJuan Manuel Tomás <jtomas1815@gmail.com>2026-08-28 06:16:12 -0300
commit401fd8f16664d81d84c2fd7ecbc2333d6f3ec108 (patch)
tree72f168f760a8bb521a73535b46feafd29b33c2c0 /main.lisp
parent0150531bb547fc5f2a193eb3fa51e654e67c73e5 (diff)
downloadmonparser-401fd8f16664d81d84c2fd7ecbc2333d6f3ec108.tar.gz
monparser-401fd8f16664d81d84c2fd7ecbc2333d6f3ec108.zip
Prepare for new tracing and tidy up testing
Main stuff was moved into base so that I can better incorporate tracing in the future. I'm thinking it will involve modifying new and bind.
Diffstat (limited to 'main.lisp')
-rw-r--r--main.lisp27
1 files changed, 0 insertions, 27 deletions
diff --git a/main.lisp b/main.lisp
deleted file mode 100644
index b557327..0000000
--- a/main.lisp
+++ /dev/null
@@ -1,27 +0,0 @@
-(in-package #:monparser)
-
-(declaim (ftype (function (parser string) result) parse))
-(defun parse (parser data)
- (funcall parser (make-cursor :data data)))
-
-(declaim (ftype (function (parser string) parser) append-on-failure))
-(defun append-on-failure (p message)
- (lambda (input)
- (let ((result (funcall p input)))
- (if (failure-p result)
- (make-failure :place (result-place result)
- :message (concatenate 'string message (failure-message result))
- :priority (failure-priority result))
- result))))
-
-(defmacro defparser (name args parser)
- (let ((message (format nil "In ~a:~&" name)))
- (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."))))