Add the JSON built-in object

RESOLVED FIXED

Status

Rhino
Core
--
enhancement
RESOLVED FIXED
8 years ago
8 years ago

People

(Reporter: rspeyer, Assigned: Norris Boyd)

Tracking

(Blocks: 1 bug)

Details

Attachments

(3 attachments, 1 obsolete attachment)

(Reporter)

Description

8 years ago
User-Agent:       Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_5_7; en-gb) AppleWebKit/530.18 (KHTML, like Gecko) Version/4.0.1 Safari/530.18
Build Identifier: Rhino 1.7 release 2 2009 03 22

As specified by 15.12 of the EcmaScript 5 spec.

http://wiki.ecmascript.org/doku.php?id=es3.1:es3.1_proposal_working_draft

Reproducible: Always
(Reporter)

Updated

8 years ago
Blocks: 489326
(Reporter)

Comment 1

8 years ago
Created attachment 389460 [details] [diff] [review]
initial implementation of JSON object

Assumes existence of of NativeArrayTest, which is added in attachment 386880 [details] [diff] [review] for bug 489329
(Reporter)

Comment 2

8 years ago
Created attachment 389501 [details] [diff] [review]
updated JSON implementation

Cleaned up the code a little and disallowed JSON numbers from starting with 0 unless their entire integral part is just '0'.
Attachment #389460 - Attachment is obsolete: true
(Reporter)

Comment 3

8 years ago
Created attachment 389515 [details] [diff] [review]
simplified JsonLexer using regex'es
(Assignee)

Comment 4

8 years ago
Are JsonLexer and JsonParser from yajjl? If so, do you want to keep them under the original MIT license? If yes, I think we should have some indication of the license in the header of the file or in the directory. If you're willing to rerelease the source under the MPL (and others haven't contributed patches under that license), then can you add the MPL to the top of the file?
(Assignee)

Updated

8 years ago
Assignee: nobody → norrisboyd
Status: UNCONFIRMED → ASSIGNED
Ever confirmed: true
(Reporter)

Comment 5

8 years ago
Created attachment 389694 [details] [diff] [review]
added MPL to top of JsonLexer and JsonParser
(Assignee)

Comment 6

8 years ago
Looks great, thanks. I did tweak the formatting a bit and made some small changes to fix warnings I was seeing in Eclipse. I also added code to set the parent and proto of the wrapper object.

Checking in src/org/mozilla/javascript/NativeArray.java;
/cvsroot/mozilla/js/rhino/src/org/mozilla/javascript/NativeArray.java,v  <--  NativeArray.java
new revision: 1.103; previous revision: 1.102
done
RCS file: /cvsroot/mozilla/js/rhino/src/org/mozilla/javascript/NativeJSON.java,v
done
Checking in src/org/mozilla/javascript/NativeJSON.java;
/cvsroot/mozilla/js/rhino/src/org/mozilla/javascript/NativeJSON.java,v  <--  NativeJSON.java
initial revision: 1.1
done
Checking in src/org/mozilla/javascript/ScriptRuntime.java;
/cvsroot/mozilla/js/rhino/src/org/mozilla/javascript/ScriptRuntime.java,v  <--  ScriptRuntime.java
new revision: 1.314; previous revision: 1.313
done
RCS file: /cvsroot/mozilla/js/rhino/src/org/mozilla/javascript/json/JsonLexer.java,v
done
Checking in src/org/mozilla/javascript/json/JsonLexer.java;
/cvsroot/mozilla/js/rhino/src/org/mozilla/javascript/json/JsonLexer.java,v  <--  JsonLexer.java
initial revision: 1.1
done
RCS file: /cvsroot/mozilla/js/rhino/src/org/mozilla/javascript/json/JsonParser.java,v
done
Checking in src/org/mozilla/javascript/json/JsonParser.java;
/cvsroot/mozilla/js/rhino/src/org/mozilla/javascript/json/JsonParser.java,v  <--  JsonParser.java
initial revision: 1.1
done
Checking in testsrc/org/mozilla/javascript/tests/NativeArrayTest.java;
/cvsroot/mozilla/js/rhino/testsrc/org/mozilla/javascript/tests/NativeArrayTest.java,v  <--  NativeArrayTest.java
new revision: 1.2; previous revision: 1.1
done
RCS file: /cvsroot/mozilla/js/rhino/testsrc/org/mozilla/javascript/tests/json/JsonLexerTest.java,v
done
Checking in testsrc/org/mozilla/javascript/tests/json/JsonLexerTest.java;
/cvsroot/mozilla/js/rhino/testsrc/org/mozilla/javascript/tests/json/JsonLexerTest.java,v  <--  JsonLexerTest.java
initial revision: 1.1
done
RCS file: /cvsroot/mozilla/js/rhino/testsrc/org/mozilla/javascript/tests/json/JsonParserTest.java,v
done
Checking in testsrc/org/mozilla/javascript/tests/json/JsonParserTest.java;
/cvsroot/mozilla/js/rhino/testsrc/org/mozilla/javascript/tests/json/JsonParserTest.java,v  <--  JsonParserTest.java
initial revision: 1.1
done
Status: ASSIGNED → RESOLVED
Last Resolved: 8 years ago
Resolution: --- → FIXED
(Reporter)

Updated

8 years ago
Depends on: 537483
You need to log in before you can comment on or make changes to this bug.