add pkg-kw tokens
This commit is contained in:
parent
94adf5e9d5
commit
23128902bc
|
@ -169,6 +169,15 @@
|
||||||
:else (add-error scanner (string "Unexpected " char "after keyword :" key)))))
|
:else (add-error scanner (string "Unexpected " char "after keyword :" key)))))
|
||||||
(recur scanner ""))
|
(recur scanner ""))
|
||||||
|
|
||||||
|
(defn- add-pkg-kw [scanner]
|
||||||
|
(defn recur [scanner key]
|
||||||
|
(let [char (current-char scanner)]
|
||||||
|
(cond
|
||||||
|
(terminates? char) (add-token scanner :pkg-kw (keyword key))
|
||||||
|
(word-char? char) (recur (advance scanner) (string key char))
|
||||||
|
:else (add-error scanner (string "Unexpected " char " after pkg keyword :" key)))))
|
||||||
|
(recur scanner ""))
|
||||||
|
|
||||||
(defn- read-literal [lit] (-> lit parse-all first))
|
(defn- read-literal [lit] (-> lit parse-all first))
|
||||||
|
|
||||||
### TODO: consider whether Janet's number rules are right for Ludus
|
### TODO: consider whether Janet's number rules are right for Ludus
|
||||||
|
@ -299,7 +308,8 @@
|
||||||
# XXX: make sure we want only lower-only keywords
|
# XXX: make sure we want only lower-only keywords
|
||||||
":" (cond
|
":" (cond
|
||||||
(lower? next) (add-keyword scanner)
|
(lower? next) (add-keyword scanner)
|
||||||
:else (add-error scanner (string "Expected keyword. Got " char next)))
|
(upper? next) (add-pkg-kw scanner)
|
||||||
|
:else (add-error scanner (string "Expected keyword or pkg keyword. Got " char next)))
|
||||||
|
|
||||||
## splats
|
## splats
|
||||||
"." (let [after_next (current-char (advance scanner))]
|
"." (let [after_next (current-char (advance scanner))]
|
||||||
|
|
Loading…
Reference in New Issue
Block a user