Skip to content

Commit a2d7c41

Browse files
committed
update mappings of control flow keywords
All control flow keywords are now mapped to either Keyword, Statement or Conditional. Previously some of them would be mapped to Special, PreProc or Macro. As a reference I used the builtin syntax highlighting from neovim for the following languages that have similar control flow keywords to Zig: - Rust: - Keyword: return break continue - Conditional: match if else - Repeat: loop while (actually maps to Conditional) - C - Statement: goto break return continue asm - Conditional: if else switch - Repeat: while for do - C#: Conditional, Repeat - Conditional: else if switch - Repeat: break continue do for foreach goto return while - JS - Statement: return with await yield - Conditional: if else switch break continue - Repeat: while for do in of - Go - Statement: defer go goto return break continue fallthrough - Conditional: if else switch select - Repeat: for range - Zig (old) - Macro: defer errdefer - PreProc: asm - Special: return break continue - Conditional: if else switch - Repeat: while for - Keyword: and or orelse - Zig (new) - Statement: return break continue asm defer errdefer and or orelse - Conditional: if else switch - Repeat: while for The try and catch keywords will be adjusted in a future commit.
1 parent c8dec45 commit a2d7c41

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

syntax/zig.vim

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,9 @@ syntax keyword zigException error
2525
syntax keyword zigStorageClass
2626
syntax keyword zigDummyVariable _
2727
syntax keyword zigKeyword var const fn try test pub comptime
28-
syntax keyword zigExecution return break continue
29-
syntax keyword zigMacro defer errdefer nosuspend suspend resume export extern
30-
syntax keyword zigPreProc addrspace align asm callconv catch inline noalias noinline threadlocal
28+
syntax keyword zigStatement return break continue asm defer errdefer
29+
syntax keyword zigMacro nosuspend suspend resume export extern
30+
syntax keyword zigPreProc addrspace align callconv catch inline noalias noinline threadlocal
3131
syntax keyword zigBuiltinFn @addrSpaceCast @addWithOverflow @alignCast @alignOf @as @atomicLoad @atomicRmw @atomicStore @bitCast @bitOffsetOf @bitSizeOf @branchHint @breakpoint @mulAdd @byteSwap @bitReverse @offsetOf @call @cDefine @cImport @cInclude @clz @cmpxchgStrong @cmpxchgWeak @compileError @compileLog @constCast @ctz @cUndef @cVaArg @cVaCopy @cVaEnd @cVaStart @disableInstrumentation @disableIntrinsics @divExact @divFloor @divTrunc @embedFile @enumFromInt @errorFromInt @errorName @errorReturnTrace @errorCast @export @extern @field @fieldParentPtr @FieldType @floatCast @floatFromInt @frameAddress @hasDecl @hasField @import @inComptime @intCast @intFromBool @intFromEnum @intFromError @intFromFloat @intFromPtr @max @memcpy @memmove @memset @min @wasmMemorySize @wasmMemoryGrow @mod @mulWithOverflow @panic @popCount @prefetch @ptrCast @ptrFromInt @rem @returnAddress @select @setEvalBranchQuota @setFloatMode @setRuntimeSafety @shlExact @shlWithOverflow @shrExact @shuffle @sizeOf @splat @reduce @src @sqrt @sin @cos @tan @exp @exp2 @log @log2 @log10 @abs @floor @ceil @trunc @round @subWithOverflow @tagName @This @trap @truncate @Type @typeInfo @typeName @TypeOf @unionInit @Vector @volatileCast @workGroupId @workGroupSize @workItemId
3232

3333
syntax match zigType "\v<[iu][1-9]\d*>"
@@ -91,10 +91,10 @@ highlight default link zigNumber Number
9191
highlight default link zigArrowCharacter zigOperator
9292
highlight default link zigOperator Operator
9393
highlight default link zigStructure Structure
94-
highlight default link zigExecution Special
9594
highlight default link zigMacro Macro
95+
highlight default link zigStatement Statement
9696
highlight default link zigConditional Conditional
97-
highlight default link zigComparatorWord Keyword
97+
highlight default link zigComparatorWord zigStatement
9898
highlight default link zigRepeat Repeat
9999
highlight default link zigSpecial Special
100100
highlight default link zigPreProc PreProc

0 commit comments

Comments
 (0)