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

Zig: Use standard char token #3264

Merged
merged 1 commit into from Dec 9, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
14 changes: 7 additions & 7 deletions components/prism-zig.js
Expand Up @@ -49,14 +49,14 @@
pattern: /([\r\n])([ \t]+c?\\{2}).*(?:(?:\r\n?|\n)\2.*)*/,
lookbehind: true,
greedy: true
},
{
// characters 'a', '\n', '\xFF', '\u{10FFFF}'
pattern: /(^|[^\\])'(?:[^'\\\r\n]|[\uD800-\uDFFF]{2}|\\(?:.|x[a-fA-F\d]{2}|u\{[a-fA-F\d]{1,6}\}))'/,
lookbehind: true,
greedy: true
}
],
'char': {
// characters 'a', '\n', '\xFF', '\u{10FFFF}'
pattern: /(^|[^\\])'(?:[^'\\\r\n]|[\uD800-\uDFFF]{2}|\\(?:.|x[a-fA-F\d]{2}|u\{[a-fA-F\d]{1,6}\}))'/,
lookbehind: true,
greedy: true
},
'builtin': /\B@(?!\d)\w+(?=\s*\()/,
'label': {
pattern: /(\b(?:break|continue)\s*:\s*)\w+\b|\b(?!\d)\w+\b(?=\s*:\s*(?:\{|while\b))/,
Expand All @@ -80,7 +80,7 @@
inside: null // see below
}
],
'builtin-types': {
'builtin-type': {
pattern: /\b(?:anyerror|bool|c_u?(?:int|long|longlong|short)|c_longdouble|c_void|comptime_(?:float|int)|f(?:16|32|64|128)|[iu](?:8|16|32|64|128|size)|noreturn|type|void)\b/,
alias: 'keyword'
},
Expand Down
2 changes: 1 addition & 1 deletion components/prism-zig.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

75 changes: 75 additions & 0 deletions tests/languages/zig/builtin-type_feature.test
@@ -0,0 +1,75 @@
i8
u8
i16
u16
i32
u32
i64
u64
i128
u128
isize
usize
c_short
c_ushort
c_int
c_uint
c_long
c_ulong
c_longlong
c_ulonglong
c_longdouble
c_void
f16
f32
f64
f128
bool
void
noreturn
type
anyerror
comptime_int
comptime_float

----------------------------------------------------

[
["builtin-type", "i8"],
["builtin-type", "u8"],
["builtin-type", "i16"],
["builtin-type", "u16"],
["builtin-type", "i32"],
["builtin-type", "u32"],
["builtin-type", "i64"],
["builtin-type", "u64"],
["builtin-type", "i128"],
["builtin-type", "u128"],
["builtin-type", "isize"],
["builtin-type", "usize"],
["builtin-type", "c_short"],
["builtin-type", "c_ushort"],
["builtin-type", "c_int"],
["builtin-type", "c_uint"],
["builtin-type", "c_long"],
["builtin-type", "c_ulong"],
["builtin-type", "c_longlong"],
["builtin-type", "c_ulonglong"],
["builtin-type", "c_longdouble"],
["builtin-type", "c_void"],
["builtin-type", "f16"],
["builtin-type", "f32"],
["builtin-type", "f64"],
["builtin-type", "f128"],
["builtin-type", "bool"],
["builtin-type", "void"],
["builtin-type", "noreturn"],
["builtin-type", "type"],
["builtin-type", "anyerror"],
["builtin-type", "comptime_int"],
["builtin-type", "comptime_float"]
]

----------------------------------------------------

Checks for builtin types.
75 changes: 0 additions & 75 deletions tests/languages/zig/builtin-types_feature.test

This file was deleted.