cson-parser
cson-parser copied to clipboard
Numbers prefixed with a plus shouldn't throw errors
+1
is valid in both CoffeeScript and JavaScript, but cson-parser
treats it as an error:
λ ~: echo '+2' | cson2json
/usr/local/lib/node_modules/cson/esnext/cli.js:72
throw result;
^
SyntaxError: Syntax error on line 1, column 1: Unknown unary operator +
at Op (/usr/local/lib/node_modules/cson/node_modules/cson-parser/lib/parse.js:190:17)
at transformNode (/usr/local/lib/node_modules/cson/node_modules/cson-parser/lib/parse.js:216:12)
at Block (/usr/local/lib/node_modules/cson/node_modules/cson-parser/lib/parse.js:94:12)
at transformNode (/usr/local/lib/node_modules/cson/node_modules/cson-parser/lib/parse.js:216:12)
at Object.parse (/usr/local/lib/node_modules/cson/node_modules/cson-parser/lib/parse.js:222:16)
Hm, interesting. Is there a specific use case for using unary plus in a config? I'd be fine with adding it but I don't think it'd be something we would get around to soon.
Probably only for cosmetic affairs like alignment and consistency with other numerals:
a: +2,
b: -3,
3: +3,