From: Mark Wooding Date: Fri, 6 Jul 2018 23:06:53 +0000 (+0100) Subject: src/final.lisp: Add a new function for testing property-set parsing. X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~mdw/git/sod/commitdiff_plain/bf34c7086b3c296a63ac0a7e8251c0e59cbe47d5?ds=inline src/final.lisp: Add a new function for testing property-set parsing. --- diff --git a/doc/SYMBOLS b/doc/SYMBOLS index dbb5d88..44d2040 100644 --- a/doc/SYMBOLS +++ b/doc/SYMBOLS @@ -461,6 +461,7 @@ final.lisp exercise function test-module function test-parse-c-type function + test-parse-pset function test-parser macro fragment-parse.lisp diff --git a/doc/misc.tex b/doc/misc.tex index 7de8a23..8f9a69c 100644 --- a/doc/misc.tex +++ b/doc/misc.tex @@ -593,6 +593,11 @@ These symbols are defined in the @|optparse| package. @> t @ @ @ @! nil @} \end{describe} +\begin{describe}{fun} + {test-parse-pset @ + @> t @ @! nil @} +\end{describe} + \begin{describe}{mac} {test-parser (@ \&key :backtrace) @ @ @> @ @ @} diff --git a/src/final.lisp b/src/final.lisp index 0b7a366..93fafe8 100644 --- a/src/final.lisp +++ b/src/final.lisp @@ -93,6 +93,15 @@ (defun test-parse-c-type (string) (princ-to-string (car value))) (values nil value))))) +(export 'test-parse-pset) +(defun test-parse-pset (string) + "Parse STRING as a property set, and show the results." + (with-test-scanner (scanner string) + (multiple-value-bind (value winp consumedp) + (parse-property-set scanner) + (declare (ignore consumedp)) + (values winp value)))) + (export 'test-parser) (defmacro test-parser ((scanner &key backtrace) parser input) "Convenient macro for testing parsers at the REPL.