add uppercase pkg to scanner
This commit is contained in:
parent
f3778792b3
commit
232261b646
|
@ -217,6 +217,16 @@
|
||||||
:else (add-error scanner (string "Unexpected " curr " after word " word ".")))))
|
:else (add-error scanner (string "Unexpected " curr " after word " word ".")))))
|
||||||
(recur scanner (buffer char)))
|
(recur scanner (buffer char)))
|
||||||
|
|
||||||
|
(defn- add-pkg
|
||||||
|
[char scanner]
|
||||||
|
(defn recur [scanner pkg]
|
||||||
|
(let [curr (current-char scanner)]
|
||||||
|
(cond
|
||||||
|
(terminates? curr) (add-token scanner :pkg :none)
|
||||||
|
(word-char? curr) (recur (advance scanner) (buffer/push pkg curr))
|
||||||
|
:else (add-error scanner (string "unexpected " curr " after pkg name " pkg)))))
|
||||||
|
(recur scanner (buffer char)))
|
||||||
|
|
||||||
(defn- add-ignored
|
(defn- add-ignored
|
||||||
[scanner]
|
[scanner]
|
||||||
(defn recur [scanner ignored]
|
(defn recur [scanner ignored]
|
||||||
|
@ -302,7 +312,7 @@
|
||||||
(cond
|
(cond
|
||||||
(whitespace? char) scanner ## for now just skip whitespace characters
|
(whitespace? char) scanner ## for now just skip whitespace characters
|
||||||
(digit? char) (add-number char scanner)
|
(digit? char) (add-number char scanner)
|
||||||
(upper? char) (add-word char scanner) ## no datatypes for now
|
(upper? char) (add-pkg char scanner)
|
||||||
(lower? char) (add-word char scanner)
|
(lower? char) (add-word char scanner)
|
||||||
:else (add-error scanner (string "Unexpected character: " char))))))
|
:else (add-error scanner (string "Unexpected character: " char))))))
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user