Skip to content

Commit

Permalink
Merge pull request #390 from metosin/parking-fixes
Browse files Browse the repository at this point in the history
Fix inconsistent `park-`ing in `alt(n)-parser`
  • Loading branch information
Pauli Jaakkola authored Mar 10, 2021
2 parents a9cade6 + 2c32b2c commit b4f4e0b
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/malli/impl/regex.cljc
Original file line number Diff line number Diff line change
Expand Up @@ -225,17 +225,17 @@
?krs))

(defn alt-parser [& rs]
(reduce (fn [acc r]
(reduce (fn [r r*]
(fn [driver regs pos coll k]
(park-validator! driver acc regs pos coll k) ; remember fallback
(park-validator! driver r* regs pos coll k) ; remember fallback
(park-validator! driver r regs pos coll k)))
rs))

(defn altn-parser [kr & krs]
(reduce (fn [acc [tag r]]
(let [r (fmap-parser (fn [v] (miu/-tagged tag v)) r)]
(reduce (fn [r [tag r*]]
(let [r* (fmap-parser (fn [v] (miu/-tagged tag v)) r*)]
(fn [driver regs pos coll k]
(park-validator! driver acc regs pos coll k) ; remember fallback
(park-validator! driver r* regs pos coll k) ; remember fallback
(park-validator! driver r regs pos coll k))))
(let [[tag r] kr]
(fmap-parser (fn [v] (miu/-tagged tag v)) r))
Expand Down

0 comments on commit b4f4e0b

Please sign in to comment.