Ticket #141 (closed defect: fixed)

Opened 5 years ago

Last modified 2 years ago

doesn't parse a lone number

Reported by: vegashacker Owned by: dherman
Priority: major Milestone:
Component: dherman/json.plt Keywords:
Cc: Version: (1 1)
Racket Version: 4.1

Description

> (require (only-in (planet "json.ss" ("dherman" "json.plt" 1 (= 1))) (read read-json)))
> (read-json (open-input-string "1"))
char=?: expects type <character> as 1st argument, given: #<eof>; other arguments were: #\.  

Change History

Changed 5 years ago by vegashacker

Here's a patch that fixes the problem (not necessarily how you want to fix it, but fyi):

Index: json.ss
===================================================================
--- json.ss     (revision 1081)
+++ json.ss     (working copy)
@@ -149,7 +149,8 @@
   (void))

 (define (decimal-point? ch)
-  (char=? ch #\.))
+  (and (char? ch) ; because eof-object can be passed in
+       (char=? ch #\.)))

Changed 2 years ago by dherman

  • status changed from new to closed
  • resolution set to fixed

Fixed and updated.

Dave

Note: See TracTickets for help on using tickets.