Closed idleberg closed 8 years ago
Consider the following example
import cson scope = ".source.js" key = "function()" array = {} array[key] = "function($1)" atom = {scope: (array)} result = cson.dumps(atom, sort_keys=True, indent=4) print(result)
This will print invalid CSON, since the functon() key isn't wrapped in quotes:
functon()
'.source.js': function(): 'function($1)'
To validate the result, append cson.loads(result) to the example above. This produces the following error:
cson.loads(result)
Traceback (most recent call last): File "test.py", line 15, in <module> cson.loads(result) File "/cson/parser.py", line 17, in loads return peg(s.replace('\r\n', '\n'), _p_root) File "/Library/Python/2.7/site-packages/speg/peg.py", line 24, in peg raise ParseError(err.msg, s, offset, err.line, err.col) speg.peg.ParseError: ("expected ':', found u'(): '", 25, 2, 13)
Hi, thanks for the issue! It should be fixed in 0.6. Upgrade with pip install cson --upgrade.
pip install cson --upgrade
Consider the following example
This will print invalid CSON, since the
functon()
key isn't wrapped in quotes:To validate the result, append
cson.loads(result)
to the example above. This produces the following error: