{ "name": "Zig", "scopeName": "source.zig", "patterns": [ { "include": "#storage" }, { "include": "#support" }, { "include": "#structure" }, { "include": "#statement" }, { "include": "#async-control" }, { "include": "#conditional" }, { "include": "#repeat" }, { "include": "#constant" }, { "include": "#keyword" }, { "include": "#type" }, { "include": "#type-int" }, { "include": "#type-c" }, { "include": "#boolean" }, { "include": "#operator" }, { "include": "#dec-float-number" }, { "include": "#hex-float-number" }, { "include": "#dec-number" }, { "include": "#hex-number" }, { "include": "#oct-number" }, { "include": "#bin-number" }, { "include": "#character" }, { "include": "#operators" }, { "include": "#comment-line" }, { "include": "#comment-line-doc" }, { "include": "#strings" }, { "include": "#multiline-strings" }, { "include": "#escaped_char" } ], "repository": { "async-control": { "name": "keyword.control.async.zig", "match": "\\b(async|await|suspend|resume|cancel)\\b" }, "bin-number": { "name": "constant.numeric.bin.zig", "match": "0b[01]+" }, "boolean": { "name": "constant.language.zig", "match": "\\b(true|false)\\b" }, "character": { "name": "string.quoted.double.zig", "begin": "(\\')", "end": "\\'", "patterns": [ { "include": "#escaped_char" }, { "name": "invalid.illegal.character.zig", "match": "(\\\\[^\\'][^\\']*?)" } ] }, "comment-line": { "name": "comment.line.zig", "begin": "//[^/]", "end": "$\\n?", "patterns": [ { "include": "#todo" } ] }, "comment-line-doc": { "name": "comment.line.documentation.zig", "begin": "///", "end": "$\\n?" }, "conditional": { "name": "keyword.control.conditional.zig", "match": "\\b(if|else|switch|and|or|try|catch|orelse)\\b" }, "constant": { "name": "constant.language.zig", "match": "\\b(null|undefined)\\b" }, "dec-float-number": { "name": "constant.numeric.float.zig", "match": "\\b-?[0-9]+(\\.[0-9]+)?([eE][+-]?[0-9]+)?\\b" }, "dec-number": { "name": "constant.numeric.integer.zig", "match": "\\b-?[0-9]+\\b" }, "escaped_char": { "patterns": [ { "name": "string.quoted.escape.newline.zig", "match": "\\\\n" }, { "name": "string.quoted.escape.carrigereturn.zig", "match": "\\\\r" }, { "name": "string.quoted.escape.tabulator.zig", "match": "\\\\t" }, { "name": "string.quoted.escape.backslash.zig", "match": "\\\\\\\\" }, { "name": "string.quoted.escape.single-quote.zig", "match": "\\\\'" }, { "name": "string.quoted.escape.double-quote.zig", "match": "\\\\\\\"" }, { "name": "string.quoted.escape.hexidecimal.zig", "match": "\\\\x[a-fA-F0-9]{2}" }, { "name": "string.quoted.escape.hexidecimal.zig", "match": "\\\\u[a-fA-F0-9]{4}" }, { "name": "string.quoted.escape.hexidecimal.zig", "match": "\\\\U[a-fA-F0-9]{6}" } ] }, "hex-float-number": { "name": "constant.numeric.float.hex.zig", "match": "\\b0x[a-fA-F0-9]+(\\.[a-fA-F0-9]+)?([pP][+-]?[0-9]+)?\\b" }, "hex-number": { "name": "constant.numeric.hex.zig", "match": "\\b0x[a-fA-F0-9]+\\b" }, "keyword": { "name": "support.function.zig", "match": "(?\u003c!\\w)(fn|use|test|@[^\\\"\\d][a-zA-Z_]\\w*)\\b" }, "multiline-strings": { "name": "string.quoted.other.zig", "begin": "c?\\\\\\\\", "end": "$\\n?" }, "oct-number": { "name": "constant.numeric.octal.zig", "match": "\\b0o[0-7]+\\b" }, "operator": { "patterns": [ { "name": "keyword.operator.zig", "match": "(==|!=)" }, { "name": "keyword.operator.word.zig", "match": "\\b(and|or)\\b" }, { "name": "keyword.operator.arithmetic.zig", "match": "(\\-\\%?|\\+%?|\\*%?|/[^/]|%)=?" }, { "name": "keyword.operator.bitwise.zig", "match": "(\\\u003c\\\u003c%?|\u003e\u003e|!|\u0026|\\^|\\|)=?" }, { "name": "keyword.operator.special.zig", "match": "(==|\\+\\+|\\*\\*)" } ] }, "repeat": { "name": "keyword.control.zig", "match": "\\b(while|for)\\b" }, "statement": { "name": "keyword.control.zig", "match": "\\b(break|return|continue|asm|defer|errdefer|unreachable)\\b" }, "storage": { "name": "storage.zig", "match": "\\b(const|var|extern|packed|export|pub|noalias|inline|comptime|nakedcc|stdcallcc|volatile|align|linksection|threadlocal|allowzero)\\b" }, "strings": { "name": "string.quoted.double.zig", "begin": "(c\\\"|\\\")", "end": "\\\"", "patterns": [ { "include": "#escaped_char" }, { "name": "invalid.illegal.character.zig", "match": "(\\\\[^\\'][^\\']*?)" } ] }, "structure": { "name": "storage.type.zig", "match": "\\b(union|struct|enum|error)\\b" }, "todo": { "name": "comment.line.todo.zig", "match": "TODO" }, "type": { "name": "storage.type.zig", "match": "\\b(bool|f16|f32|f64|f128|comptime_float|void|noreturn|type|anyerror|promise)\\b" }, "type-c": { "name": "storage.type.zig.c_compat", "match": "\\b(c_short|c_ushort|c_int|c_uint|c_long|c_ulong|c_longlong|c_ulonglong|c_longdouble|c_void)\\b" }, "type-int": { "name": "storage.type.zig.integer", "match": "\\b([iu][1-9]\\d*|i0|u0|isize|usize|comptime_int)\\b" } } }