comment on last line does not kill scanner
This commit is contained in:
parent
bbd41a0f74
commit
943e96203e
|
@ -250,7 +250,7 @@
|
||||||
(defn- add-comment [char scanner]
|
(defn- add-comment [char scanner]
|
||||||
(defn recur [scanner comm]
|
(defn recur [scanner comm]
|
||||||
(let [char (current-char scanner)]
|
(let [char (current-char scanner)]
|
||||||
(if (= "\n" char)
|
(if (or (= "\n" char) (at-end? scanner))
|
||||||
scanner # for now, we don't do anything with comments; can be added later
|
scanner # for now, we don't do anything with comments; can be added later
|
||||||
(recur (advance scanner) (buffer/push comm char)))))
|
(recur (advance scanner) (buffer/push comm char)))))
|
||||||
(recur scanner (buffer char)))
|
(recur scanner (buffer char)))
|
||||||
|
@ -341,5 +341,9 @@
|
||||||
(recur (-> scanner (scan-token) (next-token)))))
|
(recur (-> scanner (scan-token) (next-token)))))
|
||||||
(recur (new-scanner source input)))
|
(recur (new-scanner source input)))
|
||||||
|
|
||||||
(def source `print! ("hello")`)
|
(def source `
|
||||||
|
a :b "c"
|
||||||
|
& thing
|
||||||
|
`)
|
||||||
|
|
||||||
(pp ((scan source) :tokens))
|
(pp ((scan source) :tokens))
|
||||||
|
|
Loading…
Reference in New Issue
Block a user