json - how to write lex file for input like "{\"a\":1,\"b\":2}" -


i want implement json parser, having problem parse object "{\"a\":1,\"b\":2}", parser output somthing

'(json   (object    "{"    (kvpair     "\"a\":1,\"b\""     ":"     (json (number "2")))    "}")) 

but want is

'(json     (object      "{"      (kvpair "\"a\"" ":" (json (number "1")))      ","      (kvpair "\"b\"" ":" (json (number "2")))      "}")) 

i using #lang ragg , parser-tools/lex, how can write lex rules can right output. source_code

change rule string-literal in lex.rkt to:

[string-literal    (:: #\" (:* char-literal1) #\")] 

note added 1.


Comments

Popular posts from this blog

c++ - Difference between pre and post decrement in recursive function argument -

php - Nothing but 'run(); ' when browsing to my local project, how do I fix this? -

php - How can I echo out this array? -