groupon/cson-parser

Hard tabs fail to parse

Closed this issue · 5 comments

The following content does not parse if using \t:

'a':
  'b':
    'c': """
d
  e
"""

But switching from \t to a two space indent works fine.

johan commented

Interesting. Works without the e:

node -e 'console.log(require("cson-safe").parse("a:\n\tb:\n\t\tc: \"\"\"\nd\n\t\"\"\""));'
node -e 'console.log(require("cson-safe").parse("c: \"\"\"\nd\n\t\"\"\""));'

Doesn't work with it:

node -e 'console.log(require("cson-safe").parse("a:\n\tb:\n\t\tc: \"\"\"\nd\n\te\"\"\""));'
node -e 'console.log(require("cson-safe").parse("c: \"\"\"\nd\n\te\"\"\""));'

Yeah, looks like the hard tab in the string is what does it.

Hmm, I guess this is what JSON.parse is "supposed" to do, https://code.google.com/p/chromium/issues/detail?id=52560

Still seems odd though since the \n was unescaped and still parsed just fine.

v1.0.5