Fix: Copy macro peg-parse-string from peg-tests.el

Unfortunately, the macro was moved from peg.el to peg-tests.el in
later versions of peg, so we copy it for our use here.

Fixes #75.  Thanks to Karl Voit (@novoid) and @karlicoss for
reporting.

Released as 0.4.6.
This commit is contained in:
Adam Porter 2020-07-12 21:54:59 -05:00
parent 5a031bf5c1
commit 0080055690
3 changed files with 93 additions and 57 deletions

View file

@ -398,6 +398,11 @@ Expands into a call to ~org-ql-select~ with the same arguments. For convenience
/Note:/ Breaking changes may be made before version 1.0, but in the event of major changes, attempts at backward compatibility will be made with obsolescence declarations, translation of arguments, etc. Users who need stability guarantees before 1.0 may choose to use tagged stable releases. /Note:/ Breaking changes may be made before version 1.0, but in the event of major changes, attempts at backward compatibility will be made with obsolescence declarations, translation of arguments, etc. Users who need stability guarantees before 1.0 may choose to use tagged stable releases.
** 0.4.6
*Fixed*
+ Compatibility with newer versions of the =peg= library, which removed a macro used by this package. (Fixes [[https://github.com/alphapapa/org-ql/issues/75][#75]]. Thanks to [[https://github.com/novoid][Karl Voit]] and [[https://github.com/karlicoss][@karlicoss]] for reporting.)
** 0.4.5 ** 0.4.5
*Fixed* *Fixed*

View file

@ -2,7 +2,7 @@
;; Author: Adam Porter <adam@alphapapa.net> ;; Author: Adam Porter <adam@alphapapa.net>
;; Url: https://github.com/alphapapa/org-ql ;; Url: https://github.com/alphapapa/org-ql
;; Version: 0.4.5 ;; Version: 0.4.6
;; Package-Requires: ((emacs "26.1") (dash "2.13") (dash-functional "1.2.0") (f "0.17.2") (org "9.0") (org-super-agenda "1.2-pre") (ov "1.0.6") (peg "0.6") (s "1.12.0") (ts "0.2-pre")) ;; Package-Requires: ((emacs "26.1") (dash "2.13") (dash-functional "1.2.0") (f "0.17.2") (org "9.0") (org-super-agenda "1.2-pre") (ov "1.0.6") (peg "0.6") (s "1.12.0") (ts "0.2-pre"))
;; Keywords: hypermedia, outlines, Org, agenda ;; Keywords: hypermedia, outlines, Org, agenda
@ -1529,6 +1529,21 @@ element should be a regexp string."
(defvar peg-errors nil) (defvar peg-errors nil)
(defvar peg-stack nil) (defvar peg-stack nil)
(defmacro org-ql--peg-parse-string (rules string &optional noerror)
"Parse STRING according to RULES.
If NOERROR is non-nil, push nil resp. t if the parse failed
resp. succeded instead of signaling an error."
;; Unfortunately, this macro was moved to peg-tests.el, so we copy it here.
`(with-temp-buffer
(insert ,string)
(goto-char (point-min))
,(if noerror
(let ((entry (make-symbol "entry"))
(start (caar rules)))
`(peg-parse (entry (or (and ,start `(-- t)) ""))
. ,rules))
`(peg-parse . ,rules))))
(cl-eval-when (compile load eval) (cl-eval-when (compile load eval)
;; This `eval-when' is necessary, otherwise the macro does not define ;; This `eval-when' is necessary, otherwise the macro does not define
;; the function correctly, apparently because `org-ql-predicates' ;; the function correctly, apparently because `org-ql-predicates'
@ -1555,7 +1570,7 @@ Builds the PEG expression using predicates defined in
"Return query parsed from plain query string INPUT. "Return query parsed from plain query string INPUT.
Multiple predicates are combined with BOOLEAN." Multiple predicates are combined with BOOLEAN."
(unless (s-blank-str? input) (unless (s-blank-str? input)
(let* ((query (peg-parse-string (let* ((query (org-ql--peg-parse-string
((query (+ term ((query (+ term
(opt (+ (syntax-class whitespace) (any))))) (opt (+ (syntax-class whitespace) (any)))))
(term (or (and negation (list positive-term) (term (or (and negation (list positive-term)

View file

@ -63,6 +63,7 @@ Functions / Macros
Changelog Changelog
* 0.4.6: 046.
* 0.4.5: 045. * 0.4.5: 045.
* 0.4.4: 044. * 0.4.4: 044.
* 0.4.3: 043. * 0.4.3: 043.
@ -708,6 +709,7 @@ releases.
* Menu: * Menu:
* 0.4.6: 046.
* 0.4.5: 045. * 0.4.5: 045.
* 0.4.4: 044. * 0.4.4: 044.
* 0.4.3: 043. * 0.4.3: 043.
@ -724,9 +726,22 @@ releases.
* 0.1: 01. * 0.1: 01.
 
File: README.info, Node: 045, Next: 044, Up: Changelog File: README.info, Node: 046, Next: 045, Up: Changelog
5.1 0.4.5 5.1 0.4.6
=========
*Fixed*
• Compatibility with newer versions of the peg library, which removed
a macro used by this package. (Fixes #75
(https://github.com/alphapapa/org-ql/issues/75). Thanks to Karl
Voit (https://github.com/novoid) and @karlicoss
(https://github.com/karlicoss) for reporting.)

File: README.info, Node: 045, Next: 044, Prev: 046, Up: Changelog
5.2 0.4.5
========= =========
*Fixed* *Fixed*
@ -738,7 +753,7 @@ File: README.info, Node: 045, Next: 044, Up: Changelog
 
File: README.info, Node: 044, Next: 043, Prev: 045, Up: Changelog File: README.info, Node: 044, Next: 043, Prev: 045, Up: Changelog
5.2 0.4.4 5.3 0.4.4
========= =========
*Fixed* *Fixed*
@ -750,7 +765,7 @@ File: README.info, Node: 044, Next: 043, Prev: 045, Up: Changelog
 
File: README.info, Node: 043, Next: 042, Prev: 044, Up: Changelog File: README.info, Node: 043, Next: 042, Prev: 044, Up: Changelog
5.3 0.4.3 5.4 0.4.3
========= =========
*Fixed* *Fixed*
@ -760,7 +775,7 @@ File: README.info, Node: 043, Next: 042, Prev: 044, Up: Changelog
 
File: README.info, Node: 042, Next: 041, Prev: 043, Up: Changelog File: README.info, Node: 042, Next: 041, Prev: 043, Up: Changelog
5.4 0.4.2 5.5 0.4.2
========= =========
*Fixed* *Fixed*
@ -769,7 +784,7 @@ File: README.info, Node: 042, Next: 041, Prev: 043, Up: Changelog
 
File: README.info, Node: 041, Next: 04, Prev: 042, Up: Changelog File: README.info, Node: 041, Next: 04, Prev: 042, Up: Changelog
5.5 0.4.1 5.6 0.4.1
========= =========
*Fixed* *Fixed*
@ -779,7 +794,7 @@ File: README.info, Node: 041, Next: 04, Prev: 042, Up: Changelog
 
File: README.info, Node: 04, Next: 032, Prev: 041, Up: Changelog File: README.info, Node: 04, Next: 032, Prev: 041, Up: Changelog
5.6 0.4 5.7 0.4
======= =======
_Note:_ The next release, 0.5, may include changes which will require _Note:_ The next release, 0.5, may include changes which will require
@ -860,7 +875,7 @@ as they will be pushed to the master branch when ready.
 
File: README.info, Node: 032, Next: 031, Prev: 04, Up: Changelog File: README.info, Node: 032, Next: 031, Prev: 04, Up: Changelog
5.7 0.3.2 5.8 0.3.2
========= =========
*Fixed* *Fixed*
@ -873,7 +888,7 @@ File: README.info, Node: 032, Next: 031, Prev: 04, Up: Changelog
 
File: README.info, Node: 031, Next: 03, Prev: 032, Up: Changelog File: README.info, Node: 031, Next: 03, Prev: 032, Up: Changelog
5.8 0.3.1 5.9 0.3.1
========= =========
*Fixed* *Fixed*
@ -883,8 +898,8 @@ File: README.info, Node: 031, Next: 03, Prev: 032, Up: Changelog
 
File: README.info, Node: 03, Next: 023, Prev: 031, Up: Changelog File: README.info, Node: 03, Next: 023, Prev: 031, Up: Changelog
5.9 0.3 5.10 0.3
======= ========
*Added* *Added*
• Alternative, non-sexp query syntax for commands org-ql-search and • Alternative, non-sexp query syntax for commands org-ql-search and
@ -948,7 +963,7 @@ File: README.info, Node: 03, Next: 023, Prev: 031, Up: Changelog
 
File: README.info, Node: 023, Next: 022, Prev: 03, Up: Changelog File: README.info, Node: 023, Next: 022, Prev: 03, Up: Changelog
5.10 0.2.3 5.11 0.2.3
========== ==========
*Fixed* *Fixed*
@ -958,7 +973,7 @@ File: README.info, Node: 023, Next: 022, Prev: 03, Up: Changelog
 
File: README.info, Node: 022, Next: 021, Prev: 023, Up: Changelog File: README.info, Node: 022, Next: 021, Prev: 023, Up: Changelog
5.11 0.2.2 5.12 0.2.2
========== ==========
*Fixed* *Fixed*
@ -969,7 +984,7 @@ File: README.info, Node: 022, Next: 021, Prev: 023, Up: Changelog
 
File: README.info, Node: 021, Next: 02, Prev: 022, Up: Changelog File: README.info, Node: 021, Next: 02, Prev: 022, Up: Changelog
5.12 0.2.1 5.13 0.2.1
========== ==========
*Fixed* *Fixed*
@ -979,7 +994,7 @@ File: README.info, Node: 021, Next: 02, Prev: 022, Up: Changelog
 
File: README.info, Node: 02, Next: 01, Prev: 021, Up: Changelog File: README.info, Node: 02, Next: 01, Prev: 021, Up: Changelog
5.13 0.2 5.14 0.2
======== ========
*Added* *Added*
@ -1062,7 +1077,7 @@ File: README.info, Node: 02, Next: 01, Prev: 021, Up: Changelog
 
File: README.info, Node: 01, Prev: 02, Up: Changelog File: README.info, Node: 01, Prev: 02, Up: Changelog
5.14 0.1 5.15 0.1
======== ========
First tagged release. First tagged release.
@ -1123,45 +1138,46 @@ GPLv3
 
Tag Table: Tag Table:
Node: Top225 Node: Top225
Node: Contents1477 Node: Contents1492
Node: Screenshots1651 Node: Screenshots1666
Node: Installation1769 Node: Installation1784
Node: Quelpa2407 Node: Quelpa2422
Node: Usage2850 Node: Usage2865
Node: Commands3199 Node: Commands3214
Node: org-ql-search3672 Node: org-ql-search3687
Node: helm-org-ql5320 Node: helm-org-ql5335
Node: org-ql-view5732 Node: org-ql-view5747
Node: org-ql-view-sidebar5930 Node: org-ql-view-sidebar5945
Node: org-ql-view-recent-items6286 Node: org-ql-view-recent-items6301
Node: org-ql-sparse-tree6770 Node: org-ql-sparse-tree6785
Node: Queries7570 Node: Queries7585
Node: Non-sexp query syntax8478 Node: Non-sexp query syntax8493
Node: General predicates10185 Node: General predicates10200
Node: Ancestor/descendant predicates14992 Node: Ancestor/descendant predicates15007
Node: Date/time predicates16120 Node: Date/time predicates16135
Node: Functions / Macros18775 Node: Functions / Macros18790
Node: Agenda-like views19008 Node: Agenda-like views19023
Node: Listing / acting-on results20413 Node: Listing / acting-on results20428
Node: Changelog25015 Node: Changelog25030
Node: 04525619 Node: 04625649
Node: 04425966 Node: 04526037
Node: 04326323 Node: 04426396
Node: 04226518 Node: 04326753
Node: 04126677 Node: 04226948
Node: 0426916 Node: 04127107
Node: 03230847 Node: 0427346
Node: 03131224 Node: 03231277
Node: 0331419 Node: 03131654
Node: 02334392 Node: 0331849
Node: 02234620 Node: 02334824
Node: 02134888 Node: 02235052
Node: 0235087 Node: 02135320
Node: 0139122 Node: 0235519
Node: Notes39223 Node: 0139554
Node: Comparison with Org Agenda searches39385 Node: Notes39655
Node: org-sidebar40256 Node: Comparison with Org Agenda searches39817
Node: License40535 Node: org-sidebar40688
Node: License40967
 
End Tag Table End Tag Table