Brachylog icon indicating copy to clipboard operation
Brachylog copied to clipboard

Backslash escapes quotation mark even when escaped.

Open kckennylau opened this issue 9 years ago • 3 comments
trafficstars

"\" gets treated as quotation, but even "\\" gets treated as quotation.

kckennylau avatar Aug 14 '16 03:08 kckennylau

@kckennylau Both "\" and "\\" are incorrect syntax, even though TIO doesn't print an error for it (which it should). So I don't see how you saw it get treated as quotation.

Though I now realize that the string "" isn't typable (because \ only escapes "). I might change it so that " escapes ".

JCumin avatar Aug 16 '16 06:08 JCumin

http://brachylog.tryitonline.net/#code=OmVmLg&input=IlxcIg&args=Wg

kckennylau avatar Aug 16 '16 07:08 kckennylau

@kckennylau This is extremely annoying to fix because TIO reads the input from a file, and in the offline intrepreter you can input a string in an atom (single quotes) or directly as a term too. Those three scenarios all have different escaping rules: in the file, no escaping is performed before I get to parse it, in an atom \" is escaped as " like a normal ", and in a string term it escapes as expected with backslashes.

JCumin avatar Aug 22 '16 09:08 JCumin