zig: highlight escapes in strings, update to 0.7.0
This commit is contained in:
parent
14f7d2637c
commit
698b028f83
|
@ -36,18 +36,24 @@ provide-module zig %§
|
||||||
add-highlighter shared/zig regions
|
add-highlighter shared/zig regions
|
||||||
add-highlighter shared/zig/code default-region group
|
add-highlighter shared/zig/code default-region group
|
||||||
|
|
||||||
add-highlighter shared/zig/doc_comment region '///[^/]' '$' fill documentation
|
add-highlighter shared/zig/doc_comment region '///[^/]' '$' fill documentation
|
||||||
add-highlighter shared/zig/comment region '//' '$' fill comment
|
add-highlighter shared/zig/comment region '//' '$' fill comment
|
||||||
|
|
||||||
# TODO: highlight escape sequences within strings
|
# strings and characters
|
||||||
add-highlighter shared/zig/string_double region '"' (?<!\\)(\\\\)*" fill string
|
add-highlighter shared/zig/string region '"' (?<!\\)(\\\\)*" group
|
||||||
add-highlighter shared/zig/string_single region "'" (?<!\\)(\\\\)*' fill string
|
add-highlighter shared/zig/string/ fill string
|
||||||
add-highlighter shared/zig/string_multiline region '\\\\' '$' fill string
|
add-highlighter shared/zig/string/ regex '(?:\\n|\\r|\\t|\\\\|\\''|\\"|\\x[0-9a-fA-F]{2}|\\u\{[0-9a-fA-F]+\})' 0:meta
|
||||||
|
|
||||||
|
add-highlighter shared/zig/character region "'" (?<!\\)(\\\\)*' group
|
||||||
|
add-highlighter shared/zig/character/ fill string
|
||||||
|
add-highlighter shared/zig/character/ regex '(?:\\n|\\r|\\t|\\\\|\\''|\\"|\\x[0-9a-fA-F]{2}|\\u\{[0-9a-fA-F]+\})' 0:meta
|
||||||
|
|
||||||
|
add-highlighter shared/zig/multiline_string region '\\\\' '$' fill string
|
||||||
|
|
||||||
# attributes
|
# attributes
|
||||||
add-highlighter shared/zig/code/ regex '\b(?:const|var|extern|packed|export|pub|noalias|inline|noinline|comptime|callconv|volatile|allowzero|align|linksection|threadlocal)\b' 0:attribute
|
add-highlighter shared/zig/code/ regex '\b(?:const|var|extern|packed|export|pub|noalias|inline|noinline|comptime|callconv|volatile|allowzero|align|linksection|threadlocal)\b' 0:attribute
|
||||||
# structures
|
# structures
|
||||||
add-highlighter shared/zig/code/ regex '\b(?:struct|enum|union|error)\b' 0:attribute
|
add-highlighter shared/zig/code/ regex '\b(?:struct|enum|union|error|opaque)\b' 0:attribute
|
||||||
|
|
||||||
# statement
|
# statement
|
||||||
add-highlighter shared/zig/code/ regex '\b(?:break|return|continue|asm|defer|errdefer|unreachable|try|catch|async|noasync|await|suspend|resume)\b' 0:keyword
|
add-highlighter shared/zig/code/ regex '\b(?:break|return|continue|asm|defer|errdefer|unreachable|try|catch|async|noasync|await|suspend|resume)\b' 0:keyword
|
||||||
|
@ -59,7 +65,7 @@ add-highlighter shared/zig/code/ regex '\b(?:while|for)\b' 0:keyword
|
||||||
add-highlighter shared/zig/code/ regex '\b(?:fn|usingnamespace|test)\b' 0:keyword
|
add-highlighter shared/zig/code/ regex '\b(?:fn|usingnamespace|test)\b' 0:keyword
|
||||||
|
|
||||||
# types
|
# types
|
||||||
add-highlighter shared/zig/code/ regex '\b(?:bool|f16|f32|f64|f128|void|noreturn|type|anyerror|anyframe)\b' 0:type
|
add-highlighter shared/zig/code/ regex '\b(?:bool|f16|f32|f64|f128|void|noreturn|type|anyerror|anyframe|anytype)\b' 0:type
|
||||||
add-highlighter shared/zig/code/ regex '\b(?:i0|u0|isize||usize|comptime_int|comptime_float)\b' 0:type
|
add-highlighter shared/zig/code/ regex '\b(?:i0|u0|isize||usize|comptime_int|comptime_float)\b' 0:type
|
||||||
add-highlighter shared/zig/code/ regex '\b(?:[iu][1-9]\d*)\b' 0:type
|
add-highlighter shared/zig/code/ regex '\b(?:[iu][1-9]\d*)\b' 0:type
|
||||||
add-highlighter shared/zig/code/ regex '\b(?:c_short|c_ushort|c_int|c_uint|c_long|c_ulong|c_longlong|c_ulonglong|c_longdouble|c_void)\b' 0:type
|
add-highlighter shared/zig/code/ regex '\b(?:c_short|c_ushort|c_int|c_uint|c_long|c_ulong|c_longlong|c_ulonglong|c_longdouble|c_void)\b' 0:type
|
||||||
|
@ -83,23 +89,7 @@ add-highlighter shared/zig/code/ regex '\b0x[0-9a-fA-F]+\.?[eE][-+]?[0-9a-fA-F]+
|
||||||
add-highlighter shared/zig/code/ regex '(?:\+|-|\*|/|%|=|<|>|&|\||\^|~|\?|!)' 0:operator
|
add-highlighter shared/zig/code/ regex '(?:\+|-|\*|/|%|=|<|>|&|\||\^|~|\?|!)' 0:operator
|
||||||
|
|
||||||
# builtin functions
|
# builtin functions
|
||||||
add-highlighter shared/zig/code/ regex "@(?:addWithOverflow|ArgType|atomicLoad|atomicStore|bitCast|breakpoint)\b" 0:function
|
add-highlighter shared/zig/code/ regex "@(?:addWithOverflow|alignCast|alignOf|as|asyncCall|atomicLoad|atomicRmw|atomicStore|bitCast|bitOffsetOf|boolToInt|bitSizeOf|breakpoint|mulAdd|byteSwap|bitReverse|byteOffsetOf|call|cDefine|cImport|cInclude|clz|cmpxchgStrong|cmpxchgWeak|compileError|compileLog|ctz|cUndef|divExact|divFloor|divTrunc|embedFile|enumToInt|errorName|errorReturnTrace|errorToInt|errSetCast|export|fence|field|fieldParentPtr|floatCast|floatToInt|frame|Frame|frameAddress|frameSize|hasDecl|hasField|import|intCast|intToEnum|intToError|intToFloat|intToPtr|memcpy|memset|wasmMemorySize|wasmMemoryGrow|mod|mulWithOverflow|panic|popCount|ptrCast|ptrToInt|rem|returnAddress|setAlignStack|setCold|setEvalBranchQuota|setFloatMode|setRuntimeSafety|shlExact|shlWithOverflow|shrExact|shuffle|sizeOf|splat|reduce|src|sqrt|sin|cos|exp|exp2|log|log2|log10|fabs|floor|ceil|trunc|round|subWithOverflow|tagName|TagType|This|truncate|Type|typeInfo|typeName|TypeOf|unionInit)\b" 0:function
|
||||||
add-highlighter shared/zig/code/ regex "@(?:alignCast|alignOf|cDefine|cImport|cInclude)\b" 0:function
|
|
||||||
add-highlighter shared/zig/code/ regex "@(?:cUndef|canImplicitCast|clz|cmpxchgWeak|cmpxchgStrong|compileError)\b" 0:function
|
|
||||||
add-highlighter shared/zig/code/ regex "@(?:compileLog|ctz|popCount|divExact|divFloor|divTrunc)\b" 0:function
|
|
||||||
add-highlighter shared/zig/code/ regex "@(?:embedFile|export|tagName|TagType|errorName|call)\b" 0:function
|
|
||||||
add-highlighter shared/zig/code/ regex "@(?:errorReturnTrace|fence|fieldParentPtr|field|unionInit)\b" 0:function
|
|
||||||
add-highlighter shared/zig/code/ regex "@(?:frameAddress|import|newStackCall|asyncCall|intToPtr|IntType)\b" 0:function
|
|
||||||
add-highlighter shared/zig/code/ regex "@(?:memberCount|memberName|memberType|as)\b" 0:function
|
|
||||||
add-highlighter shared/zig/code/ regex "@(?:memcpy|memset|mod|mulWithOverflow|splat)\b" 0:function
|
|
||||||
add-highlighter shared/zig/code/ regex "@(?:bitOffsetOf|byteOffsetOf|OpaqueType|panic|ptrCast)\b" 0:function
|
|
||||||
add-highlighter shared/zig/code/ regex "@(?:ptrToInt|rem|returnAddress|setCold|Type|shuffle)\b" 0:function
|
|
||||||
add-highlighter shared/zig/code/ regex "@(?:setRuntimeSafety|setEvalBranchQuota|setFloatMode)\b" 0:function
|
|
||||||
add-highlighter shared/zig/code/ regex "@(?:setGlobalLinkage|setGlobalSection|shlExact|This|hasDecl|hasField)\b" 0:function
|
|
||||||
add-highlighter shared/zig/code/ regex "@(?:shlWithOverflow|shrExact|sizeOf|bitSizeOf|sqrt|byteSwap|subWithOverflow|intCast|floatCast|intToFloat|floatToInt|boolToInt|errSetCast)\b" 0:function
|
|
||||||
add-highlighter shared/zig/code/ regex "@(?:truncate|typeId|typeInfo|typeName|TypeOf|atomicRmw|bytesToSlice|sliceToBytes)\b" 0:function
|
|
||||||
add-highlighter shared/zig/code/ regex "@(?:intToError|errorToInt|intToEnum|enumToInt|setAlignStack|frame|Frame|frameSize|bitReverse|Vector)\b" 0:function
|
|
||||||
add-highlighter shared/zig/code/ regex "@(?:sin|cos|exp|exp2|log|log2|log10|fabs|floor|ceil|trunc|round)\b" 0:function
|
|
||||||
|
|
||||||
# Commands
|
# Commands
|
||||||
# ‾‾‾‾‾‾‾‾
|
# ‾‾‾‾‾‾‾‾
|
||||||
|
|
Loading…
Reference in New Issue
Block a user