Fix bug in script & block

This commit is contained in:
Scott Richmond 2022-02-14 18:13:56 -05:00
parent 05f55e6a84
commit dd47244b78

View File

@ -157,8 +157,12 @@
(::token/semicolon ::token/newline) (::token/semicolon ::token/newline)
(recur (advance parser) (add-member exprs current_expr) nil) (recur (advance parser) (add-member exprs current_expr) nil)
(if current_expr
(-> parser
(advance)
(assoc ::ast {::ast/type ::ast/poison :message "Expected end of expression"}))
(let [parsed (parse-expr parser)] (let [parsed (parse-expr parser)]
(recur parsed exprs (::ast parsed))) (recur parsed exprs (::ast parsed))))
))) )))
(defn- parse-script [parser] (defn- parse-script [parser]
@ -173,8 +177,12 @@
(::token/semicolon ::token/newline) (::token/semicolon ::token/newline)
(recur (advance parser) (add-member exprs current_expr) nil) (recur (advance parser) (add-member exprs current_expr) nil)
(if current_expr
(-> parser
(advance)
(assoc ::ast {::ast/type ::ast/poison :message "Expected end of expression"}))
(let [parsed (parse-expr parser)] (let [parsed (parse-expr parser)]
(recur parsed exprs (::ast parsed))) (recur parsed exprs (::ast parsed))))
))) )))
@ -239,7 +247,7 @@
)))) ))))
(def source ":foo (bar) (baz)") (def source ":foo; :baz (foo, bar)")
(def tokens (:tokens (scanner/scan source))) (def tokens (:tokens (scanner/scan source)))
@ -248,8 +256,7 @@
(pp/pprint p) (pp/pprint p)
(-> (parse-script p) (-> (parse-script p)
(::ast) (::ast))
(:exprs))
(comment " (comment "
Just leaving this note here for myself. I'm too tired to write more code, but I want not to lose momentum. So: Just leaving this note here for myself. I'm too tired to write more code, but I want not to lose momentum. So:
@ -285,6 +292,7 @@
* Compound `loop` and `gen` forms must have LHS's (tuple patterns) of the same length * Compound `loop` and `gen` forms must have LHS's (tuple patterns) of the same length
* Recur is in tail position in `loop`s * Recur is in tail position in `loop`s
* Tail call optimization for simple recursion * Tail call optimization for simple recursion
* Check arities for statically known functions
") ")