diff --git a/src/hs_robotwar/core.clj b/src/hs_robotwar/core.clj index d416b77..967dbc0 100644 --- a/src/hs_robotwar/core.clj +++ b/src/hs_robotwar/core.clj @@ -75,66 +75,4 @@ (println (evaluate (parse (lex input)))) (recur (read-line))))) - - -; (def error-type-map -; {:parse-error "Parse Error" -; :end-of-line-error "End of Line Error"}) - -; (defn error -; [error-type error-string] -; (str (error-type-map error-type) ": " error-string)) - -; (defn valid-number-string -; [n] -; (re-find #"^-?\d+\.?\d*$" n)) - -; (defn number-or-string -; [x] -; (if (valid-number-string x) -; (Float/parseFloat x) -; x)) - -; (defn string-with-idx -; [s, idx] -; (if (empty? s) -; nil -; {:token s -; :idx idx})) - -; (defn tokens-with-column-numbers -; "splits a string and returns a sequence of hashmaps, -; with column-number metadata. separated just by spaces -; for now. In the future, tokens won't necessarily have -; spaces between them." -; [s] -; (let [len (count s)] -; (loop [s s -; idx 0 -; partial-word "" -; result []] -; (let [first-s (subs s 0 1) -; rest-s (subs s 1)] -; (cond -; (empty? s) (if (empty? partial-word) -; result -; (conj result (str-with-idx partial-word idx)) -; (re-find #"\s" first-s) (if (empty? partial-word) -; (recur rest-s idx "" result) -; (recur rest-s idx "" (conj result (str-with-idx -; partial-word idx)))) -; :else (if (empty? partial-word) -; (recur rest-s (- len (count s)) first-s result) -; (recur rest-s idx (str partial-word first-s) result)))))))) - - - -; (defn validate-expr -; "right now just checks to see whether it's a number. -; will do a lot more things in the future." -; [expr] -; (if (number? expr) -; [expr nil] -; [expr (error :parse-error "Not a number")])) - - +