1syntax .zig-esc
2
3# TODO: \xNN  \uNNNN  \UNNNNNN
4state esc special
5    char "nrt'\\\"" END special
6    noeat END
7
8syntax .zig-string
9
10state string
11    char '"' END string
12    char "\n" END error
13    char "\\" .zig-esc:this
14    eat this
15
16syntax zig
17
18state start code
19    char -b iu maybe-int-type
20    char -b a-z_@ ident
21    char -b A-Z ident-upper
22#    char 0 zero
23#    char 1-9 dec
24    char \" .zig-string:this
25#    char \' .c-char:this
26    str '//' comment
27    eat this
28
29state ident
30    char -b a-zA-Z0-9_ this
31    inlist keyword start
32    inlist type start
33    inlist constant start
34    inlist builtin start
35    noeat start
36
37state ident-upper ident
38    char -b a-z class-name
39    char -b A-Z0-9_ ident
40    noeat start
41
42state class-name
43    recolor class-name
44    char a-zA-Z0-9_ this
45    noeat start
46
47state maybe-int-type type
48    char 1-9 int-type
49    recolor ident 1
50    noeat -b ident
51
52state int-type type
53    char 0-9 this
54    noeat start
55
56state comment
57    char "\n" start
58    eat this
59
60list keyword \
61    align allowzero and asm async await break cancel catch comptime \
62    const continue defer else enum errdefer error export extern fn \
63    for if inline linksection nakedcc noalias or orelse packed pub \
64    resume return stdcallcc struct suspend switch test threadlocal \
65    try union unreachable usingnamespace var volatile while
66
67list type \
68    bool f16 f32 f64 f128 void noreturn type anyerror promise \
69    i0 u0 isize usize comptime_int comptime_float \
70    c_short c_ushort c_int c_uint c_long c_ulong c_longlong \
71    c_ulonglong c_longdouble c_void
72
73list constant \
74    null undefined true false
75
76list builtin \
77    @ArgType @IntType @OpaqueType @TagType @This @Vector \
78    @addWithOverflow @alignCast @alignOf @atomicLoad @atomicRmw \
79    @bitCast @bitOffsetOf @bitReverse @boolToInt @breakpoint \
80    @byteOffsetOf @byteSwap @bytesToSlice @cDefine @cImport \
81    @cInclude @cUndef @ceil @clz @cmpxchgStrong @cmpxchgWeak \
82    @compileError @compileLog @cos @ctz @divExact @divFloor \
83    @divTrunc @embedFile @enumToInt @errSetCast @errorName \
84    @errorReturnTrace @errorToInt @exp @exp2 @export @fabs \
85    @fence @field @fieldParentPtr @floatCast @floatToInt @floor \
86    @frameAddress @handle @hasDecl @import @inlineCall @intCast \
87    @intToEnum @intToError @intToFloat @intToPtr @ln @log10 @log2 \
88    @memberCount @memberName @memberType @memcpy @memset @mod \
89    @mulAdd @mulWithOverflow @newStackCall @noInlineCall @panic \
90    @popCount @ptrCast @ptrToInt @rem @returnAddress @round \
91    @setAlignStack @setCold @setEvalBranchQuota @setFloatMode \
92    @setRuntimeSafety @shlExact @shlWithOverflow @shrExact @sin \
93    @sizeOf @sliceToBytes @sqrt @subWithOverflow @tagName @trunc \
94    @truncate @typeId @typeInfo @typeName @typeOf
95