Fix ns name bug
This commit is contained in:
parent
df59b84321
commit
9eecce77bc
|
@ -318,8 +318,8 @@
|
||||||
|
|
||||||
(panic parser "Struct entries must be single words or keyword+expression pairs" #{::token/rbrace})))))
|
(panic parser "Struct entries must be single words or keyword+expression pairs" #{::token/rbrace})))))
|
||||||
|
|
||||||
(defn- parse-ns [parser]
|
(defn- parse-ns [ns-root]
|
||||||
(let [name (expect* #{::token/word} "Expected ns name" (advance parser))
|
(let [name (expect* #{::token/word} "Expected ns name" (advance ns-root))
|
||||||
origin (expect* #{::token/lbrace} "Expected { after ns name" (:parser name))]
|
origin (expect* #{::token/lbrace} "Expected { after ns name" (:parser name))]
|
||||||
(cond
|
(cond
|
||||||
(not (:success name)) (panic parser "Expected ns name" #{::token/newline})
|
(not (:success name)) (panic parser "Expected ns name" #{::token/newline})
|
||||||
|
@ -327,7 +327,7 @@
|
||||||
(not (:success origin)) (panic (:parser name) "Expected { after ns name")
|
(not (:success origin)) (panic (:parser name) "Expected { after ns name")
|
||||||
|
|
||||||
:else
|
:else
|
||||||
(loop [parser (accept-many #{::token/newline ::token/comma} (advance (:parser name)))
|
(loop [parser (accept-many #{::token/newline ::token/comma} (:parser origin))
|
||||||
members {}
|
members {}
|
||||||
current_member nil]
|
current_member nil]
|
||||||
(let [curr (current parser)]
|
(let [curr (current parser)]
|
||||||
|
@ -335,7 +335,7 @@
|
||||||
::token/rbrace (let [ms (add-member members current_member)]
|
::token/rbrace (let [ms (add-member members current_member)]
|
||||||
(assoc (advance parser) ::ast
|
(assoc (advance parser) ::ast
|
||||||
{::ast/type ::ast/ns
|
{::ast/type ::ast/ns
|
||||||
:name (::ast name)
|
:name (get-in (parse-word (advance ns-root)) [::ast :word])
|
||||||
:members ms}))
|
:members ms}))
|
||||||
|
|
||||||
(::token/comma ::token/newline)
|
(::token/comma ::token/newline)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user