Function: peg-parse
peg-parse is a macro defined in peg.el.gz.
Signature
(peg-parse &rest PEXS)
Documentation
Match PEXS at point.
PEXS is a sequence of PEG expressions, implicitly combined with and.
Returns STACK if the match succeed and signals an error on failure,
moving point along the way.
Source Code
;; Defined in /usr/src/emacs/lisp/progmodes/peg.el.gz
;; Sometimes (with-peg-rules ... (peg-run (peg ...))) is too
;; long-winded for the task at hand, so `peg-parse' comes in handy.
(defmacro peg-parse (&rest pexs)
"Match PEXS at point.
PEXS is a sequence of PEG expressions, implicitly combined with `and'.
Returns STACK if the match succeed and signals an error on failure,
moving point along the way."
(if (and (consp (car pexs))
(symbolp (caar pexs))
(not (ignore-errors
(not (eq 'call (car (peg-normalize (car pexs))))))))
;; The first of `pexs' has not been defined as a rule, so assume
;; that none of them have been and they should be fed to
;; `with-peg-rules'
`(with-peg-rules ,pexs (peg-run (peg ,(caar pexs)) #'peg-signal-failure))
`(peg-run (peg ,@pexs) #'peg-signal-failure)))