-
Notifications
You must be signed in to change notification settings - Fork 5
Open
Description
Describe the bug
When using invalid escape sequences inside string or character literals, Zura Lang either fails to report an error properly or crashes.
To reproduce
Steps to reproduce the behavior:
- Create two separate files
strings.zuandchars.zuwith the following contents:
const main := fn () int! {
have x: str = "Hello\xZ";
return 0;
};
const main := fn () int! {
have x: char = '\q';
return 0;
};
- Run the command:
./debug/zura build zura_files/main.zu- Observe the behavior:
- No error is reported for the invalid escape sequence in the string literal "Hello\xZ".
- The invalid escape in the character literal '\q' produces an error message, but then the compiler crashes with a segmentation fault.
Expected behavior
- The compiler should report invalid escape sequence errors for both string and character literals.
- The compiler should not crash when encountering invalid characters.
- Error messages should point to the exact location in the source file. Example:
chars.zu:2:23: Lexer error: Invalid escape sequence in character literal '\q'
strings.zu:2:18: Lexer error: Invalid escape sequence in string literal "Hello\xZ"
screenshots
Additional context
- Zura Lang version: v0.1.46
- This issue affects any invalid escape sequences (\x with non-hex digits, unsupported letters, etc.) in both strings and character literals.
Metadata
Metadata
Assignees
Labels
No labels