Skip to content

Commit 6625198

Browse files
committed
split ints and floats and changed use to usingnamespace
1 parent 3726f40 commit 6625198

File tree

3 files changed

+30
-7
lines changed

3 files changed

+30
-7
lines changed

Zig.YAML-tmLanguage

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ patterns:
1515
- include: '#keyword'
1616
- include: '#type'
1717
- include: '#type-int'
18+
- include: '#type-float'
1819
- include: '#type-c'
1920
- include: '#boolean'
2021
- include: '#operator'
@@ -62,17 +63,21 @@ repository:
6263
name: constant.language.zig
6364

6465
keyword:
65-
match: '(?<!\w)(fn|use|test|@[^\"\d][a-zA-Z_]\w*)\b'
66+
match: '(?<!\w)(fn|usingnamespace|test|@[^\"\d][a-zA-Z_]\w*)\b'
6667
name: support.function.zig
6768

6869
type:
69-
match: '\b(bool|f16|f32|f64|f128|comptime_float|void|noreturn|type|anyerror|promise)\b'
70+
match: '\b(bool|void|noreturn|type|anyerror|promise)\b'
7071
name: storage.type.zig
7172

7273
type-int:
73-
match: '\b(?<!\.)([iu][1-9]\d*|i0|u0|isize|usize|comptime_int)\b'
74+
match: '\b(?<!\.)([iu][0-9]\d*|[iu]size|comptime_int)\b'
7475
name: storage.type.zig.integer
7576

77+
type-float:
78+
match: '\b(f16|f32|f64|f128|comptime_float)\b'
79+
name: storage.type.zig.float
80+
7681
type-c:
7782
match: '\b(c_short|c_ushort|c_int|c_uint|c_long|c_ulong|c_longlong|c_ulonglong|c_longdouble|c_void)\b'
7883
name: storage.type.zig.c_compat

Zig.tmLanguage

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,10 @@
5454
<key>include</key>
5555
<string>#type-int</string>
5656
</dict>
57+
<dict>
58+
<key>include</key>
59+
<string>#type-float</string>
60+
</dict>
5761
<dict>
5862
<key>include</key>
5963
<string>#type-c</string>
@@ -294,7 +298,7 @@
294298
<key>keyword</key>
295299
<dict>
296300
<key>match</key>
297-
<string>(?&lt;!\w)(fn|use|test|@[^\"\d][a-zA-Z_]\w*)\b</string>
301+
<string>(?&lt;!\w)(fn|usingnamespace|test|@[^\"\d][a-zA-Z_]\w*)\b</string>
298302
<key>name</key>
299303
<string>support.function.zig</string>
300304
</dict>
@@ -410,7 +414,7 @@
410414
<key>type</key>
411415
<dict>
412416
<key>match</key>
413-
<string>\b(bool|f16|f32|f64|f128|comptime_float|void|noreturn|type|anyerror|promise)\b</string>
417+
<string>\b(bool|void|noreturn|type|anyerror|promise)\b</string>
414418
<key>name</key>
415419
<string>storage.type.zig</string>
416420
</dict>
@@ -421,10 +425,17 @@
421425
<key>name</key>
422426
<string>storage.type.zig.c_compat</string>
423427
</dict>
428+
<key>type-float</key>
429+
<dict>
430+
<key>match</key>
431+
<string>\b(f16|f32|f64|f128|comptime_float)\b</string>
432+
<key>name</key>
433+
<string>storage.type.zig.float</string>
434+
</dict>
424435
<key>type-int</key>
425436
<dict>
426437
<key>match</key>
427-
<string>\b([iu][1-9]\d*|i0|u0|isize|usize|comptime_int)\b</string>
438+
<string>\b(?&lt;!\.)([iu][0-9]\d*|[iu]size|comptime_int)\b</string>
428439
<key>name</key>
429440
<string>storage.type.zig.integer</string>
430441
</dict>

samples.zig

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,16 @@ while for
1818

1919
null undefined
2020

21-
fn use test
21+
fn usingnamespace test
2222

2323
bool f16 f32 f64 f128 void noreturn type anyerror
2424

2525
promise
2626

2727
i2 u2 i3 u3 i4 u4 i5 u5 i6 u6 i7 u7 i8 u8 i16 u16 u29 i29 i32 u32 i64 u64 i128 u128 isize usize
2828

29+
.i368 .i686 .i23
30+
2931
c_short c_ushort c_int c_uint c_long c_ulong c_longlong c_ulonglong c_longdouble c_void
3032

3133
true false
@@ -50,6 +52,8 @@ and or
5052

5153
0b1
5254

55+
123.i812
56+
5357
/// TODO blah blah
5458
// TODO blah blah
5559

@@ -70,6 +74,9 @@ extern fn barfoo();
7074
"\"hello\""
7175
'\''
7276
'\a'
77+
78+
@"overloaded"
79+
7380
@addWithOverflow
7481
@alignCast
7582
@alignOf

0 commit comments

Comments
 (0)