Open GoogleCodeExporter opened 9 years ago
I was also hoping that the keys and values would be differentiated, but they
are not.
Original comment by hugh.lo...@lodestarbpm.com
on 27 Dec 2013 at 6:00
[deleted comment]
[deleted comment]
Something like
PR['registerLangHandler'](
PR['createSimpleLexer'](
[
[PR['PR_PLAIN'], /^\s+/, null, '\t\n\r '],
[PR['PR_KEYWORD'], /^(?:true|false|null)\b/, null, 'tfn'],
[PR['PR_LITERAL'], /^[+\-]?(?:0xX[0-9a-f]+|(?:\d+|\d*\.\d+)(?:e[+\-]?\d+)?)/, null, '+-0123456789.'],
[PR['PR_PUNCTUATION'], /^[,:{}\[\]]+/, null, ',:{}[]']
],
[
// A string followed by a colon is additionally a key.
['lang-jsonkey', /^(\"(?:[^\n\r\\\"]|\\\S)*\")\s*:/],
[PR['PR_STRING'], /^\"(?:[^\n\r\\\"]|\\\S)*\"/]
]),
['json']);
PR['registerLangHandler'](
PR['createSimpleLexer'](
[
// Apply the classes str and key to the key.
[PR['PR_STRING'] + ' key', /^[\s\S]*/, null, '"']
],
[
]),
['jsonkey']);
should do it, but it runs into the problem that many people use the word "JSON"
for things that are not quire JSON like
myJsonPCallback({ ... })
[new Date(2014, 1, 1)]
{ /* Comments are fun */ }
{ 'single quoted keys are fun': true, but: "whatsMoreFun?", unquotedKeys: true }
/* Math is hard! */ [NaN, Infinity]
Defining JSON mode strictly is hard. Reusing JS mode neatly side-steps all
those issues, but colon is overloaded in JS.
Original comment by mikesamuel@gmail.com
on 30 Dec 2013 at 4:26
Original issue reported on code.google.com by
jus...@balancedpayments.com
on 19 Jul 2013 at 9:16