Chez Phase 3: fix +N reader literal in jolt.reader only (not the doomed Janet seed)
fix-bugs-dont-reproduce, scoped per the keeper rule: jolt-if19 (a leading + on a numeric literal errored instead of reading as the positive number) is fixed in jolt.reader (read-number* now strips a leading + like -, positive), the code we keep. The Janet seed reader (reader.janet) is left untouched — it's deleted in Phase 5, so fixing it is wasted work. Since the seed reader stays buggy, reader-parity can't use it as the oracle for these inputs: added check-correct to assert the portable reader against the hand- verified value (+5 => 5, +42, +0xff => 255, +3.5). reader-parity 67/67. No Janet binary/gate impact (jolt.reader is not yet in the binary path). jolt-if19.
This commit is contained in:
parent
4de586089c
commit
afada6d4ff
2 changed files with 25 additions and 5 deletions
|
|
@ -117,8 +117,11 @@
|
|||
;; number, a ratio a/b reads as the double quotient, radixed ints by base.
|
||||
(defn- read-number* [s pos]
|
||||
(let [length (len s)
|
||||
;; optional leading sign: - negates; + is a positive no-op (Clojure reads
|
||||
;; +5 as 5). read-form only dispatches +digit/-digit, so the sign is real.
|
||||
neg (and (< pos length) (= (cp s pos) 45))
|
||||
start (if neg (inc pos) pos)
|
||||
plus (and (< pos length) (= (cp s pos) 43))
|
||||
start (if (or neg plus) (inc pos) pos)
|
||||
hex? (and (< (inc start) length) (= (cp s start) 48)
|
||||
(let [c1 (cp s (inc start))] (or (= c1 120) (= c1 88))))] ; 0x / 0X
|
||||
(if hex?
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue