History

set-reader-macro: return void

Sigrid Solveig Haflínudóttir committed 3 months ago

Commit 6865e1c1 parent 734dc8f3 files · +13 −12Browse files

Unified · Split

3 files
  1. boot/sl.boot +1 −1
  2. src/system.sl +2 −1
  3. test/read.sl +10 −10
boot/sl.boot+1−1
@@ -1039,7 +1039,7 @@ rune? #fn("A120805121Q:" #(#fn(type-of) rune) 6) self-evaluating? · 1038 unmodified lines
10391039 separate-doc-from-body #fn("w10002000W1000J70D9?14DIDI20?6421?7480<80=2288513H081JC0893>073898881P62:813P08688513G07389=888789<51P81P62:74815180P:" #(#fn("A17021802263:" #(<=
10401040 :doc-a :doc-z) doc? 8) #fn("A180B3H080<20C@080TB390718061:80:" #(λ compile) maybe-lambda 6)
10411041 #fn(str?) separate-doc-from-body reverse) 13)
1042−set-reader-macro! #fn("w20003000W2000J7070?247180513=0228051?0@40D94237425828053D981;38048081P63:" #(*read-table*
1042+set-reader-macro! #fn("w20003000W2000J7070?247180513=0228051?0@40D94237425828053D981;38048081P534DI:" #(*read-table*
10431043 rune? #fn(str) #fn(put!) foldl #fn("A22081802150532281808653486:" #(#fn(get)
10441044 #fn(table)
10451045 #fn(put!)) 9)) 9)
src/system.sl+2−1
@@ -2434,7 +2434,8 @@ · 2433 unmodified lines
24342434 rt
24352435 s)
24362436 NIL
2437− (and fn (cons s fn))))
2437+ (and fn (cons s fn)))
2438+ #.(void))
24382439
24392440 ;;; exceptions
24402441
test/read.sl+10−10
@@ -8,9 +8,9 @@ · 7 unmodified lines
88 (when (equal? m "!")
99 (return (void (read s))))
1010 `(cons ',(case m ("$" 'usd) ("€" 'eur)) ,(read s)))
11− (set-reader-macro! #\$ capital)
12− (set-reader-macro! #\€ capital)
13− (set-reader-macro! #\! capital)
11+ (assert (void? (set-reader-macro! #\$ capital)))
12+ (assert (void? (set-reader-macro! #\€ capital)))
13+ (assert (void? (set-reader-macro! #\! capital)))
1414 (assert (eq? (get-reader-macro #\$) capital))
1515 (assert (eq? (get-reader-macro #\€) capital))
1616 (assert (eq? (get-reader-macro #\!) capital)))
@@ -19,7 +19,7 @@ · 2 unmodified lines
1919 (assert (equal? €20 '(eur . 20)))
2020 (assert (equal? (list $10 !10) '((usd . 10))))
2121 (assert (not (list !10)))
22− (set-reader-macro! "$" NIL)) ; the fall of the US empire
22+ (assert (void? (set-reader-macro! "$" NIL)))) ; the fall of the US empire
2323 #.(begin
2424 (assert (equal? $10 'nothing)))
2525
@@ -31,8 +31,8 @@ · 5 unmodified lines
3131 (subseq m 1)
3232 (str (subseq m 1) (read s)))]}
3333 `(cons 'path ,path)))
34− (set-reader-macro! "@." to-path)
35− (set-reader-macro! "@/" to-path)
34+ (assert (void? (set-reader-macro! "@." to-path)))
35+ (assert (void? (set-reader-macro! "@/" to-path)))
3636 (assert (eq? (get-reader-macro "@.") to-path))
3737 (assert (eq? (get-reader-macro "@/") to-path)))
3838 #.(begin
@@ -49,16 +49,16 @@ · 10 unmodified lines
4949
5050 ;; read-list-until and reader macros
5151 #.(begin
52− (set-reader-macro! "<<"
53− (λ (s m) `(list ,@(read-list-until ">>" s))))
52+ (assert (void? (set-reader-macro! "<<"
53+ (λ (s m) `(list ,@(read-list-until ">>" s))))))
5454 (def s (buffer "<<€1 €2 €3>>1 2"))
5555 (assert (equal? (eval (read s)) '((eur . 1) (eur . 2) (eur . 3))))
5656 (assert (equal? (read s) 1)))
5757
5858 ;; two reader macros with read-list-until within each other
5959 #.(begin
60− (set-reader-macro! "%%"
61− (λ (s r) `(list ,@(read-list-until "$$" s))))
60+ (assert (void? (set-reader-macro! "%%"
61+ (λ (s r) `(list ,@(read-list-until "$$" s))))))
6262 (def s (buffer "<<%%1$$>>"))
6363 (assert (equal? (eval (read s)) '((1))))
6464 (def s (buffer "<<%% 1 >> $$"))

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t