Created
August 2, 2024 01:34
-
-
Save louiidev/f84cf43a9c386831dfeac6d412b2c50b to your computer and use it in GitHub Desktop.
c3 vscode syntax highlighting
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "$schema": "https://raw.githubusercontent.com/martinring/tmlanguage/master/tmlanguage.json", | |
| "name": "C3", | |
| "patterns": [ | |
| { "include": "#keywords" }, | |
| { "include": "#comments" }, | |
| { "include": "#strings" }, | |
| { "include": "#numbers" }, | |
| { "include": "#types" }, | |
| { "include": "#support" }, | |
| { "include": "#operators" }, | |
| { "include": "#identifiers" }, | |
| { "include": "#variable_declarations" }, | |
| { "include": "#function_calls" }, | |
| { "include": "#structs" }, | |
| { "include": "#enums" }, | |
| { "include": "#macros" } | |
| ], | |
| "repository": { | |
| "keywords": { | |
| "patterns": [ | |
| { | |
| "name": "keyword", | |
| "match": "\\b(asm|assert|bitstruct|break|case|catch|const|continue)\\b" | |
| }, | |
| { | |
| "name": "keyword", | |
| "match": "\\b(def|default|defer|distinct|do|else|enum|extern)\\b" | |
| }, | |
| { | |
| "name": "keyword", | |
| "match": "\\b(false|fault|for|foreach|foreach_r|fn|tlocal|if)\\b" | |
| }, | |
| { | |
| "name": "keyword", | |
| "match": "\\b(inline|import|macro|module|nextcase|null|return|static|this)\\b" | |
| }, | |
| { | |
| "name": "keyword", | |
| "match": "\\b(struct|switch|true|try|union|var|while)\\b" | |
| }, | |
| { | |
| "name": "keyword", | |
| "match": "\\b(%switch|$default|$case|$if|$typeof|$else|$sizeof|$for|$case)\\b" | |
| } | |
| ] | |
| }, | |
| "comments": { | |
| "patterns": [ | |
| { | |
| "name": "comment.line.c3", | |
| "begin": "//", | |
| "end": "$" | |
| }, | |
| { | |
| "name": "comment.block.c3", | |
| "begin": "/\\*", | |
| "end": "\\*/" | |
| } | |
| ] | |
| }, | |
| "strings": { | |
| "patterns": [ | |
| { | |
| "name": "string.quoted.double", | |
| "patterns": [ {"include": "#stringcontent"} ], | |
| "begin": "\"", | |
| "end": "\"" | |
| }, | |
| { | |
| "name": "string.quoted.double", | |
| "patterns": [ {"include": "#stringcontent"} ], | |
| "begin": "b64\"", | |
| "end": "\"" | |
| }, | |
| { | |
| "name": "string.quoted.double", | |
| "patterns": [ {"include": "#stringcontent"} ], | |
| "begin": "x\"", | |
| "end": "\"" | |
| }, | |
| { | |
| "name": "string.quoted.single", | |
| "patterns": [ {"include": "#stringcontent"} ], | |
| "begin": "'", | |
| "end": "'" | |
| }, | |
| { | |
| "name": "string.quoted.single", | |
| "patterns": [ {"include": "#stringcontent"} ], | |
| "begin": "b64'", | |
| "end": "'" | |
| }, | |
| { | |
| "name": "string.quoted.single", | |
| "patterns": [ {"include": "#stringcontent"} ], | |
| "begin": "x'", | |
| "end": "'" | |
| } | |
| ] | |
| }, | |
| "stringcontent": { | |
| "patterns": [ | |
| { | |
| "name": "constant.character.escape", | |
| "match": "\\\\([nrt'\"\\\\]|(x[0-9a-fA-F]{2})|(u\\{[0-9a-fA-F]+\\}))" | |
| }, | |
| { | |
| "name": "invalid.illegal.unrecognized-string-escape", | |
| "match": "\\\\." | |
| } | |
| ] | |
| }, | |
| "numbers": { | |
| "patterns": [ | |
| { | |
| "name": "constant.numeric.c3", | |
| "match": "\\b[0-9]\\.[0-9]+\\b" | |
| }, | |
| { | |
| "name": "constant.numeric.c3", | |
| "match": "\\b[0-9]+\\b" | |
| }, | |
| { | |
| "name": "constant.numeric.c3", | |
| "match": "\\b0x[a-fA-F0-9_]+\\b" | |
| }, | |
| { | |
| "name": "constant.numeric.c3", | |
| "match": "\\b0o[0-7_]+\\b" | |
| }, | |
| { | |
| "name": "constant.numeric.c3", | |
| "match": "\\b0b[01_]+\\b" | |
| } | |
| ] | |
| }, | |
| "types": { | |
| "patterns": [ | |
| { | |
| "name": "support.type.stdint.c3", | |
| "match": "\\b(bool|char|ichar|short|ushort|int|uint|long|ulong|int128|uint128|isz|usz|iptr|uptr|float16|float|double|float128)\\b" | |
| }, | |
| { | |
| "name": "storage.type", | |
| "match": "\\b(any|anyfault|typeid|void)\\b" | |
| } | |
| ] | |
| }, | |
| "support": { | |
| "patterns": [ | |
| { | |
| "name": "support.function.builtin", | |
| "match": "\\$[_a-zA-Z][_a-zA-Z0-9]*" | |
| }, | |
| { | |
| "name": "support.function.macro", | |
| "match": "@[_a-zA-Z][_a-zA-Z0-9]*" | |
| } | |
| ] | |
| }, | |
| "operators": { | |
| "name": "keyword.operator", | |
| "match": "(\\+|-|\\.|%|&|\\|(?!})|=|<|>|!|\\^|\\*|/|::)=?" | |
| }, | |
| "identifiers": { | |
| "patterns": [ | |
| { | |
| "name": "entity.name.type.c3", | |
| "match": "[_A-Z][_a-zA-Z0-9]*" | |
| } | |
| ] | |
| }, | |
| "variable_declarations": { | |
| "patterns": [ | |
| { | |
| "name": "variable.declaration.c3", | |
| "match": "\\b(const\\s+)?([a-zA-Z_][a-zA-Z0-9_]*)(\\s+[a-zA-Z_][a-zA-Z0-9_]*)\\s*=.*;" | |
| }, | |
| { | |
| "name": "variable.other.c3", | |
| "match": "(?<!\\w)([a-zA-Z_][a-zA-Z0-9_:]*)\\b" | |
| }, | |
| { | |
| "name": "constant.numeric.c3", | |
| "match": "\\b[0-9]+\\.[0-9]+[fF]?\\b|\\b[0-9]+[dD]?\\b|\\b[0-9]+\\b" | |
| }, | |
| { | |
| "name": "constant.language.boolean.c3", | |
| "match": "\\b(true|false)\\b" | |
| } | |
| ] | |
| }, | |
| "function_calls": { | |
| "patterns": [ | |
| { | |
| "name": "entity.name.function.c3", | |
| "match": "\\b([a-zA-Z_][a-zA-Z0-9_]*(?:::[a-zA-Z_][a-zA-Z0-9_]*)*)\\b(?=\\s*\\()" | |
| }, | |
| { | |
| "name": "variable.other.c3", | |
| "match": "(?<=\\b(?:[a-zA-Z_][a-zA-Z0-9_]*(?:::[a-zA-Z_][a-zA-Z0-9_]*)*\\s*\\()|\\.)[a-zA-Z_][a-zA-Z0-9_]*" | |
| }, | |
| { | |
| "name": "constant.numeric.c3", | |
| "match": "\\b[0-9]+\\.[0-9]+[fF]?\\b|\\b[0-9]+[dD]?\\b|\\b[0-9]+\\b" | |
| }, | |
| { | |
| "name": "constant.language.boolean.c3", | |
| "match": "\\b(true|false)\\b" | |
| }, | |
| { | |
| "name": "punctuation.separator.c3", | |
| "match": "\\." | |
| }, | |
| { | |
| "name": "punctuation.parenthesis.begin.c3", | |
| "match": "\\(" | |
| }, | |
| { | |
| "name": "punctuation.parenthesis.end.c3", | |
| "match": "\\)" | |
| } | |
| ] | |
| }, | |
| "structs": { | |
| "patterns": [ | |
| { | |
| "name": "entity.name.type.struct.c3", | |
| "match": "\\b(struct)\\s+([a-zA-Z_][a-zA-Z0-9_]*)\\b" | |
| }, | |
| { | |
| "name": "variable.other.field.c3", | |
| "match": "\\b([a-zA-Z_][a-zA-Z0-9_]*)\\s*;" | |
| } | |
| ] | |
| }, | |
| "enums": { | |
| "patterns": [ | |
| { | |
| "name": "entity.name.type.enum.c3", | |
| "match": "\\b(enum)\\s+([a-zA-Z_][a-zA-Z0-9_]*)\\b" | |
| }, | |
| { | |
| "name": "variable.other.enum.c3", | |
| "match": "\\b([a-zA-Z_][a-zA-Z0-9_]*)\\s*(,|=|;)" | |
| } | |
| ] | |
| }, | |
| "macros": { | |
| "patterns": [ | |
| { | |
| "name": "entity.name.macro.c3", | |
| "match": "\\b(macro)\\s+(@[a-zA-Z_][a-zA-Z0-9_]*)" | |
| } | |
| ] | |
| } | |
| }, | |
| "scopeName": "source.c3" | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment