[ 
https://issues.apache.org/jira/browse/AVRO-268?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12795306#action_12795306
 ] 

Jeff Hammerbacher commented on AVRO-268:
----------------------------------------

Worth noting that the new behavior is not standard:

JavaScript:
{code}
js> var a = JSON.parse('{ "key": "value" } foo bar baz');
js: "/Users/hammer/codebox/narwhal/engines/default/lib/json.js", line 474: 
exception from uncaught JavaScript throw: SyntaxError: JSON.parse
{code}

Python:
{code}
>>> b = json.loads('{ "key": "value" } foo bar baz')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "build/bdist.macosx-10.5-i386/egg/simplejson/__init__.py", line 307, in 
loads
  File "build/bdist.macosx-10.5-i386/egg/simplejson/decoder.py", line 338, in 
decode
ValueError: Extra data: line 1 column 19 - line 1 column 30 (char 19 - 30)
{code}

> Replace lemon-generated JSON parser with simpler recursive descent parser
> -------------------------------------------------------------------------
>
>                 Key: AVRO-268
>                 URL: https://issues.apache.org/jira/browse/AVRO-268
>             Project: Avro
>          Issue Type: Improvement
>          Components: c
>            Reporter: Matt Massie
>            Assignee: Matt Massie
>             Fix For: 1.3.0
>
>         Attachments: AVRO-268.patch
>
>
> This is a drop-in replacement for the current JSON parser which is based on 
> lemon (a LALR parser generator).
> This parser 
> * reads and returns a single JSON_value and its nested children (using 
> recursive descent parsing)
> * allows you to process JSON from streams in addition to static memory buffers
> * correctly processes unicode \u escaping including surrogates
> * distinguishes between integer and real number representations 
> * provides information about the line and character in JSON that failed to 
> parse
> * is much simpler to understand and maintain (less lines of code and source 
> files)
> * is written to allow error recovery to be added later
> This patch also adds more unit tests.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to