Skip to content

Commit 95e30df

Browse files
authored
Rename StreamReader.next_token to StreamReader.next_char (#915)
Split out from #906
1 parent 23e77d0 commit 95e30df

File tree

4 files changed

+157
-155
lines changed

4 files changed

+157
-155
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1010

1111
### Changed
1212
* Updated dozens of type annotations in the compiler to satisfy MyPy 1.11 (#910)
13+
* Update the `StreamReader` methods to stop using the term "token" to refer to individual UTF-8 characters (#915)
1314

1415
### Fixed
1516
* Fix a bug where `.` characters were not allowed in keyword names (#899)

src/basilisp/edn.lpy

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@
117117
(cond
118118
(= c "/")
119119
(do
120-
(.next-token reader)
120+
(.next-char reader)
121121
(cond
122122
has-ns
123123
(throw
@@ -139,7 +139,7 @@
139139
(or (re-matches ns-name-chars c)
140140
(and (seq name) (= c "'")))
141141
(do
142-
(.next-token reader)
142+
(.next-char reader)
143143
(recur ns (conj name c) has-ns))
144144

145145
:else
@@ -173,7 +173,7 @@
173173

174174
(= c end-token)
175175
(do
176-
(.next-token reader)
176+
(.next-char reader)
177177
(f (remove #(identical? comment %) objs)))
178178

179179
:else
@@ -309,7 +309,7 @@
309309
(let [c (.peek reader)]
310310
(cond
311311
(= c "-")
312-
(let [following-token (.next-token reader)]
312+
(let [following-token (.next-char reader)]
313313
(if-not (re-matches begin-num-chars following-token)
314314
(do
315315
(.pushback reader)
@@ -329,12 +329,12 @@
329329
(ex-info "Found extra '.' in float; expected decimal portion"
330330
{:error :extra-decimal-point-in-float}))
331331
(do
332-
(.next-token reader)
332+
(.next-char reader)
333333
(recur (conj chars c) true)))
334334

335335
(re-matches num-chars c)
336336
(do
337-
(.next-token reader)
337+
(.next-char reader)
338338
(recur (conj chars c) is-float))
339339

340340
:else
@@ -346,7 +346,7 @@
346346
(defmethod read-sym-or-num :whitespace
347347
[reader opts]
348348
(while (re-matches whitespace-chars (.peek reader))
349-
(.next-token reader))
349+
(.next-char reader))
350350
(read-next reader opts))
351351

352352
(defmethod read-sym-or-num :sym-or-singleton
@@ -400,7 +400,7 @@
400400

401401
(= c "}")
402402
(do
403-
(.next-token reader)
403+
(.next-char reader)
404404
(try
405405
(->> objs
406406
(remove #(or (identical? comment %)
@@ -428,7 +428,7 @@
428428
[reader _]
429429
(assert (= (.peek reader) "\"")) ;; can use assert since peek does not modify reader
430430
(loop [s []]
431-
(let [c (.next-token reader)]
431+
(let [c (.next-char reader)]
432432
(cond
433433
(= c "")
434434
(throw
@@ -437,7 +437,7 @@
437437
:string (str/join s)}))
438438

439439
(= c "\\")
440-
(let [escape-char (.next-token reader)]
440+
(let [escape-char (.next-char reader)]
441441
(if-let [replacement (get str-escape-chars escape-char)]
442442
(recur (conj s replacement))
443443
(throw
@@ -447,7 +447,7 @@
447447

448448
(= c "\"")
449449
(do
450-
(.next-token reader)
450+
(.next-char reader)
451451
(str/join s))
452452

453453
:default

0 commit comments

Comments
 (0)