zigtools / zls

A Zig language server supporting Zig developers with features like autocomplete and goto definition
MIT License
3.04k stars 298 forks source link

Vertical tab escape sequence considerd not valid. #2044

Closed jfalcon closed 1 month ago

jfalcon commented 1 month ago

Zig Version

0.13.0

ZLS Version

0.13.0

Client / Code Editor / Extensions

VS Code with Zig Language Extension (ziglang.vscode-zig)

Steps to Reproduce and Observed Behavior

In VS Code, create or open any file with a .zig extension and type the following:

const whitespace = [_]u8{ ' ', '\t', '\v', '\n', '\r' };

There's an error for '\v'.

Expected Behavior

The escape sequence for a vertical tab (\v) should be considered valid as it's still used in some systems rather than a new line, etc.

Relevant log output

n/a
Techatrix commented 1 month ago

The escape sequence \v is not valid according to the Zig grammer. It is therefore rejected by the compiler (and ZLS).

$ cat sample.zig
const whitespace = [_]u8{ ' ', '\t', '\v', '\n', '\r' };
$ zig ast-check sample.zig
sample.zig:1:40: error: invalid escape character: 'v'
const whitespace = [_]u8{ ' ', '\t', '\v', '\n', '\r' };

Any proposal to change this need to be directed at Zig and not ZLS.