Skip to content

Commit c3f9fb7

Browse files
Zig: Use standard char token (#3264)
1 parent a5b6c5e commit c3f9fb7

7 files changed

+182
-132
lines changed

components/prism-zig.js

+7-7
Original file line numberDiff line numberDiff line change
@@ -49,14 +49,14 @@
4949
pattern: /([\r\n])([ \t]+c?\\{2}).*(?:(?:\r\n?|\n)\2.*)*/,
5050
lookbehind: true,
5151
greedy: true
52-
},
53-
{
54-
// characters 'a', '\n', '\xFF', '\u{10FFFF}'
55-
pattern: /(^|[^\\])'(?:[^'\\\r\n]|[\uD800-\uDFFF]{2}|\\(?:.|x[a-fA-F\d]{2}|u\{[a-fA-F\d]{1,6}\}))'/,
56-
lookbehind: true,
57-
greedy: true
5852
}
5953
],
54+
'char': {
55+
// characters 'a', '\n', '\xFF', '\u{10FFFF}'
56+
pattern: /(^|[^\\])'(?:[^'\\\r\n]|[\uD800-\uDFFF]{2}|\\(?:.|x[a-fA-F\d]{2}|u\{[a-fA-F\d]{1,6}\}))'/,
57+
lookbehind: true,
58+
greedy: true
59+
},
6060
'builtin': /\B@(?!\d)\w+(?=\s*\()/,
6161
'label': {
6262
pattern: /(\b(?:break|continue)\s*:\s*)\w+\b|\b(?!\d)\w+\b(?=\s*:\s*(?:\{|while\b))/,
@@ -80,7 +80,7 @@
8080
inside: null // see below
8181
}
8282
],
83-
'builtin-types': {
83+
'builtin-type': {
8484
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/,
8585
alias: 'keyword'
8686
},

components/prism-zig.min.js

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
i8
2+
u8
3+
i16
4+
u16
5+
i32
6+
u32
7+
i64
8+
u64
9+
i128
10+
u128
11+
isize
12+
usize
13+
c_short
14+
c_ushort
15+
c_int
16+
c_uint
17+
c_long
18+
c_ulong
19+
c_longlong
20+
c_ulonglong
21+
c_longdouble
22+
c_void
23+
f16
24+
f32
25+
f64
26+
f128
27+
bool
28+
void
29+
noreturn
30+
type
31+
anyerror
32+
comptime_int
33+
comptime_float
34+
35+
----------------------------------------------------
36+
37+
[
38+
["builtin-type", "i8"],
39+
["builtin-type", "u8"],
40+
["builtin-type", "i16"],
41+
["builtin-type", "u16"],
42+
["builtin-type", "i32"],
43+
["builtin-type", "u32"],
44+
["builtin-type", "i64"],
45+
["builtin-type", "u64"],
46+
["builtin-type", "i128"],
47+
["builtin-type", "u128"],
48+
["builtin-type", "isize"],
49+
["builtin-type", "usize"],
50+
["builtin-type", "c_short"],
51+
["builtin-type", "c_ushort"],
52+
["builtin-type", "c_int"],
53+
["builtin-type", "c_uint"],
54+
["builtin-type", "c_long"],
55+
["builtin-type", "c_ulong"],
56+
["builtin-type", "c_longlong"],
57+
["builtin-type", "c_ulonglong"],
58+
["builtin-type", "c_longdouble"],
59+
["builtin-type", "c_void"],
60+
["builtin-type", "f16"],
61+
["builtin-type", "f32"],
62+
["builtin-type", "f64"],
63+
["builtin-type", "f128"],
64+
["builtin-type", "bool"],
65+
["builtin-type", "void"],
66+
["builtin-type", "noreturn"],
67+
["builtin-type", "type"],
68+
["builtin-type", "anyerror"],
69+
["builtin-type", "comptime_int"],
70+
["builtin-type", "comptime_float"]
71+
]
72+
73+
----------------------------------------------------
74+
75+
Checks for builtin types.

tests/languages/zig/builtin-types_feature.test

-75
This file was deleted.

0 commit comments

Comments
 (0)