Index: trunk/parse2.lisp
===================================================================
--- trunk/parse2.lisp	(revision trunk,5)
+++ trunk/parse2.lisp	(revision trunk,6)
@@ -51,5 +51,29 @@
 
 (defmacro with-regex-parser ((name regex) &body body)
-  (error "Not implemented."))
+  (declare ((symbol name)
+	    (string regex)))
+  (follow "with-regex-parser~%")
+  (let ((regex2 `(:sequence (:flags) :start-anchor
+		  (:register (:regex ,regex)))))
+    (with-gensyms (input start end)
+      `(flet ((,name (,input)
+	       ,(format nil "Regex parser for ~S." regex)
+	       (declare (string ,input))
+	       (multiple-value-bind (,start ,end) (scan (quote ,regex2) ,input)
+		 (when ,start
+		   (values
+		    t
+		    (substring ,input :start ,end)
+		    (list (substring ,input :end ,end)))))))))))
+
+(defmacro with-user-parser ((name parser) &body body)
+  (declare (symbol name parser))
+  (follow "with-user-parser~%")
+  (with-gensyms (input)
+    `(flet ((,name (,input)
+	     ,(format nil "User parser for ~S." parser)
+	     (,parser ,input)))
+      (declare (inline ,name))
+      ,@body)))
 
 (defmacro with-sequence-parser% ((name seq) &body body)
@@ -181,4 +205,5 @@
     (character `(with-character-parser (,name ,rule) ,@body))
     (string `(with-string-parser (,name ,rule) ,@body))
+    (symbol `(with-user-parser (,name ,rule) ,@body))
     (list
      (destructuring-bind (head . tail) rule
