improve pkg

This commit is contained in:
Scott Richmond 2024-05-14 13:46:13 -04:00
parent 67cd9d479b
commit 3225ea2472

View File

@ -846,10 +846,15 @@
(def key (capture kw parser))
(def value (capture simple parser))
(array/push data {:type :pair :data [key value] :token origin}))
:word (array/push (capture word-only parser))
(panic parser "expected dict term"))
:word (do
(def value (word-only parser))
(def key (keyword (value :data)))
(def kw-ast {:type :keyword :data key :token origin})
(array/push data {:type :pair :data [key value] :token origin}))
(panic parser "expected pkg term"))
(terminator parser))
{:type :pkg :data data :token origin :name name})
(advance parser)
@{:type :pkg :data data :token origin :name name})
([err] err)))
(defn- ns [parser]
@ -1086,14 +1091,15 @@
(do
#(comment
(def source `
"foo {bar} baz"
pkg Foo {:bar nil}
`)
(def scanned (s/scan source))
(print "\n***NEW PARSE***\n")
(def a-parser (new-parser scanned))
(def parsed (script a-parser))
(def parsed (toplevel a-parser))
# (print (pp-ast parsed))
(pp scanned)
(pp parsed)
)