This commit is contained in:
Scott Richmond 2024-07-19 16:09:31 -04:00
parent 4a069278b8
commit d4adc1d912

View File

@ -1148,11 +1148,12 @@
(def origin (current parser)) (def origin (current parser))
(def lines @[]) (def lines @[])
(while (not (check parser :eof)) (while (not (check parser :eof))
(print "starting script loop with " (pp-tok origin)) # (print "starting script loop with " (pp-tok origin))
(accept-many parser :newline :semicolon) (accept-many parser :newline :semicolon)
(when (= :break ((current parser) :type)) (when (= :break ((current parser) :type))
(break (advance parser))) (break (advance parser)))
(array/push lines (capture toplevel parser)) (def term (capture toplevel parser))
(array/push lines term)
(capture terminator parser)) (capture terminator parser))
{:type :script :data lines :token origin}) {:type :script :data lines :token origin})
@ -1162,10 +1163,15 @@
(set (parser :ast) ast) (set (parser :ast) ast)
parser) parser)
(do # (do
# (comment (comment
(def source ` (def source `
(foo bar) {
foo bar
quux frobulate
baz
12 23 42
}
`) `)
(def scanned (s/scan source)) (def scanned (s/scan source))
# (print "\n***NEW PARSE***\n") # (print "\n***NEW PARSE***\n")