diff --git a/Syntaxes/Zig.YAML-tmLanguage b/Syntaxes/Zig.YAML-tmLanguage index 91e0a52..2ab4e43 100644 --- a/Syntaxes/Zig.YAML-tmLanguage +++ b/Syntaxes/Zig.YAML-tmLanguage @@ -29,7 +29,7 @@ repository: match: \\u\{[a-fA-F0-9]{1,6}\} param_list: - begin: '(?<=\(|,)\s*([a-zA-Z_][a-zA-Z0-9_]*|@\".+\")\s*(:)\s*' + begin: '([a-zA-Z_][a-zA-Z0-9_]*|@\".+\")\s*(:)\s*' beginCaptures: '1': name: variable.parameter.zig @@ -287,6 +287,7 @@ repository: name: storage.type.zig patterns: + - include: '#label' - include: '#param_list' - include: '#main' @@ -313,6 +314,7 @@ repository: name: storage.type.zig patterns: + - include: '#label' - include: '#param_list' - include: '#main' @@ -341,7 +343,7 @@ repository: name: storage.type.zig enum_literal: - match: '(?enum_literal match - (?<!\w|\))(\.(?:[a-zA-Z_][a-zA-Z0-9_]*|@\".+\")) + (?<!\w|\))(\.(?:[a-zA-Z_][a-zA-Z0-9_]*|@\".+\"))\b(?!\() name constant.language.enum @@ -324,6 +324,10 @@ patterns + + include + #label + include #param_list @@ -371,6 +375,10 @@ patterns + + include + #label + include #param_list @@ -575,7 +583,7 @@ param_list begin - (?<=\(|,)\s*([a-zA-Z_][a-zA-Z0-9_]*|@\".+\")\s*(:)\s* + ([a-zA-Z_][a-zA-Z0-9_]*|@\".+\")\s*(:)\s* beginCaptures 1 diff --git a/Syntaxes/Zig.tmLanguage.json b/Syntaxes/Zig.tmLanguage.json index 8298c40..413e185 100644 --- a/Syntaxes/Zig.tmLanguage.json +++ b/Syntaxes/Zig.tmLanguage.json @@ -1,98 +1,30 @@ { + "fileTypes": [ + "zig" + ], "patterns": [ { "include": "#main" } ], - "name": "Zig", - "scopeName": "source.zig", - "fileTypes": [ - "zig" - ], "repository": { - "character_escapes": { - "patterns": [ - { - "name": "constant.character.escape.newline.zig", - "match": "\\\\n" - }, - { - "name": "constant.character.escape.carrigereturn.zig", - "match": "\\\\r" - }, - { - "name": "constant.character.escape.tabulator.zig", - "match": "\\\\t" - }, - { - "name": "constant.character.escape.backslash.zig", - "match": "\\\\\\\\" - }, - { - "name": "constant.character.escape.single-quote.zig", - "match": "\\\\'" - }, - { - "name": "constant.character.escape.double-quote.zig", - "match": "\\\\\\\"" - }, - { - "name": "constant.character.escape.hexidecimal.zig", - "match": "\\\\x[a-fA-F0-9]{2}" - }, - { - "name": "constant.character.escape.hexidecimal.zig", - "match": "\\\\u\\{[a-fA-F0-9]{1,6}\\}" - } - ] + "function_call": { + "match": "(?|<)=?)" - }, - { - "name": "keyword.operator.word.zig", - "match": "\\b(and|or)\\b" - }, - { - "name": "keyword.operator.assignment.zig", - "match": "((?:(?:\\+|-|\\*)\\%?|/|%|<<|>>|&|\\|(?=[^\\|])|\\^)?=)" + "match": ",", + "name": "punctuation.separator.zig" }, { - "name": "keyword.operator.arithmetic.zig", - "match": "((?:\\+|-|\\*)\\%?|/(?!/)|%)" + "match": ";", + "name": "punctuation.terminator.zig" }, { - "name": "keyword.operator.bitwise.zig", - "match": "(<<|>>|&(?=[a-zA-Z_]|@\\\")|\\|(?=[^\\|])|\\^|~)" + "match": "(\\()", + "name": "punctuation.section.parens.begin.zig" }, { - "name": "keyword.operator.other.zig", - "match": "(\\+\\+|\\*\\*|->|\\.\\?|\\.\\*|&(?=[a-zA-Z_]|@\\\")|\\?|\\|\\||\\.{2,3})" + "match": "(\\))", + "name": "punctuation.section.parens.end.zig" } ] }, - "block": { - "endCaptures": { - "1": { - "name": "punctuation.section.braces.end.zig" - } - }, - "patterns": [ - { - "include": "#main" - } - ], - "begin": "([a-zA-Z_][a-zA-Z0-9_.]*|@\\\".+\\\")?\\s*(\\{)", - "end": "(\\})", - "beginCaptures": { - "1": { - "name": "storage.type.zig" - }, - "2": { - "name": "punctuation.section.braces.begin.zig" - } - } - }, - "field_decl": { - "endCaptures": { - "1": { - "name": "storage.type.zig" - }, - "2": { - "name": "punctuation.separator.zig" - }, - "3": { - "name": "keyword.operator.assignment.zig" - } - }, - "patterns": [ - { - "include": "#main" - } - ], - "begin": "([a-zA-Z_][a-zA-Z0-9_]*|@\\\".+\\\")\\s*(:)\\s*", - "end": "([a-zA-Z_][a-zA-Z0-9_.]*|@\\\".+\\\")(?:(,)|\\s*(=)\\s*|(?=\\n|\\r))", - "beginCaptures": { - "1": { - "name": "variable.other.member.zig" - }, - "2": { - "name": "punctuation.separator.zig" - } - } - }, "keywords": { "patterns": [ { - "name": "keyword.control.zig", - "match": "\\b(while|for|break|return|continue|asm|defer|errdefer|unreachable)\\b" + "match": "\\b(while|for|break|return|continue|asm|defer|errdefer|unreachable)\\b", + "name": "keyword.control.zig" }, { - "name": "keyword.control.async.zig", - "match": "\\b(noasync|async|await|suspend|resume|cancel)\\b" + "match": "\\b(noasync|async|await|suspend|resume|cancel)\\b", + "name": "keyword.control.async.zig" }, { - "name": "keyword.control.conditional.zig", - "match": "\\b(if|else|switch|try|catch|orelse)\\b" + "match": "\\b(if|else|switch|try|catch|orelse)\\b", + "name": "keyword.control.conditional.zig" }, { - "name": "keyword.control.import.zig", - "match": "(?|<)=?)", + "name": "keyword.operator.logical.zig" }, { - "name": "storage.type.zig", - "match": "([a-zA-Z_][a-zA-Z0-9_.]*|@\\\".+\\\")" - } - ], - "beginCaptures": { - "1": { - "name": "storage.type.function.zig" + "match": "\\b(and|or)\\b", + "name": "keyword.operator.word.zig" }, - "2": { - "name": "punctuation.section.parens.begin.zig" - } - }, - "contentName": "meta.function.parameters.zig", - "begin": "\\b(fn)\\s*(\\()", - "end": "(?<=\\))\\s*([a-zA-Z_][a-zA-Z0-9_.]*|@\\\".+\\\")" - }, - "support": { - "name": "support.function.zig", - "match": "(?>|&|\\|(?=[^\\|])|\\^)?=)", + "name": "keyword.operator.assignment.zig" }, { - "name": "storage.type.integer.zig", - "match": "\\b(?>|&(?=[a-zA-Z_]|@\\\")|\\|(?=[^\\|])|\\^|~)", + "name": "keyword.operator.bitwise.zig" }, { - "name": "storage.type.c_compat.zig", - "match": "\\b(c_short|c_ushort|c_int|c_uint|c_long|c_ulong|c_longlong|c_ulonglong|c_longdouble|c_void)\\b" + "match": "(\\+\\+|\\*\\*|->|\\.\\?|\\.\\*|&(?=[a-zA-Z_]|@\\\")|\\?|\\|\\||\\.{2,3})", + "name": "keyword.operator.other.zig" + } + ] + }, + "comments": { + "patterns": [ + { + "end": "$\\n?", + "begin": "//[^/]\\s*TODO", + "name": "comment.line.todo.zig" }, { - "name": "storage.type.function.zig", - "match": "\\bfn\\b" + "end": "$\\n?", + "begin": "//[^/]", + "name": "comment.line.zig" }, { - "name": "storage.type.test.zig", - "match": "\\btest\\b" + "end": "$\\n?", + "begin": "///", + "name": "comment.line.documentation.zig" + } + ] + }, + "support": { + "match": "(? 0) break :blk a; break :blk 1; }; - std.debug.warn(run_qemu.getEnvMap().get("PATH")); + std.debug.warn(run_qemu.getEnvMap() .get("PATH"));