cson-parser
cson-parser copied to clipboard
Bug: empty object and block commenting
There is some sort of bug in the parser when an empty object is set inside a single cson file
works: empty object normal comment
# test
{}
empty object without block comment
{}
top level object is not empty
###
# test
###
EN: {}
fails:
###
# test
###
{}
Console output
SyntaxError: Syntax error on line 1, column 1: One top level value expected
at nodeTransforms.Block (/node_modules/cson-parser/lib/parse.js:82:15)
at transformNode (/node_modules/cson-parser/lib/parse.js:207:12)
at Object.parse (/node_modules/cson-parser/lib/parse.js:213:12)
The problem seems to be happening in the coffee-script's lexter.tokenizer( )
function at https://github.com/jashkenas/coffeescript/blob/65c35e05a18bef4e302e6fd29c5d0783dd0b8363/src/coffee-script.coffee#L58
I found a workaround that passes the parser:
{
###
# test
###
}