group a number's digits with _
C23 groups them with ', which in Sex is quote, so 1'000 read as 1 and (quote 0); _ between two digits is dropped instead, and anywhere else stays part of a name.
This commit is contained in:
@@ -61,6 +61,12 @@
|
||||
;; ...and only a number: a prefix with nothing after it is a name
|
||||
(reader-test '(0x 0xg) "0x 0xg")
|
||||
|
||||
;; `_' between two digits groups them, the way C23's ' does, which in
|
||||
;; Sex is quote. Anywhere else it is part of a name
|
||||
(reader-test '(1000000 65535 165 1000.5 -1000 100000.0 32768)
|
||||
"1_000_000 0xFF_FF 0b1010_0101 1_000.5 -1_000 1e0_5 #x80_00")
|
||||
(reader-test '(_1 1_ 1__0 0x_FF 0xF_p) "_1 1_ 1__0 0x_FF 0xF_p")
|
||||
|
||||
;; Scheme reads numbers C has no literal for, and they reached C as
|
||||
;; written: 1/2 is integer division there, and +inf.0 no number at all
|
||||
(test "a ratio is not a C number"
|
||||
|
||||
Reference in New Issue
Block a user