Skip comments, the dumb solution.

This commit is contained in:
Scott Richmond 2022-03-19 19:21:29 -04:00
parent 2a099298f0
commit 584ddaf705
2 changed files with 17 additions and 4 deletions

View File

@ -446,6 +446,10 @@
(parse-then (accept ::token/newline ast))
))
(defn- parse-match-clause [parser])
(defn- parse-match [parser])
(defn- parse-expr
([parser] (parse-expr parser sync-on))
([parser sync-on] (let [token (current parser)]
@ -483,6 +487,10 @@
::token/if (parse-if parser)
::token/match (parse-match parser)
::token/comment (advance parser)
::token/error (panic parser (:message token) sync-on)
(::token/rparen ::token/rbrace ::token/rbracket)
@ -504,7 +512,11 @@
(do
(def pp pp/pprint)
(def source "#{:a :b, :c :d}")
(def source "
(1
2
&three
3)")
(def lexed (scanner/scan source))
(def tokens (:tokens lexed))
(def p (parser tokens))

View File

@ -208,9 +208,10 @@
comm (str char)]
(let [char (current-char scanner)]
(if (= \newline char)
(if (s/starts-with? comm "&&&")
(add-token (update scanner ::line inc) ::token/docstring)
(add-token (update scanner ::line inc) ::token/comment))
(update scanner ::line inc)
;;(if (s/starts-with? comm "&&&")
;;(add-token (update scanner ::line inc) ::token/docstring)
;;(add-token (update scanner ::line inc) ::token/comment))
(recur (advance scanner) (str comm char))))))
(defn- scan-token [scanner]