Update reserved words
This commit is contained in:
parent
1ca1e4df25
commit
d8273946f5
|
@ -4,21 +4,30 @@
|
||||||
|
|
||||||
(def reserved-words
|
(def reserved-words
|
||||||
"List of Ludus reserved words."
|
"List of Ludus reserved words."
|
||||||
#{"fn"
|
;; see ludus-spec repo for more info
|
||||||
"if"
|
#{
|
||||||
"then"
|
|
||||||
"else"
|
|
||||||
"nil"
|
|
||||||
"match"
|
|
||||||
"true"
|
|
||||||
"false"
|
|
||||||
"loop"
|
|
||||||
"recur"
|
|
||||||
"as"
|
"as"
|
||||||
"ref"
|
"cond"
|
||||||
"mut"})
|
"else"
|
||||||
;; other possibilities
|
"false"
|
||||||
;; "pattern" -- first class patterns?
|
"fn"
|
||||||
|
"if"
|
||||||
|
"match"
|
||||||
|
"mut"
|
||||||
|
"nil"
|
||||||
|
"panic!"
|
||||||
|
"then"
|
||||||
|
"true"
|
||||||
|
"var"
|
||||||
|
"with" ;;maybe
|
||||||
|
;; below here, probable
|
||||||
|
"defer"
|
||||||
|
"loop"
|
||||||
|
"ns"
|
||||||
|
"recur"
|
||||||
|
"repeat"
|
||||||
|
"when"
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
(defn- new-scanner
|
(defn- new-scanner
|
||||||
|
@ -137,9 +146,11 @@
|
||||||
|
|
||||||
;; two-character tokens
|
;; two-character tokens
|
||||||
;; ->
|
;; ->
|
||||||
|
;; have to fix this: negative numbers
|
||||||
\- (if (= next \>)
|
\- (if (= next \>)
|
||||||
(add-token (advance scanner) ::token/rarrow)
|
(add-token (advance scanner) ::token/rarrow)
|
||||||
(add-error scanner (str "Expected ->. Got " char next)))
|
(add-error scanner (str "Expected ->. Got " char next)))
|
||||||
|
|
||||||
;; <-
|
;; <-
|
||||||
\< (if (= next \-)
|
\< (if (= next \-)
|
||||||
(add-token (advance scanner) ::token/larrow)
|
(add-token (advance scanner) ::token/larrow)
|
||||||
|
@ -151,6 +162,9 @@
|
||||||
(add-error scanner (str "Expected |>. Got " char next)))
|
(add-error scanner (str "Expected |>. Got " char next)))
|
||||||
|
|
||||||
;; possible additional operator: => (bind)
|
;; possible additional operator: => (bind)
|
||||||
|
\= (if (= next \>)
|
||||||
|
(add-token (advance scanner) ::token/bind)
|
||||||
|
(add-error scanner (str "Expected =>. Got " char next)))
|
||||||
|
|
||||||
;; hashmap #{
|
;; hashmap #{
|
||||||
\# (if (= next \{)
|
\# (if (= next \{)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user