diff -Nru cl-esrap-20170630/debian/changelog cl-esrap-20180430/debian/changelog --- cl-esrap-20170630/debian/changelog 2017-07-06 13:28:59.000000000 +0000 +++ cl-esrap-20180430/debian/changelog 2018-05-16 09:48:27.000000000 +0000 @@ -1,3 +1,9 @@ +cl-esrap (20180430-1) unstable; urgency=medium + + * Quicklisp release update. + + -- Dimitri Fontaine Wed, 16 May 2018 09:48:27 +0000 + cl-esrap (20170630-1) unstable; urgency=medium * Quicklisp release update. diff -Nru cl-esrap-20170630/debian/compat cl-esrap-20180430/debian/compat --- cl-esrap-20170630/debian/compat 2014-04-30 14:01:04.000000000 +0000 +++ cl-esrap-20180430/debian/compat 2018-03-06 13:38:56.000000000 +0000 @@ -1 +1 @@ -7 \ No newline at end of file +9 \ No newline at end of file diff -Nru cl-esrap-20170630/debian/control cl-esrap-20180430/debian/control --- cl-esrap-20170630/debian/control 2015-05-02 13:50:42.000000000 +0000 +++ cl-esrap-20180430/debian/control 2018-03-06 13:38:56.000000000 +0000 @@ -4,7 +4,7 @@ Maintainer: Dimitri Fontaine Build-Depends: debhelper (>= 7) Build-Depends-Indep: dh-lisp -Standards-Version: 3.9.6 +Standards-Version: 4.1.3 Homepage: http://nikodemus.github.io/esrap/ Vcs-Git: git://github.com/nikodemus/esrap.git Vcs-Browser: http://github.com/nikodemus/esrap diff -Nru cl-esrap-20170630/esrap.asd cl-esrap-20180430/esrap.asd --- cl-esrap-20170630/esrap.asd 2017-05-26 09:30:07.000000000 +0000 +++ cl-esrap-20180430/esrap.asd 2018-04-04 08:41:47.000000000 +0000 @@ -1,5 +1,5 @@ ;;;; Copyright (c) 2007-2013 Nikodemus Siivola -;;;; Copyright (c) 2012-2017 Jan Moringen +;;;; Copyright (c) 2012-2018 Jan Moringen ;;;; ;;;; Permission is hereby granted, free of charge, to any person ;;;; obtaining a copy of this software and associated documentation files @@ -17,8 +17,8 @@ ;;;; TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE ;;;; SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -(defsystem :esrap - :version "0.15" +(defsystem "esrap" + :version "0.17" :description "A Packrat / Parsing Grammar / TDPL parser for Common Lisp." :long-description "A Packrat / Parsing Grammar / TDPL parser for Common Lisp. @@ -42,7 +42,7 @@ :bug-tracker "https://github.com/scymtym/esrap/issues" :source-control (:git "https://github.com/scymtym/esrap.git") :licence "MIT" - :depends-on (:alexandria) + :depends-on ("alexandria") :components ((:module "src" :serial t :components ((:file "package") @@ -66,9 +66,9 @@ (:static-file "function-terminals.lisp"))) (:static-file "README.org")) - :in-order-to ((test-op (test-op :esrap/tests)))) + :in-order-to ((test-op (test-op "esrap/tests")))) -(defmethod perform :after ((op load-op) (sys (eql (find-system :esrap)))) +(defmethod perform :after ((op load-op) (sys (eql (find-system "esrap")))) ;; Since version 0.16 ;; * DEFRULE accepts an :ERROR-REPORT option ;; Since version 0.15 @@ -88,14 +88,14 @@ ;; For consistency with examples which contain (require :esrap). (provide :esrap)) -(defsystem :esrap/tests +(defsystem "esrap/tests" :description "Tests for ESRAP." :author ("Nikodemus Siivola " "Jan Moringen ") :maintainer "Jan Moringen " :licence "MIT" - :depends-on (:esrap - (:version :fiveam "1.3")) + :depends-on ("esrap" + (:version "fiveam" "1.3")) :serial t :components ((:module "examples" :components ((:file "left-recursion") @@ -105,10 +105,10 @@ :serial t :components ((:file "package") (:file "util") + (:file "expressions") (:file "tests") (:file "examples") - (:file "readme"))))) + (:file "readme")))) -(defmethod perform ((operation test-op) - (system (eql (find-system :esrap/tests)))) - (funcall (intern "RUN-TESTS" :esrap-tests))) + :perform (test-op (operation component) + (uiop:symbol-call '#:esrap-tests '#:run-tests))) diff -Nru cl-esrap-20170630/examples/left-recursion.lisp cl-esrap-20180430/examples/left-recursion.lisp --- cl-esrap-20170630/examples/left-recursion.lisp 2017-05-26 09:30:07.000000000 +0000 +++ cl-esrap-20180430/examples/left-recursion.lisp 2018-04-04 08:41:47.000000000 +0000 @@ -34,7 +34,9 @@ (defun test-la () (let ((*on-left-recursion* :error)) (assert (equal (parse 'la-expr "1*2+3*4+5") - '(+ (* 1 2) (+ (* 3 4) 5)))))) + '(+ (* 1 2) + (+ (* 3 4) + 5)))))) ;;; Right associative expressions @@ -64,8 +66,9 @@ (parse 'ra-expr "1*2+3*4+5")) ; |- Error (assert (equal (parse 'ra-expr "1*2+3*4+5") - '(+ (+ (* 1 2) (* 3 4)) 5)))) - + '(+ (+ (* 1 2) + (* 3 4)) + 5)))) ;;; The following example is given in ;;; @@ -84,8 +87,8 @@ "this")) (defrule class-instance-creation-expression - (or (and "new" class-or-interface-type "()") - (and primary ".new" identifier "()"))) + (or (and "new" class-or-interface-type "()") + (and primary ".new" identifier "()"))) ;; Note: in the paper, the first case is ;; @@ -93,21 +96,21 @@ ;; ;; but that seems to be an error. (defrule method-invocation - (or (and primary "." method-name "()") - (and (and) (and) method-name "()")) + (or (and primary "." method-name "()") + (and (and) (and) method-name "()")) (:destructure (structure dot name parens) (declare (ignore dot parens)) (list :method-invocation structure name))) (defrule field-access (or (and primary "." identifier) - (and "super." identifier)) + (and "super." identifier)) (:destructure (structure dot field) (declare (ignore dot)) (list :field-access structure field))) (defrule array-access - (or (and primary "[" expression "]") + (or (and primary "[" expression "]") (and expression-name "[" expression "]")) (:destructure (structure open index close) (declare (ignore open close)) diff -Nru cl-esrap-20170630/src/expressions.lisp cl-esrap-20180430/src/expressions.lisp --- cl-esrap-20170630/src/expressions.lisp 2017-05-26 09:30:07.000000000 +0000 +++ cl-esrap-20180430/src/expressions.lisp 2018-04-04 08:41:47.000000000 +0000 @@ -1,5 +1,5 @@ ;;;; Copyright (c) 2007-2013 Nikodemus Siivola -;;;; Copyright (c) 2012-2017 Jan Moringen +;;;; Copyright (c) 2012-2018 Jan Moringen ;;;; ;;;; Permission is hereby granted, free of charge, to any person ;;;; obtaining a copy of this software and associated documentation files @@ -163,7 +163,7 @@ ((character string character-ranges function terminal) result) (nonterminal - (list* expression result)) + (adjoin expression result :test #'eq)) ((and or) (reduce #'rec (rest expression) :initial-value result :from-end t)) @@ -308,7 +308,7 @@ (output prefix (length sub-expression)) (rec (first sub-expression)) (loop :for terminal :in (rest sub-expression) - :do (output separator) (rec terminal))) + :do (output separator) (rec terminal))) (rec (terminal) (expression-case terminal (character @@ -327,10 +327,12 @@ (character ;; For non-graphic or whitespace characters, ;; just print the name. - (output "the character ~:[~*~A~:;~A (~A)~]" - (and (graphic-char-p thing) - (not (member thing '(#\Space #\Tab #\Newline)))) - thing (char-name thing))) + (let ((both-p (and (graphic-char-p thing) + (not (member thing + '(#\Space #\Tab #\Newline))))) + (name (char-name thing))) + (output "the character ~:[~*~A~;~A~@[ (~A)~]~]" + both-p thing name))) (string (if (length= 1 thing) (rec (char thing 0)) diff -Nru cl-esrap-20170630/src/macros.lisp cl-esrap-20180430/src/macros.lisp --- cl-esrap-20170630/src/macros.lisp 2017-05-26 09:30:07.000000000 +0000 +++ cl-esrap-20180430/src/macros.lisp 2018-04-04 08:41:47.000000000 +0000 @@ -55,6 +55,19 @@ (setf value-seen t value new-value)))))) +;;; http://jcsu.jesus.cam.ac.uk/~csr21/papers/features.pdf +(eval-when (:compile-toplevel :execute) + (when (and (find-package '#:sb-ext) + (find-symbol (string '#:with-current-source-form) '#:sb-ext)) + (pushnew 'sb-ext-with-current-source-form *features*))) + +(defmacro with-current-source-form ((&rest forms) &body body) + #-esrap::sb-ext-with-current-source-form (declare (ignore forms)) + #+esrap::sb-ext-with-current-source-form + `(sb-ext:with-current-source-form (,@forms) ,@body) + #-esrap::sb-ext-with-current-source-form + `(progn ,@body)) + ;;; DEFRULE support functions (defun parse-lambda-list-maybe-containing-&bounds (lambda-list) @@ -167,55 +180,59 @@ (error-report (singleton-option 'defrule form :error-report 'rule-error-report :default t))) (dolist (option options) - (destructuring-ecase option - ((:when expr &rest rest) - (when rest - (error "~@" - :when form)) - (funcall when (cons (cond - ((not (constantp expr)) - `(lambda () ,expr)) - ((eval expr) - t)) - expr))) - ((:constant value) - (declare (ignore value)) - (push option transform)) - ((:text value) - (when value - (push option transform))) - ((:identity value) - (when value - (push option transform))) - ((:lambda lambda-list &body forms) - (multiple-value-bind (lambda-list* start-var end-var ignore) - (parse-lambda-list-maybe-containing-&bounds lambda-list) - (check-lambda-list lambda-list* - '(or (:required 1) (:optional 1)) - :report-lambda-list lambda-list) - (push (list :lambda lambda-list* start-var end-var ignore forms) - transform))) - ((:function designator) - (declare (ignore designator)) - (push option transform)) - ((:destructure lambda-list &body forms) - (multiple-value-bind (lambda-list* start-var end-var ignore) - (parse-lambda-list-maybe-containing-&bounds lambda-list) - (push (list :destructure lambda-list* start-var end-var ignore forms) - transform))) - ((:around lambda-list &body forms) - (multiple-value-bind (lambda-list* start end ignore) - (parse-lambda-list-maybe-containing-&bounds lambda-list) - (check-lambda-list - lambda-list* '() :report-lambda-list lambda-list) - (setf around `(lambda (,start ,end transform) - (declare (ignore ,@ignore) - (function transform)) - (flet ((call-transform () - (funcall transform))) - ,@forms))))) - ((:error-report behavior) - (funcall error-report behavior)))) + (with-current-source-form (option) + (destructuring-ecase option + ((:when expr &rest rest) + (when rest + (error "~@" + :when form)) + (funcall when (cons (cond + ((not (constantp expr)) + `(lambda () ,expr)) + ((eval expr) + t)) + expr))) + ((:constant value) + (declare (ignore value)) + (push option transform)) + ((:text value) + (when value + (push option transform))) + ((:identity value) + (when value + (push option transform))) + ((:lambda lambda-list &body forms) + (with-current-source-form (lambda-list option) + (multiple-value-bind (lambda-list* start-var end-var ignore) + (parse-lambda-list-maybe-containing-&bounds lambda-list) + (check-lambda-list lambda-list* + '(or (:required 1) (:optional 1)) + :report-lambda-list lambda-list) + (push (list :lambda lambda-list* start-var end-var ignore forms) + transform)))) + ((:function designator) + (declare (ignore designator)) + (push option transform)) + ((:destructure lambda-list &body forms) + (with-current-source-form (lambda-list option) + (multiple-value-bind (lambda-list* start-var end-var ignore) + (parse-lambda-list-maybe-containing-&bounds lambda-list) + (push (list :destructure lambda-list* start-var end-var ignore forms) + transform)))) + ((:around lambda-list &body forms) + (with-current-source-form (lambda-list option) + (multiple-value-bind (lambda-list* start end ignore) + (parse-lambda-list-maybe-containing-&bounds lambda-list) + (check-lambda-list + lambda-list* '() :report-lambda-list lambda-list) + (setf around `(lambda (,start ,end transform) + (declare (ignore ,@ignore) + (function transform)) + (flet ((call-transform () + (funcall transform))) + ,@forms)))))) + ((:error-report behavior) + (funcall error-report behavior))))) (values transform around (funcall when) (funcall error-report)))) (defun expand-transforms (transforms) diff -Nru cl-esrap-20170630/src/package.lisp cl-esrap-20180430/src/package.lisp --- cl-esrap-20170630/src/package.lisp 2017-05-26 09:30:07.000000000 +0000 +++ cl-esrap-20180430/src/package.lisp 2018-04-04 08:41:47.000000000 +0000 @@ -1,5 +1,5 @@ ;;;; Copyright (c) 2007-2013 Nikodemus Siivola -;;;; Copyright (c) 2012-2016 Jan Moringen +;;;; Copyright (c) 2012-2017 Jan Moringen ;;;; ;;;; Permission is hereby granted, free of charge, to any person ;;;; obtaining a copy of this software and associated documentation files @@ -18,45 +18,68 @@ ;;;; SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. (cl:defpackage #:esrap - (:use #:cl #:alexandria) - #+sbcl - (:lock t) + (:use + #:cl + #:alexandria) + + #+sbcl (:lock t) + + ;; Conditions (:export - #:&bounds + #:invalid-expression-error + #:invalid-expression-error-expression - #:! #:? #:+ #:* #:& #:~ - #:character-ranges + #:undefined-rule-symbol - #:*on-left-recursion* + #:undefined-rule-error - #:add-rule - #:call-transform - #:change-rule - #:defrule - #:describe-grammar - #:describe-terminal #:esrap-error #:esrap-error-position #:esrap-error-text + #:esrap-parse-error #:esrap-parse-error-result #:esrap-parse-error-context - #:expression-start-terminals - #:find-rule - #:invalid-expression-error - #:invalid-expression-error-expression + #:left-recursion #:left-recursion-nonterminal - #:left-recursion-path - #:parse - #:remove-rule + #:left-recursion-path) + + ;; Parsing + (:export + #:*on-left-recursion* + + #:parse) + + ;; Expressions + (:export + #:! #:? #:+ #:* #:& #:~ + #:character-ranges) + + ;; Introspection + (:export + + #:expression-start-terminals + #:rule #:rule-dependencies #:rule-expression #:rule-symbol - #:text - #:trace-rule - #:untrace-rule - #:undefined-rule-error - #:undefined-rule-symbol - )) + + #:find-rule + #:add-rule #:remove-rule + #:change-rule + + #:trace-rule #:untrace-rule + + #:describe-grammar + #:describe-terminal) + + ;; Macros + (:export + #:defrule + + #:&bounds + + #:call-transform + #:text)) diff -Nru cl-esrap-20170630/src/results.lisp cl-esrap-20180430/src/results.lisp --- cl-esrap-20170630/src/results.lisp 2017-05-26 09:30:07.000000000 +0000 +++ cl-esrap-20180430/src/results.lisp 2018-04-04 08:41:47.000000000 +0000 @@ -1,5 +1,5 @@ ;;;; Copyright (c) 2007-2013 Nikodemus Siivola -;;;; Copyright (c) 2012-2017 Jan Moringen +;;;; Copyright (c) 2012-2018 Jan Moringen ;;;; ;;;; Permission is hereby granted, free of charge, to any person ;;;; obtaining a copy of this software and associated documentation files @@ -41,7 +41,7 @@ ;; * a (possibly empty) list thereof ;; * a string describing the failure ;; * a condition instance describing the failure - (detail nil :type (or result list string condition) :read-only t)) + (detail nil :type (or structure-object #|result|# list string condition) :read-only t)) ;; The following function is only called from slow paths. (declaim (ftype (function (result) (values input-position &optional)) diff -Nru cl-esrap-20170630/test/examples.lisp cl-esrap-20180430/test/examples.lisp --- cl-esrap-20170630/test/examples.lisp 2017-05-26 09:30:07.000000000 +0000 +++ cl-esrap-20180430/test/examples.lisp 2018-04-04 08:41:47.000000000 +0000 @@ -1,5 +1,5 @@ ;;;; Copyright (c) 2007-2013 Nikodemus Siivola -;;;; Copyright (c) 2012-2016 Jan Moringen +;;;; Copyright (c) 2012-2017 Jan Moringen ;;;; ;;;; Permission is hereby granted, free of charge, to any person ;;;; obtaining a copy of this software and associated documentation files @@ -24,19 +24,23 @@ (test-both-modes example-left-recursion.left-associative "Left associate grammar from example-left-recursion.lisp." ;; This grammar should work without left recursion. - (let ((*on-left-recursion* :error)) - (is (equal '(+ (* 1 2) (+ (* 3 4) 5)) + (is (equal '(+ (* 1 2) + (+ (* 3 4) + 5)) + (let ((*on-left-recursion* :error)) (parse 'left-recursive-grammars:la-expr "1*2+3*4+5"))))) (test-both-modes example-left-recursion.right-associative "Right associate grammar from example-left-recursion.lisp." - ;; This grammar combination of grammar and input would require left + ;; This combination of grammar and input would require left ;; recursion. - (let ((*on-left-recursion* :error)) - (signals left-recursion + (signals left-recursion + (let ((*on-left-recursion* :error)) (parse 'left-recursive-grammars:ra-expr "1*2+3*4+5"))) - (is (equal '(+ (+ (* 1 2) (* 3 4)) 5) + (is (equal `(+ (+ (* 1 2) + (* 3 4)) + 5) (parse 'left-recursive-grammars:ra-expr "1*2+3*4+5")))) (test-both-modes example-left-recursion.warth.smoke diff -Nru cl-esrap-20170630/test/expressions.lisp cl-esrap-20180430/test/expressions.lisp --- cl-esrap-20170630/test/expressions.lisp 1970-01-01 00:00:00.000000000 +0000 +++ cl-esrap-20180430/test/expressions.lisp 2018-04-04 08:41:47.000000000 +0000 @@ -0,0 +1,82 @@ +;;;; Copyright (c) 2017 Jan Moringen +;;;; +;;;; Permission is hereby granted, free of charge, to any person +;;;; obtaining a copy of this software and associated documentation files +;;;; (the "Software"), to deal in the Software without restriction, +;;;; including without limitation the rights to use, copy, modify, merge, +;;;; publish, distribute, sublicense, and/or sell copies of the Software, +;;;; and to permit persons to whom the Software is furnished to do so, +;;;; subject to the following conditions: +;;;; +;;;; THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +;;;; EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +;;;; MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +;;;; IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +;;;; CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +;;;; TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +;;;; SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +(cl:in-package #:esrap-tests) + +(in-suite esrap) + +(test %direct-expression-dependencies.smoke + "Smoke test for the %EXPRESSION-DEPENDENCIES function." + + (mapc (destructuring-lambda ((expression expected-dependencies)) + (let ((result (%expression-direct-dependencies expression))) + (is (equal result (remove-duplicates result))) + (is (set-equal expected-dependencies result)))) + '((character ()) + ((character-ranges #\a #\z) ()) + ((string 5) ()) + ((and #\a #\b) ()) + ((or #\a #\b) ()) + ((not #\a) ()) + ((* #\a) ()) + ((+ #\a) ()) + ((? #\a) ()) + ((& #\a) ()) + ((! #\a) ()) + ((< 1 #\a) ()) + ((> 1 #\a) ()) + (#\c ()) + ("foo" ()) + ((~ "foo") ()) + + (foo (foo)) + ((and foo foo) (foo)) + ((and foo bar) (foo bar)) + ((consp foo) (foo)) + + ((foo #\a) ()) + (#'foo ())))) + +(defrule expression-dependencies.1 + (and #\c (? expression-dependencies.undefined) + expression-dependencies.1 + expression-dependencies.2)) + +(defrule expression-dependencies.2 + expression-dependencies.3) + +(defrule expression-dependencies.3 + #\d) + +(test %expression-dependencies.smoke + "Smoke test for the %EXPRESSION-DEPENDENCIES function." + + (mapc (destructuring-lambda ((expression expected-dependencies)) + (let ((result (%expression-dependencies expression))) + (is (equal result (remove-duplicates result))) + (is (set-equal expected-dependencies result)))) + '((foo (foo)) + ((and foo foo) (foo)) + ((and foo bar) (foo bar)) + (expression-dependencies.1 (expression-dependencies.undefined + expression-dependencies.3 + expression-dependencies.2 + expression-dependencies.1)) + (expression-dependencies.2 (expression-dependencies.3 + expression-dependencies.2)) + (expression-dependencies.3 (expression-dependencies.3))))) diff -Nru cl-esrap-20170630/test/package.lisp cl-esrap-20180430/test/package.lisp --- cl-esrap-20170630/test/package.lisp 2017-05-26 09:30:07.000000000 +0000 +++ cl-esrap-20180430/test/package.lisp 2018-04-04 08:41:47.000000000 +0000 @@ -1,5 +1,5 @@ ;;;; Copyright (c) 2007-2013 Nikodemus Siivola -;;;; Copyright (c) 2012-2016 Jan Moringen +;;;; Copyright (c) 2012-2017 Jan Moringen ;;;; ;;;; Permission is hereby granted, free of charge, to any person ;;;; obtaining a copy of this software and associated documentation files @@ -18,8 +18,18 @@ ;;;; SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. (cl:defpackage #:esrap-tests - (:use #:alexandria #:cl #:esrap #:fiveam) + (:use + #:alexandria + #:cl + #:esrap + #:fiveam) + (:shadowing-import-from #:esrap #:!) + + (:import-from #:esrap + #:%expression-direct-dependencies + #:%expression-dependencies) + (:export #:run-tests)) (cl:in-package #:esrap-tests) diff -Nru cl-esrap-20170630/test/tests.lisp cl-esrap-20180430/test/tests.lisp --- cl-esrap-20170630/test/tests.lisp 2017-05-26 09:30:07.000000000 +0000 +++ cl-esrap-20180430/test/tests.lisp 2018-04-04 08:41:47.000000000 +0000 @@ -1,5 +1,5 @@ ;;;; Copyright (c) 2007-2013 Nikodemus Siivola -;;;; Copyright (c) 2012-2017 Jan Moringen +;;;; Copyright (c) 2012-2018 Jan Moringen ;;;; ;;;; Permission is hereby granted, free of charge, to any person ;;;; obtaining a copy of this software and associated documentation files @@ -928,11 +928,13 @@ `(is (string= ,expected (describe-it ,terminal))))) (test-case 'character "any character") (test-case '(string 5) "a string of length 5") - (test-case #\a (format nil "the character a (~A)" (char-name #\a))) + (test-case #\a (format nil "the character a~@[ (~A)~]" + (char-name #\a))) (test-case #\Space "the character Space") - (test-case '(~ #\a) (format nil "the character a (~A), disregarding case" + (test-case '(~ #\a) (format nil "the character a~@[ (~A)~], disregarding case" (char-name #\a))) - (test-case "f" (format nil "the character f (~A)" (char-name #\f))) + (test-case "f" (format nil "the character f~@[ (~A)~]" + (char-name #\f))) (test-case "foo" "the string \"foo\"") (test-case '(~ "foo") "the string \"foo\", disregarding case") (test-case '(character-ranges #\a) @@ -955,16 +957,16 @@ or the string \"cc\" satisfying DIGIT-CHAR-P") (test-case '(not (#\a #\b)) - (format nil "anything but the character a (~A) - and the character b (~A)" + (format nil "anything but the character a~@[ (~A)~] + and the character b~@[ (~A)~]" (char-name #\a) (char-name #\b))) (test-case '(not (character)) "") (test-case '(! (#\a #\b)) - (format nil "anything but the character a (~A) - and the character b (~A)" + (format nil "anything but the character a~@[ (~A)~] + and the character b~@[ (~A)~]" (char-name #\a) (char-name #\b))) (test-case '(! ((keyword? (#\_ (alpha-char-p (character)))))) - (format nil "anything but the character _ (~A) + (format nil "anything but the character _~@[ (~A)~] or any character satisfying ALPHA-CHAR-P satisfying ~A" (char-name #\_) 'keyword?))))) diff -Nru cl-esrap-20170630/test/util.lisp cl-esrap-20180430/test/util.lisp --- cl-esrap-20170630/test/util.lisp 2017-05-26 09:30:07.000000000 +0000 +++ cl-esrap-20180430/test/util.lisp 2018-04-04 08:41:47.000000000 +0000 @@ -1,5 +1,5 @@ ;;;; Copyright (c) 2007-2013 Nikodemus Siivola -;;;; Copyright (c) 2012-2016 Jan Moringen +;;;; Copyright (c) 2012-2017 Jan Moringen ;;;; ;;;; Permission is hereby granted, free of charge, to any person ;;;; obtaining a copy of this software and associated documentation files @@ -19,6 +19,12 @@ (cl:in-package #:esrap-tests) +(defmacro destructuring-lambda (lambda-list &body body) + (with-gensyms (args) + `(lambda (&rest ,args) + (destructuring-bind ,lambda-list ,args + ,@body)))) + (defmacro with-silent-compilation-unit (() &body body) `(let ((*error-output* (make-broadcast-stream))) (with-compilation-unit (:override t) diff -Nru cl-esrap-20170630/TODO.org cl-esrap-20180430/TODO.org --- cl-esrap-20170630/TODO.org 2017-05-26 09:30:07.000000000 +0000 +++ cl-esrap-20180430/TODO.org 2018-04-04 08:41:47.000000000 +0000 @@ -111,7 +111,9 @@ Structures and classes have a mixture of documentation strings and documentation comments. Which do we want? After deciding, make this consistent. +** TODO Write tests for removing rules ** STARTED Reference example files from manual +** DONE Write tests for ~%expression-[direct-]dependencies~ ** DONE Better error reports For parse errors, in particular "incomplete parse" errors, provide a better description of where the parse actually failed, which rule @@ -120,3 +122,7 @@ ** DONE Remove =concat= * Bugs ** NEW Tracing does not work for interpreted rules +** NEW Recursive rules cannot be removed +** DONE ~%expression-direct-dependencies~ returns duplicates + +#+SEQ_TODO: NEW TODO STARTED | CANCELED DONE diff -Nru cl-esrap-20170630/.travis.yml cl-esrap-20180430/.travis.yml --- cl-esrap-20170630/.travis.yml 2017-05-26 09:30:07.000000000 +0000 +++ cl-esrap-20180430/.travis.yml 2018-04-04 08:41:47.000000000 +0000 @@ -6,18 +6,18 @@ SBCL_OPTIONS="--noinform --no-userinit" install: - - curl -L sbcl.tar.bz2 "${SBCL_DOWNLOAD_URL}" | tar -xj + - curl -L "${SBCL_DOWNLOAD_URL}" | tar -xj - ( cd sbcl-* && INSTALL_ROOT="${PREFIX}" sh install.sh ) - curl -o cl "${CL_LAUNCH_DOWNLOAD_URL}" - chmod +x cl - curl -o quicklisp.lisp "${QUICKLISP_DOWNLOAD_URL}" - - ./cl -L quicklisp.lisp '(quicklisp-quickstart:install :path "quicklisp/")' + - ./cl -L quicklisp.lisp '(quicklisp-quickstart:install)' script: - ./cl -S '(:source-registry (:directory "'$(pwd)'") :ignore-inherited-configuration)' - -e '(load "quicklisp/setup.lisp")' - -e '(ql:quickload :esrap/tests)' + -Q + -s esrap/tests '(or (esrap-tests:run-tests) (uiop:quit -1))'