Files
Basalt2/node_modules/shiki/dist/languages/v.tmLanguage-53fdea6f.mjs
Robert Jelic 31787b0e9b Fix
2025-02-16 18:04:24 +01:00

4 lines
12 KiB
JavaScript

var v_tmLanguage = {name:"v",scopeName:"source.v",fileTypes:[".v",".vh",".vsh",".vv","v.mod"],patterns:[{include:"#comments"},{include:"#function-decl"},{include:"#as-is"},{include:"#attributes"},{include:"#assignment"},{include:"#module-decl"},{include:"#import-decl"},{include:"#hash-decl"},{include:"#brackets"},{include:"#builtin-fix"},{include:"#escaped-fix"},{include:"#operators"},{include:"#function-limited-overload-decl"},{include:"#function-extend-decl"},{include:"#function-exist"},{include:"#generic"},{include:"#constants"},{include:"#type"},{include:"#enum"},{include:"#interface"},{include:"#struct"},{include:"#keywords"},{include:"#storage"},{include:"#numbers"},{include:"#strings"},{include:"#types"},{include:"#punctuations"},{include:"#variable-assign"},{include:"#function-decl"}],repository:{"as-is":{begin:"\\s+(as|is)\\s+",beginCaptures:{"1":{name:"keyword.$1.v"}},end:"([\\w.]*)",endCaptures:{"1":{name:"entity.name.alias.v"}}},assignment:{name:"meta.definition.variable.v",match:"\\s+((?:\\:|\\+|\\-|\\*|/|\\%|\\&|\\||\\^)?=)\\s+",captures:{"1":{patterns:[{include:"#operators"}]}}},attributes:{name:"meta.definition.attribute.v",match:"^\\s*((\\[)(deprecated|unsafe|console|heap|manualfree|typedef|live|inline|flag|ref_only|direct_array_access|callconv)(\\]))",captures:{"1":{name:"meta.function.attribute.v"},"2":{name:"punctuation.definition.begin.bracket.square.v"},"3":{name:"storage.modifier.attribute.v"},"4":{name:"punctuation.definition.end.bracket.square.v"}}},"variable-assign":{match:"[a-zA-Z_]\\w*(?:,\\s*[a-zA-Z_]\\w*)*(?=\\s*(?:=|:=))",captures:{"0":{patterns:[{match:"[a-zA-Z_]\\w*",name:"variable.other.assignment.v"},{include:"#punctuation"}]}}},"module-decl":{name:"meta.module.v",begin:"^\\s*(module)\\s+",beginCaptures:{"1":{name:"keyword.module.v"}},end:"([\\w.]+)",endCaptures:{"1":{name:"entity.name.module.v"}}},"import-decl":{name:"meta.import.v",begin:"^\\s*(import)\\s+",beginCaptures:{"1":{name:"keyword.import.v"}},end:"([\\w.]+)",endCaptures:{"1":{name:"entity.name.import.v"}}},"hash-decl":{name:"markup.bold.v",begin:"^\\s*(#)",end:"$"},brackets:{patterns:[{begin:"{",beginCaptures:{"0":{name:"punctuation.definition.bracket.curly.begin.v"}},end:"}",endCaptures:{"0":{name:"punctuation.definition.bracket.curly.end.v"}},patterns:[{include:"$self"}]},{begin:"\\(",beginCaptures:{"0":{name:"punctuation.definition.bracket.round.begin.v"}},end:"\\)",endCaptures:{"0":{name:"punctuation.definition.bracket.round.end.v"}},patterns:[{include:"$self"}]},{begin:"\\[",beginCaptures:{"0":{name:"punctuation.definition.bracket.square.begin.v"}},end:"\\]",endCaptures:{"0":{name:"punctuation.definition.bracket.square.end.v"}},patterns:[{include:"$self"}]}]},"builtin-fix":{patterns:[{patterns:[{name:"storage.modifier.v",match:"(const)(?=\\s*\\()"},{name:"keyword.$1.v",match:"\\b(fn|type|enum|struct|union|interface|map|assert|sizeof|typeof|__offsetof)\\b(?=\\s*\\()"}]},{patterns:[{name:"keyword.control.v",match:"(\\$if|\\$else)(?=\\s*\\()"},{name:"keyword.control.v",match:"\\b(as|in|is|or|break|continue|default|unsafe|match|if|else|for|go|spawn|goto|defer|return|shared|select|rlock|lock|atomic|asm)\\b(?=\\s*\\()"}]},{patterns:[{match:"(?<!.)(i?(?:8|16|nt|64|128)|u?(?:16|32|64|128)|f?(?:32|64))(?=\\s*\\()",captures:{"1":{name:"storage.type.numeric.v"}},name:"meta.expr.numeric.cast.v"},{match:"(bool|byte|byteptr|charptr|voidptr|string|rune|size_t|[ui]size)(?=\\s*\\()",captures:{"1":{name:"storage.type.$1.v"}},name:"meta.expr.bool.cast.v"}]}]},comments:{patterns:[{name:"comment.block.documentation.v",begin:"/\\*",beginCaptures:{"0":{name:"punctuation.definition.comment.begin.v"}},end:"\\*/",endCaptures:{"0":{name:"punctuation.definition.comment.end.v"}},patterns:[{include:"#comments"}]},{name:"comment.line.double-slash.v",begin:"//",beginCaptures:{"0":{name:"punctuation.definition.comment.begin.v"}},end:"$"}]},constants:{name:"constant.language.v",match:"\\b(true|false|none)\\b"},generic:{patterns:[{name:"meta.definition.generic.v",match:"(?<=[\\w\\s+])(\\<)(\\w+)(\\>)",captures:{"1":{name:"punctuation.definition.bracket.angle.begin.v"},"2":{patterns:[{include:"#illegal-name"},{match:"\\w+",name:"entity.name.generic.v"}]},"3":{name:"punctuation.definition.bracket.angle.end.v"}}}]},"function-decl":{name:"meta.definition.function.v",match:"^(\\bpub\\b\\s+)?(\\bfn\\b)\\s+(?:\\([^\\)]+\\)\\s+)?(?:(?:C\\.)?)(\\w+)\\s*((?<=[\\w\\s+])(\\<)(\\w+)(\\>))?",captures:{"1":{name:"storage.modifier.v"},"2":{name:"keyword.fn.v"},"3":{name:"entity.name.function.v"},"4":{patterns:[{include:"#generic"}]}}},"function-extend-decl":{name:"meta.definition.function.v",match:"^\\s*(pub)?\\s*(fn)\\s*(\\()([^\\)]*)(\\))\\s*(?:(?:C\\.)?)(\\w+)\\s*((?<=[\\w\\s+])(\\<)(\\w+)(\\>))?",captures:{"1":{name:"storage.modifier.v"},"2":{name:"keyword.fn.v"},"3":{name:"punctuation.definition.bracket.round.begin.v"},"4":{patterns:[{include:"#brackets"},{include:"#storage"},{include:"#generic"},{include:"#types"},{include:"#punctuation"}]},"5":{name:"punctuation.definition.bracket.round.end.v"},"6":{patterns:[{include:"#illegal-name"},{match:"\\w+",name:"entity.name.function.v"}]},"7":{patterns:[{include:"#generic"}]}}},"function-limited-overload-decl":{name:"meta.definition.function.v",match:"^\\s*(pub)?\\s*(fn)\\s*(\\()([^\\)]*)(\\))\\s*([\\+\\-\\*\\/])?\\s*(\\()([^\\)]*)(\\))\\s*(?:(?:C\\.)?)(\\w+)",captures:{"1":{name:"storage.modifier.v"},"2":{name:"keyword.fn.v"},"3":{name:"punctuation.definition.bracket.round.begin.v"},"4":{patterns:[{include:"#brackets"},{include:"#storage"},{include:"#generic"},{include:"#types"},{include:"#punctuation"}]},"5":{name:"punctuation.definition.bracket.round.end.v"},"6":{patterns:[{include:"#operators"}]},"7":{name:"punctuation.definition.bracket.round.begin.v"},"8":{patterns:[{include:"#brackets"},{include:"#storage"},{include:"#generic"},{include:"#types"},{include:"#punctuation"}]},"9":{name:"punctuation.definition.bracket.round.end.v"},"10":{patterns:[{include:"#illegal-name"},{match:"\\w+",name:"entity.name.function.v"}]}}},"function-exist":{name:"meta.support.function.v",match:"(\\w+)((?<=[\\w\\s+])(\\<)(\\w+)(\\>))?(?=\\s*\\()",captures:{"0":{name:"meta.function.call.v"},"1":{patterns:[{include:"#illegal-name"},{match:"\\w+",name:"entity.name.function.v"}]},"2":{patterns:[{include:"#generic"}]}}},type:{name:"meta.definition.type.v",match:"^\\s*(?:(pub)?\\s+)?(type)\\s+(\\w*)\\s+(?:\\w+\\.+)?(\\w*)",captures:{"1":{name:"storage.modifier.$1.v"},"2":{name:"storage.type.type.v"},"3":{patterns:[{include:"#illegal-name"},{include:"#types"},{name:"entity.name.type.v",match:"\\w+"}]},"4":{patterns:[{include:"#illegal-name"},{include:"#types"},{name:"entity.name.type.v",match:"\\w+"}]}}},"enum":{name:"meta.definition.enum.v",match:"^\\s*(?:(pub)?\\s+)?(enum)\\s+(?:\\w+\\.)?(\\w*)",captures:{"1":{name:"storage.modifier.$1.v"},"2":{name:"storage.type.enum.v"},"3":{name:"entity.name.enum.v"}}},"interface":{name:"meta.definition.interface.v",match:"^\\s*(?:(pub)?\\s+)?(interface)\\s+(\\w*)",captures:{"1":{name:"storage.modifier.$1.v"},"2":{name:"keyword.interface.v"},"3":{patterns:[{include:"#illegal-name"},{name:"entity.name.interface.v",match:"\\w+"}]}}},struct:{patterns:[{name:"meta.definition.struct.v",begin:"^\\s*(?:(mut|pub(?:\\s+mut)?|__global)\\s+)?(struct|union)\\s+([\\w.]+)\\s*|({)",beginCaptures:{"1":{name:"storage.modifier.$1.v"},"2":{name:"storage.type.struct.v"},"3":{name:"entity.name.type.v"},"4":{name:"punctuation.definition.bracket.curly.begin.v"}},end:"\\s*|(})",endCaptures:{"1":{name:"punctuation.definition.bracket.curly.end.v"}},patterns:[{include:"#struct-access-modifier"},{match:"\\b(\\w+)\\s+([\\w\\[\\]\\*&.]+)(?:\\s*(=)\\s*((?:.(?=$|//|/\\*))*+))?",captures:{"1":{name:"variable.other.property.v"},"2":{patterns:[{include:"#numbers"},{include:"#brackets"},{include:"#types"},{match:"\\w+",name:"storage.type.other.v"}]},"3":{name:"keyword.operator.assignment.v"},"4":{patterns:[{include:"$self"}]}}},{include:"#types"},{include:"$self"}]},{name:"meta.definition.struct.v",match:"^\\s*(?:(mut|pub(?:\\s+mut)?|__global))\\s+?(struct)\\s+(?:\\s+([\\w.]+))?",captures:{"1":{name:"storage.modifier.$1.v"},"2":{name:"storage.type.struct.v"},"3":{name:"entity.name.struct.v"}}}]},"struct-access-modifier":{match:"(?<=\\s|^)(mut|pub(?:\\s+mut)?|__global)(:|\\b)",captures:{"1":{name:"storage.modifier.$1.v"},"2":{name:"punctuation.separator.struct.key-value.v"}}},punctuation:{patterns:[{name:"punctuation.delimiter.period.dot.v",match:"\\."},{name:"punctuation.delimiter.comma.v",match:","},{name:"punctuation.separator.key-value.colon.v",match:":"},{name:"punctuation.definition.other.semicolon.v",match:";"},{name:"punctuation.definition.other.questionmark.v",match:"\\?"},{name:"punctuation.hash.v",match:"#"}]},keywords:{patterns:[{name:"keyword.control.v",match:"(\\$if|\\$else)"},{name:"keyword.control.v",match:"(?<!@)\\b(as|it|is|in|or|break|continue|default|unsafe|match|if|else|for|go|spawn|goto|defer|return|shared|select|rlock|lock|atomic|asm)\\b"},{name:"keyword.$1.v",match:"(?<!@)\\b(fn|type|typeof|enum|struct|interface|map|assert|sizeof|__offsetof)\\b"}]},storage:{name:"storage.modifier.v",match:"\\b(const|mut|pub)\\b"},types:{patterns:[{name:"storage.type.numeric.v",match:"(?<!\\.)\\b(i(8|16|nt|64|128)|u(8|16|32|64|128)|f(32|64))\\b"},{name:"storage.type.$1.v",match:"(?<!\\.)\\b(bool|byte|byteptr|charptr|voidptr|string|ustring|rune)\\b"}]},operators:{patterns:[{name:"keyword.operator.arithmetic.v",match:"(\\+|\\-|\\*|\\/|\\%|\\+\\+|\\-\\-|\\>\\>|\\<\\<)"},{name:"keyword.operator.relation.v",match:"(\\=\\=|\\!\\=|\\>|\\<|\\>\\=|\\<\\=)"},{name:"keyword.operator.assignment.v",match:"(\\:\\=|\\=|\\+\\=|\\-\\=|\\*\\=|\\/\\=|\\%\\=|\\&\\=|\\|\\=|\\^\\=|\\~\\=|\\&\\&\\=|\\|\\|\\=|\\>\\>\\=|\\<\\<\\=)"},{name:"keyword.operator.bitwise.v",match:"(\\&|\\||\\^|\\~|<(?!<)|>(?!>))"},{name:"keyword.operator.logical.v",match:"(\\&\\&|\\|\\||\\!)"},{name:"keyword.operator.optional.v",match:"\\?"}]},numbers:{patterns:[{name:"constant.numeric.exponential.v",match:"([0-9]+(_?))+(\\.)([0-9]+[eE][-+]?[0-9]+)"},{name:"constant.numeric.float.v",match:"([0-9]+(_?))+(\\.)([0-9]+)"},{name:"constant.numeric.binary.v",match:"(?:0b)(?:(?:[0-1]+)(?:_?))+"},{name:"constant.numeric.octal.v",match:"(?:0o)(?:(?:[0-7]+)(?:_?))+"},{name:"constant.numeric.hex.v",match:"(?:0x)(?:(?:[0-9a-fA-F]+)(?:_?))+"},{name:"constant.numeric.integer.v",match:"(?:(?:[0-9]+)(?:[_]?))+"}]},punctuations:{patterns:[{name:"punctuation.accessor.v",match:"(?:\\.)"},{name:"punctuation.separator.comma.v",match:"(?:,)"}]},strings:{patterns:[{begin:"`",end:"`",name:"string.quoted.rune.v",patterns:[{include:"#string-escaped-char"},{include:"#string-interpolation"},{include:"#string-placeholder"}]},{begin:"(r)'",beginCaptures:{"1":{name:"storage.type.string.v"}},end:"'",name:"string.quoted.raw.v",patterns:[{include:"#string-interpolation"},{include:"#string-placeholder"}]},{begin:"(r)\"",beginCaptures:{"1":{name:"storage.type.string.v"}},end:"\"",name:"string.quoted.raw.v",patterns:[{include:"#string-interpolation"},{include:"#string-placeholder"}]},{begin:"(c?)'",beginCaptures:{"1":{name:"storage.type.string.v"}},end:"'",name:"string.quoted.v",patterns:[{include:"#string-escaped-char"},{include:"#string-interpolation"},{include:"#string-placeholder"}]},{begin:"(c?)\"",beginCaptures:{"1":{name:"storage.type.string.v"}},end:"\"",name:"string.quoted.v",patterns:[{include:"#string-escaped-char"},{include:"#string-interpolation"},{include:"#string-placeholder"}]}]},"string-escaped-char":{patterns:[{name:"constant.character.escape.v",match:"\\\\([0-7]{3}|[\\$abfnrtv\\\\'\"]|x[0-9a-fA-F]{2}|u[0-9a-fA-F]{4}|U[0-9a-fA-F]{8})"},{name:"invalid.illegal.unknown-escape.v",match:"\\\\[^0-7\\$xuUabfnrtv\\'\"]"}]},"string-interpolation":{name:"meta.string.interpolation.v",match:"(\\$([\\w.]+|\\{.*?\\}))",captures:{"1":{patterns:[{name:"invalid.illegal.v",match:"\\$\\d[\\.\\w]+"},{name:"variable.other.interpolated.v",match:"\\$([\\.\\w]+|\\{.*?\\})"}]}}},"string-placeholder":{match:"%(\\[\\d+\\])?([\\+#\\-0\\x20]{,2}((\\d+|\\*)?(\\.?(\\d+|\\*|(\\[\\d+\\])\\*?)?(\\[\\d+\\])?)?))?[vT%tbcdoqxXUbeEfFgGsp]",name:"constant.other.placeholder.v"},"illegal-name":{match:"\\d\\w+",name:"invalid.illegal.v"}}};
export { v_tmLanguage as default };