Summary

json-abnf chokes on escapes in strings

Metadata

Description

Parsing JSON strings containing escape sequences like "\n" or "\u0040" fails. To reproduce this, try:

 (use json-abnf)
 (parser "[\"\\n\"]")

which results in:

 JSON parser error on stream: ["\n"]
 
 Error: (caar) bad argument type: ()
 
         Call history:
 
         <syntax>          (parser "[\"\\n\"]")
         <eval>    (parser "[\"\\n\"]")
         string->list      
         p291      
         lexgen#bar        
         lexgen#bar        
         lexgen#bar        
         lexgen#bar        
         lexgen#bar        
         lexgen#bar        
         print           <--

Changes and comments

[2011-02-20 08:17:27 UTC] iraikov changed status from new to closed

[2011-02-20 08:17:27 UTC] iraikov set resolution to fixed

[2011-02-20 08:17:27 UTC] iraikov wrote:

Fixed in json-abnf release 3.2

[2011-02-20 13:25:28 UTC] syn changed status from closed to reopened

[2011-02-20 13:25:28 UTC] syn removed resolution fixed

[2011-02-20 13:25:28 UTC] syn wrote:

Thanks for the quick fix, Ivan! Now there is another problem: For some reason, strings containing exclamation points still lead to the same error, i.e. the string "!" causes the parser to fail. However, I can't find any special-casing of #\! in the code. Can you see what's going on?

[2011-02-21 02:49:20 UTC] iraikov wrote:

I used ucs-range->char-set to create the character sets representing valid characters in a string, but because I didn't RTFSRFI, I didn't realise it excludes the upper bound from the created set. This has been fixed now.

Replying to syn: > Thanks for the quick fix, Ivan! Now there is another problem: For some reason, strings containing exclamation points still lead to the same error, i.e. the string "!" causes the parser to fail. However, I can't find any special-casing of #\! in the code. Can you see what's going on?

[2011-03-08 11:46:05 UTC] iraikov changed status from reopened to closed

[2011-03-08 11:46:05 UTC] iraikov set resolution to fixed

[2011-06-01 09:00:41 UTC] felix changed milestone from 4.7.0 to 4.8.0

[2011-06-01 09:00:41 UTC] felix wrote:

Milestone 4.7.0 deleted

[2012-09-24 21:47:48 UTC] felix changed milestone from 4.8.0 to 4.9.0

[2012-09-24 21:47:48 UTC] felix wrote:

Milestone 4.8.0 deleted