RakuyoKit / JSONPreview

🎨 A view that previews JSON in highlighted form, it also provides the ability to format and collapse nodes.
MIT License
68 stars 13 forks source link

Fixed issue with escaped strings #1

Closed ChiellieNL closed 3 years ago

ChiellieNL commented 3 years ago

Assume my JSON would be:

{
    "string": "This is a string that has some \"quotes\" inside it!"
}

the lexer would consider the string ended on the first " before the q and then break with an unknown token.

This patch will check if the " is being proceeded by a \ and, if so, continue looking for the string's (real) end.

rakuyoMo commented 3 years ago

Thank you for fixing the issue, I will merge the commit, and I may change some of the code to make it look similar to the rest of the code style. Also I will add some tests to make sure that the issue is indeed fixed.