improve pkg
This commit is contained in:
parent
67cd9d479b
commit
3225ea2472
|
@ -846,10 +846,15 @@
|
||||||
(def key (capture kw parser))
|
(def key (capture kw parser))
|
||||||
(def value (capture simple parser))
|
(def value (capture simple parser))
|
||||||
(array/push data {:type :pair :data [key value] :token origin}))
|
(array/push data {:type :pair :data [key value] :token origin}))
|
||||||
:word (array/push (capture word-only parser))
|
:word (do
|
||||||
(panic parser "expected dict term"))
|
(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))
|
(terminator parser))
|
||||||
{:type :pkg :data data :token origin :name name})
|
(advance parser)
|
||||||
|
@{:type :pkg :data data :token origin :name name})
|
||||||
([err] err)))
|
([err] err)))
|
||||||
|
|
||||||
(defn- ns [parser]
|
(defn- ns [parser]
|
||||||
|
@ -1086,14 +1091,15 @@
|
||||||
(do
|
(do
|
||||||
#(comment
|
#(comment
|
||||||
(def source `
|
(def source `
|
||||||
"foo {bar} baz"
|
pkg Foo {:bar nil}
|
||||||
`)
|
`)
|
||||||
(def scanned (s/scan source))
|
(def scanned (s/scan source))
|
||||||
(print "\n***NEW PARSE***\n")
|
(print "\n***NEW PARSE***\n")
|
||||||
(def a-parser (new-parser scanned))
|
(def a-parser (new-parser scanned))
|
||||||
(def parsed (script a-parser))
|
(def parsed (toplevel a-parser))
|
||||||
|
|
||||||
# (print (pp-ast parsed))
|
# (print (pp-ast parsed))
|
||||||
|
(pp scanned)
|
||||||
(pp parsed)
|
(pp parsed)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user