Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement string escaping #311

Closed
francisdb opened this issue Jan 31, 2019 · 1 comment
Closed

Implement string escaping #311

francisdb opened this issue Jan 31, 2019 · 1 comment

Comments

@francisdb
Copy link
Contributor

francisdb commented Jan 31, 2019

Currently string escaping is not implemented as can be seen in the example below

> "\""

master>
Token {payload = Err (TextLiteralMissingClosingQuote "\n\n"), start = Pos 25 6, end = Pos 25 6} :| []
/Users/francisdb/workspace/unison/unison-src/json.u:25:6:
unexpected TextLiteralMissingClosingQuote "\n\n"
   25 | > "\""

What needs to be escaped? (", , unicode, tab, newline, ...)
Any example lexer that implements that?

to fix in Lexer.hs

@noahhaasis
Copy link
Member

noahhaasis commented Feb 6, 2019

I implementing string escaping like in Haskell
\0 | U+0000 | null character
\a | U+0007 | alert
\b | U+0008 | backspace
\f | U+000C | form feed
\n | U+000A | newline (line feed)
\r | U+000D | carriage return
\t | U+0009 | horizontal tab
\v | U+000B | vertical tab
\" | U+0022 | double quote
\' | U+0027 | single quote

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants