bevry / cson

CoffeeScript-Object-Notation. Same as JSON but for CoffeeScript objects.
Other
1.34k stars 56 forks source link

cson formatting errors are suppressed with cson2json #78

Closed balupton closed 7 years ago

balupton commented 7 years ago

this cson file

{
    inherit: 96
    project: "2/2"-10-DocPad
    amount: 3000
}

produces:

$ cson2json ./data-source/test.cson 
{}

however:

$ node -e "console.log(require('cson-parser').parse(require('fs').readFileSync('./data-source/test.cson').toString()))"
/Users/balupton/Projects/accounting/bevry-crm/data/node_modules/cson-parser/lib/parse.js:214
      throw new SyntaxError(syntaxErrorMessage(csNode, 'Unexpected ' + type));
      ^

SyntaxError: Syntax error on line 3, column 20: Unexpected IdentifierLiteral
    at transformNode (/Users/balupton/Projects/accounting/bevry-crm/data/node_modules/cson-parser/lib/parse.js:214:13)
    at Value (/Users/balupton/Projects/accounting/bevry-crm/data/node_modules/cson-parser/lib/parse.js:97:12)
    at transformNode (/Users/balupton/Projects/accounting/bevry-crm/data/node_modules/cson-parser/lib/parse.js:216:12)
    at Op (/Users/balupton/Projects/accounting/bevry-crm/data/node_modules/cson-parser/lib/parse.js:155:19)
    at transformNode (/Users/balupton/Projects/accounting/bevry-crm/data/node_modules/cson-parser/lib/parse.js:216:12)
    at addProperty (/Users/balupton/Projects/accounting/bevry-crm/data/node_modules/cson-parser/lib/parse.js:147:15)
    at Array.reduce (native)
    at Obj (/Users/balupton/Projects/accounting/bevry-crm/data/node_modules/cson-parser/lib/parse.js:140:28)
    at transformNode (/Users/balupton/Projects/accounting/bevry-crm/data/node_modules/cson-parser/lib/parse.js:216:12)
    at Value (/Users/balupton/Projects/accounting/bevry-crm/data/node_modules/cson-parser/lib/parse.js:97:12)
    at transformNode (/Users/balupton/Projects/accounting/bevry-crm/data/node_modules/cson-parser/lib/parse.js:216:12)
    at Block (/Users/balupton/Projects/accounting/bevry-crm/data/node_modules/cson-parser/lib/parse.js:94:12)
    at transformNode (/Users/balupton/Projects/accounting/bevry-crm/data/node_modules/cson-parser/lib/parse.js:216:12)
    at Object.parse (/Users/balupton/Projects/accounting/bevry-crm/data/node_modules/cson-parser/lib/parse.js:222:16)
    at [eval]:1:36
    at ContextifyScript.Script.runInThisContext (vm.js:26:33)
    at Object.exports.runInThisContext (vm.js:79:17)
    at Object.<anonymous> ([eval]-wrapper:6:22)
    at Module._compile (module.js:571:32)
    at Immediate.<anonymous> (bootstrap_node.js:383:29)
    at runCallback (timers.js:651:20)
    at tryOnImmediate (timers.js:624:5)
    at processImmediate [as _immediateCallback] (timers.js:596:5)

ref https://github.com/groupon/cson-parser/issues/28#issuecomment-277466402

balupton commented 7 years ago

closed with v4.1.0