From a35da1498ed5f9e83ffdc44699dba47c4566c08a Mon Sep 17 00:00:00 2001 From: Scott Richmond Date: Tue, 15 Feb 2022 18:27:22 -0500 Subject: [PATCH] Remove expect fns; declare parse-word. --- src/ludus/parser.clj | 27 +++------------------------ 1 file changed, 3 insertions(+), 24 deletions(-) diff --git a/src/ludus/parser.clj b/src/ludus/parser.clj index 33995a2..2f2d9c6 100644 --- a/src/ludus/parser.clj +++ b/src/ludus/parser.clj @@ -24,29 +24,9 @@ (defn- token-type [parser] (::token/type (current parser))) -(defn- expect [message tokens parser] - (let [curr (current parser)] - (if (contains? tokens (::token/type curr)) - parser - (assoc parser ::ast { - ::ast/type ::ast/poison - :message (str "Expected " message) - :token curr})))) - -(defn- expect+ [message tokens parser] - (print "Epxecting ") - (pp/pprint tokens) - (let [curr (current parser) - next (next parser)] - (println "Current: " curr " Next: " next) - (if (contains? tokens (::token/type curr)) - (if (contains? tokens (::token/type next)) - (recur message tokens (advance parser)) - parser) - (assoc parser ::ast { - ::ast/type ::ast/poison - :message (str "Expected " message) - :token curr})))) +;; some forward declarations +(declare parse-expr) +(declare parse-word) (defn- parse-atom [parser token] (-> parser @@ -68,7 +48,6 @@ ::ast/type ::ast/atom :value (get atomic-words (::token/type token))}))) -(declare parse-expr) (defn- add-member [members member] (if (nil? member)