This commit is contained in:
Scott Richmond 2022-08-04 18:45:56 -04:00
parent 9684c2f4c5
commit cd0cad8ac3

View File

@ -440,8 +440,6 @@
(parse-expr parser))] (parse-expr parser))]
(recur parsed exprs (::ast parsed))))))) (recur parsed exprs (::ast parsed)))))))
(defn- parse-synthetic [parser] (defn- parse-synthetic [parser]
(loop [parser parser (loop [parser parser
terms []] terms []]
@ -489,8 +487,7 @@
:token (current origin) :token (current origin)
:into {::ast/type ::ast/placeholder :token (current origin)}}) :into {::ast/type ::ast/placeholder :token (current origin)}})
(panic origin "Splat patterns may only splat into words or placeholders.") (panic origin "Splat patterns may only splat into words or placeholders."))))
)))
(defn- parse-list-pattern [origin] (defn- parse-list-pattern [origin]
(loop [parser (accept-many #{::token/newline ::token/comma} (advance origin)) (loop [parser (accept-many #{::token/newline ::token/comma} (advance origin))
@ -637,7 +634,6 @@
(panic parser "Struct patterns may only include single words or keyword+pattern pairs." #{::token/rbrace}))))) (panic parser "Struct patterns may only include single words or keyword+pattern pairs." #{::token/rbrace})))))
(defn- parse-tuple-pattern [origin] (defn- parse-tuple-pattern [origin]
(loop [parser (accept-many #{::token/newline ::token/comma} (advance origin)) (loop [parser (accept-many #{::token/newline ::token/comma} (advance origin))
members [] members []
@ -654,7 +650,6 @@
:members ms}) :members ms})
(panic parser "A splat my only appear once in a tuple pattern, at the end of the pattern."))) (panic parser "A splat my only appear once in a tuple pattern, at the end of the pattern.")))
(::token/comma ::token/newline) (::token/comma ::token/newline)
(recur (recur
(accept-many #{::token/comma ::token/newline} parser) (accept-many #{::token/comma ::token/newline} parser)
@ -1067,7 +1062,6 @@
(panic dt-ast (str "Undexpected " (get-in dt-ast [::token :lexeme]) "after datatype declaration.")))) (panic dt-ast (str "Undexpected " (get-in dt-ast [::token :lexeme]) "after datatype declaration."))))
(panic dt "Expected datatype name after data reserved word.")))) (panic dt "Expected datatype name after data reserved word."))))
(defn- parse-toplevel [parser] (defn- parse-toplevel [parser]
(case (token-type parser) (case (token-type parser)
::token/ns (parse-ns parser) ::token/ns (parse-ns parser)