From bf34c7086b3c296a63ac0a7e8251c0e59cbe47d5 Mon Sep 17 00:00:00 2001 From: Mark Wooding Date: Sat, 7 Jul 2018 00:06:53 +0100 Subject: [PATCH] src/final.lisp: Add a new function for testing property-set parsing. --- doc/SYMBOLS | 1 + doc/misc.tex | 5 +++++ src/final.lisp | 9 +++++++++ 3 files changed, 15 insertions(+) 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 @@ (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. -- 2.11.0