moar bugfixes

This commit is contained in:
Scott Richmond 2024-05-09 18:29:51 -04:00
parent 3f16e45204
commit 248e424993

View File

@ -186,21 +186,17 @@
(defn- add-string
[scanner]
(print "Adding string")
(defn recur [scanner buff interpolate?]
(let [char (current-char scanner)]
(print "scanning current char: " char)
(case char
"{" (recur (advance scanner) (buffer/push buff char) true)
# allow multiline strings
"\n" (recur (update (advance scanner) :line inc) (buffer/push buff char) interpolate?)
"\"" (add-token (advance scanner) (if interpolate? :interpolated :string)(string buff))
"\\" (let [next (next-char scanner)]
(print "found slash")
(print "next char: " next)
(if (= next "{")
(do
(print "escaped brace")
(buffer/push buff char)
(buffer/push buff next)
(recur (advance (advance scanner)) buff interpolate?))
(recur (advance scanner) (buffer/push buff char) interpolate?)))