From 93a43aedea5324f2f61ebc270242c824bd4261ab Mon Sep 17 00:00:00 2001 From: fdeitylink <11952260+fdeitylink@users.noreply.github.com> Date: Fri, 27 May 2022 11:28:38 -0400 Subject: [PATCH] add sequential syntax for sequential sequences --- src/meander/epsilon.clj | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/meander/epsilon.clj b/src/meander/epsilon.clj index 0a0dfd32..9a95351f 100644 --- a/src/meander/epsilon.clj +++ b/src/meander/epsilon.clj @@ -386,6 +386,24 @@ ;; else &form)) +(defsyntax sequential + "Pattern matching operator which matches the `seq` of anything that + is `sequential?` against + + (p1 ,,, pn) + + where the sequence `p1` through `pn` is equal to `patterns`." + [& patterns] + (case (::r.syntax/phase &env) + :meander/match + `(r.match.syntax/pred sequential? (r.match.syntax/apply seq ~patterns)) + + :meander/substitute + patterns + + ;; else + &form)) + (defsyntax scan "Pattern matching operator which matches the `seq` of `seqable?` forms of the shape