File tree Expand file tree Collapse file tree 1 file changed +17
-12
lines changed Expand file tree Collapse file tree 1 file changed +17
-12
lines changed Original file line number Diff line number Diff line change 44 [reader :as r]]))
55
66(defn- read-to-boundary
7- [reader]
8- (r/read-until
9- reader
10- r/whitespace-or-boundary?))
7+ [reader & [allowed]]
8+ (let [allowed? (set allowed)]
9+ (r/read-until
10+ reader
11+ #(and (not (allowed? %))
12+ (r/whitespace-or-boundary? %)))))
1113
1214(defn- read-to-char-boundary
1315 [reader]
1820 " " ))))
1921
2022(defn- symbol-node
21- " Symbols allow for trailing quotes that have to be handled
22- explicitly."
23+ " Symbols allow for certain boundary characters that have
24+ to be handled explicitly."
2325 [reader value value-string]
24- (if (= (r/peek reader) \')
25- (let [s (str value-string (r/next reader))]
26- (node/token-node
27- (r/string->edn s)
28- s))
29- (node/token-node value value-string)))
26+ (let [suffix (read-to-boundary
27+ reader
28+ [\' \:])]
29+ (if (empty? suffix)
30+ (node/token-node value value-string)
31+ (let [s (str value-string suffix)]
32+ (node/token-node
33+ (r/string->edn s)
34+ s)))))
3035
3136(defn parse-token
3237 " Parse a single token."
You can’t perform that action at this time.
0 commit comments