Return always-successful and always-failing parsers, with tunable
output.
cl:not function parser
cl:or macro parser
parse
cl:not function parser
cl:or macro parser
parse
+ parse-empty function
+ parse-fail function
parser macro
parser-at-eof-p generic
parser-capture-place generic
parser macro
parser-at-eof-p generic
parser-capture-place generic
\begin{describe}{fun}{combine-parser-failures @<failures> @> @<list>}
\end{describe}
\begin{describe}{fun}{combine-parser-failures @<failures> @> @<list>}
\end{describe}
+\begin{describe}{fun}{parse-empty \&optional @<value> @> @<function>}
+\end{describe}
+
+\begin{describe}{fun}
+ {parse-fail @<indicator> \&optional @<consumedp> @> @<function>}
+\end{describe}
+
%%%--------------------------------------------------------------------------
\section{File locations} \label{sec:parsing.floc}
%%%--------------------------------------------------------------------------
\section{File locations} \label{sec:parsing.floc}
failures
:initial-value nil))
failures
:initial-value nil))
+(export 'parse-empty)
+(defun parse-empty (&optional value)
+ "Return a parser which parses nothing, successfully.
+
+ The parser returns VALUE and consumes nothing."
+ (lambda () (values value t nil)))
+
+(export 'parse-fail)
+(defun parse-fail (indicator &optional consumedp)
+ "Return a parser which fails.
+
+ The parser reports the INDICATOR and (falsely) claims to have consumed
+ input if CONSUMEDP is true."
+ (lambda () (values indicator nil consumedp)))
+
;;;--------------------------------------------------------------------------
;;; Basic protocol.
;;;--------------------------------------------------------------------------
;;; Basic protocol.