Skip to content
This repository was archived by the owner on Nov 26, 2025. It is now read-only.

Update the Unicode escape syntax#87

Closed
perillo wants to merge 1 commit intoziglang:masterfrom
perillo:update-unicode-escapes
Closed

Update the Unicode escape syntax#87
perillo wants to merge 1 commit intoziglang:masterfrom
perillo:update-unicode-escapes

Conversation

@perillo
Copy link
Contributor

@perillo perillo commented Jan 26, 2023

Update the old invalid legacy syntax to the new one.

Update the old invalid legacy syntax to the new one.
@perillo
Copy link
Contributor Author

perillo commented Jan 26, 2023

See also the pending #80, where the same issue is fixed in 03d19a6.

@Techatrix
Copy link
Collaborator

According to the current Zig grammar, escape sequences like \u{0FFFFFF} are valid so this change isn't quite right. I fixed this issue in 0c10086

@Techatrix Techatrix closed this Sep 11, 2025
@perillo
Copy link
Contributor Author

perillo commented Sep 12, 2025

@Techatrix, thanks.

@perillo
Copy link
Contributor Author

perillo commented Sep 12, 2025

About the escape sequence, https://ziglang.org/documentation/master/#Escape-Sequences says that the unicode escape sequence is u{\x\{6}, while the current code is u{\x\+}.

@Techatrix
Copy link
Collaborator

This is what the language reference documents:

... ...
\xNN hexadecimal 8-bit byte value (2 digits)
\u{NNNNNN} hexadecimal Unicode scalar value UTF-8 encoded (1 or more digits)

It says 1 or more digits and not exactly six. The \u{NNNNNN} is just an example. The actual reference for how the Zig syntax looks like is the grammar in the language reference and on ziglang/zig-spec. See ziglang/zig#2823

@perillo
Copy link
Contributor Author

perillo commented Sep 13, 2025

@Techatrix, indeed, const string = "\u{FFFFFF}"; is a compiler error.

This means that the https://ziglang.org/documentation/master/#Escape-Sequences should be updated.

I also noted that the Zig Language reference uses code point while the Zig grammar uses char.

Thanks.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants