Fix off-by-paren loop tup bug
This commit is contained in:
parent
0b7687024f
commit
b62fa6d074
|
@ -624,7 +624,7 @@
|
||||||
(defn- parse-loop [parser]
|
(defn- parse-loop [parser]
|
||||||
(let [next (advance parser)]
|
(let [next (advance parser)]
|
||||||
(if (= ::token/lparen (token-type next))
|
(if (= ::token/lparen (token-type next))
|
||||||
(let [loop-tup (parse-tuple (advance next))
|
(let [loop-tup (parse-tuple next)
|
||||||
loop-header (expect* #{::token/with} "Expected with" loop-tup)]
|
loop-header (expect* #{::token/with} "Expected with" loop-tup)]
|
||||||
(if (:success loop-header)
|
(if (:success loop-header)
|
||||||
(let [clauses (:parser loop-header)]
|
(let [clauses (:parser loop-header)]
|
||||||
|
@ -647,7 +647,7 @@
|
||||||
(defn- parse-recur [parser]
|
(defn- parse-recur [parser]
|
||||||
(let [next (advance parser)]
|
(let [next (advance parser)]
|
||||||
(if (= ::token/lparen (token-type next))
|
(if (= ::token/lparen (token-type next))
|
||||||
(let [tuple (parse-tuple (advance next))]
|
(let [tuple (parse-tuple next)]
|
||||||
(assoc tuple ::ast {::ast/type ::ast/recur
|
(assoc tuple ::ast {::ast/type ::ast/recur
|
||||||
:tuple (::ast tuple)})
|
:tuple (::ast tuple)})
|
||||||
)
|
)
|
||||||
|
@ -656,7 +656,6 @@
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
(defn- parse-cond-clause [parser]
|
(defn- parse-cond-clause [parser]
|
||||||
(let [expr (if
|
(let [expr (if
|
||||||
(contains? #{::token/else ::token/placeholder} (token-type parser))
|
(contains? #{::token/else ::token/placeholder} (token-type parser))
|
||||||
|
@ -878,7 +877,7 @@
|
||||||
(parser)
|
(parser)
|
||||||
(parse-script)))
|
(parse-script)))
|
||||||
|
|
||||||
(comment
|
(do
|
||||||
(def pp pp/pprint)
|
(def pp pp/pprint)
|
||||||
(def source "loop (10) with {
|
(def source "loop (10) with {
|
||||||
(0) -> print (:boom)
|
(0) -> print (:boom)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user