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

[Bug] Cannot escape backslash in string literal, if it is the last character #267

Closed
mks-h opened this issue Jul 4, 2024 · 1 comment · Fixed by #283
Closed

[Bug] Cannot escape backslash in string literal, if it is the last character #267

mks-h opened this issue Jul 4, 2024 · 1 comment · Fixed by #283
Assignees
Labels
bug Something isn't working

Comments

@mks-h
Copy link
Member

mks-h commented Jul 4, 2024

Trying to print \ as the last character in a string literal, but compiler errors out with "Unclosed string literal".

This happens when I try to escape backslash with another backslash, no matter how many times. All of the following commands will fail to compile:

echo "Hi \\"
echo "Hi \\\"
echo "Hi \\\\"

But if you close them with another double quote, then it ignores the first quote, but starts another multiline string with the second one, and does something weird:

echo "Hi \\""
echo "Hi \\\""
echo "Hi \\\\""

Result:

Hi \
echo Hi \
Hi \"
@Mte90 Mte90 added the bug Something isn't working label Jul 4, 2024
@Ph0enixKM
Copy link
Member

Duplicate of amber-lang/heraclitus#48

@Ph0enixKM Ph0enixKM marked this as a duplicate of amber-lang/heraclitus#48 Jul 4, 2024
@Ph0enixKM Ph0enixKM self-assigned this Jul 7, 2024
@Ph0enixKM Ph0enixKM linked a pull request Jul 7, 2024 that will close this issue
@Ph0enixKM Ph0enixKM changed the title Cannot escape backslash in string literal, if it is the last character [Bug] Cannot escape backslash in string literal, if it is the last character Jul 7, 2024
@Mte90 Mte90 closed this as completed in #283 Jul 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants