-
Notifications
You must be signed in to change notification settings - Fork 33
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
add escape sequences in character strings #38
Conversation
Standard escape sequences (those used in java) and ability to write bytes directly (\xbb).
I’m inclined to merge this as it seems useful, but it does change the behavior of the assembler a bit (e.g. for |
Unterminated |
Hi. Thanks! Yes, I think escape seqs support is a useful feature. Maybe a suggestion not to break the compatibility to any previous assembly code relying on not-escaped strings, a support could be added using two variants:
You should also probably refactor the actual escaped string parsing (the for loop and big switch) out into a separate function. Maybe add it to the Lexer class, e.g., readEscapedString(char terminator), where terminator is " (double quite as suggested above). |
Could I then terminate it with zero byte like C strings, or should I leave users the choice to manually add zero byte if desired? |
I guess user should take care for the zero byte terminator if needed. This is still an assembly, don't be too friendly :) |
To avoid breaking backwards compatibility, escaped strings need to be enclosed in double quotes. Moved code for lexing to Lexer.
Yes, I guess that's it! Thanks!!! |
Standard escape sequences (those used in java) and ability to write bytes directly (\xbb).