Unroll copypasta.
This commit is contained in:
parent
4e7590226b
commit
c3c5c390e5
|
@ -522,7 +522,7 @@
|
||||||
:token (current origin)
|
:token (current origin)
|
||||||
:length (count ms)
|
:length (count ms)
|
||||||
:members ms})
|
:members ms})
|
||||||
(panic parser "A splat my only appear once in a list pattern, at the end of the pattern.")))
|
(panic parser "A splat my only appear once in a pattern, at the end of a pattern.")))
|
||||||
|
|
||||||
(::token/comma ::token/newline)
|
(::token/comma ::token/newline)
|
||||||
(recur
|
(recur
|
||||||
|
@ -548,15 +548,11 @@
|
||||||
current_member nil]
|
current_member nil]
|
||||||
(let [curr (current parser)]
|
(let [curr (current parser)]
|
||||||
(case (token-type parser)
|
(case (token-type parser)
|
||||||
::token/rbrace
|
::token/rbrace (let [ms (add-member members current_member)]
|
||||||
(let [ms (add-member members current_member)]
|
(assoc (advance parser) ::ast
|
||||||
(if (not-any? #(= (::ast/type %) ::ast/splat) (drop-last ms))
|
{::ast/type ::ast/dict
|
||||||
(assoc (advance parser) ::ast
|
:token (current origin)
|
||||||
{::ast/type ::ast/tuple
|
:members ms}))
|
||||||
:token (current origin)
|
|
||||||
:length (count ms)
|
|
||||||
:members ms})
|
|
||||||
(panic parser "A splat my only appear once in a dict pattern, at the end of the pattern.")))
|
|
||||||
|
|
||||||
(::token/comma ::token/newline)
|
(::token/comma ::token/newline)
|
||||||
(recur
|
(recur
|
||||||
|
@ -569,10 +565,6 @@
|
||||||
::token/eof
|
::token/eof
|
||||||
(panic (assoc origin ::errors (::errors parser)) "Unterminated dict pattern" ::token/eof)
|
(panic (assoc origin ::errors (::errors parser)) "Unterminated dict pattern" ::token/eof)
|
||||||
|
|
||||||
::token/splat
|
|
||||||
(let [splatted (parse-splat-pattern parser)]
|
|
||||||
(recur splatted members (::ast splatted)))
|
|
||||||
|
|
||||||
::token/word
|
::token/word
|
||||||
(if (not current_member)
|
(if (not current_member)
|
||||||
(let [parsed (parse-word parser) word (get-in parsed [::ast :word])]
|
(let [parsed (parse-word parser) word (get-in parsed [::ast :word])]
|
||||||
|
@ -593,15 +585,11 @@
|
||||||
current_member nil]
|
current_member nil]
|
||||||
(let [curr (current parser)]
|
(let [curr (current parser)]
|
||||||
(case (token-type parser)
|
(case (token-type parser)
|
||||||
::token/rbrace
|
::token/rbrace (let [ms (add-member members current_member)]
|
||||||
(let [ms (add-member members current_member)]
|
(assoc (advance parser) ::ast
|
||||||
(if (not-any? #(= (::ast/type %) ::ast/splat) (drop-last ms))
|
{::ast/type ::ast/struct
|
||||||
(assoc (advance parser) ::ast
|
:token (current origin)
|
||||||
{::ast/type ::ast/tuple
|
:members ms}))
|
||||||
:token (current origin)
|
|
||||||
:length (count ms)
|
|
||||||
:members ms})
|
|
||||||
(panic parser "A splat my only appear once in a struct pattern, at the end of the pattern.")))
|
|
||||||
|
|
||||||
(::token/comma ::token/newline)
|
(::token/comma ::token/newline)
|
||||||
(recur
|
(recur
|
||||||
|
@ -614,10 +602,6 @@
|
||||||
::token/eof
|
::token/eof
|
||||||
(panic (assoc origin ::errors (::errors parser)) "Unterminated struct pattern" ::token/eof)
|
(panic (assoc origin ::errors (::errors parser)) "Unterminated struct pattern" ::token/eof)
|
||||||
|
|
||||||
::token/splat
|
|
||||||
(let [splatted (parse-splat-pattern parser)]
|
|
||||||
(recur splatted members (::ast splatted)))
|
|
||||||
|
|
||||||
::token/word
|
::token/word
|
||||||
(if (not current_member)
|
(if (not current_member)
|
||||||
(let [parsed (parse-word parser) word (get-in parsed [::ast :word])]
|
(let [parsed (parse-word parser) word (get-in parsed [::ast :word])]
|
||||||
|
@ -641,13 +625,11 @@
|
||||||
(case (token-type parser)
|
(case (token-type parser)
|
||||||
::token/rparen
|
::token/rparen
|
||||||
(let [ms (add-member members current_member)]
|
(let [ms (add-member members current_member)]
|
||||||
(if (not-any? #(= (::ast/type %) ::ast/splat) (drop-last ms))
|
|
||||||
(assoc (advance parser) ::ast
|
(assoc (advance parser) ::ast
|
||||||
{::ast/type ::ast/tuple
|
{::ast/type ::ast/tuple
|
||||||
:token (current origin)
|
:token (current origin)
|
||||||
:length (count ms)
|
:length (count ms)
|
||||||
:members ms})
|
:members ms}))
|
||||||
(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)
|
||||||
|
@ -661,10 +643,6 @@
|
||||||
::token/eof
|
::token/eof
|
||||||
(panic (assoc origin ::errors (::errors parser)) "Unterminated tuple" ::token/eof)
|
(panic (assoc origin ::errors (::errors parser)) "Unterminated tuple" ::token/eof)
|
||||||
|
|
||||||
::token/splat
|
|
||||||
(let [splatted (parse-splat-pattern parser)]
|
|
||||||
(recur splatted members (::ast splatted)))
|
|
||||||
|
|
||||||
(let [parsed (parse-pattern parser)]
|
(let [parsed (parse-pattern parser)]
|
||||||
(recur parsed members (::ast parsed)))))))
|
(recur parsed members (::ast parsed)))))))
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user