site/node_modules/shiki/dist/langs/gdscript.mjs

18 lines
18 KiB
JavaScript
Raw Normal View History

2024-10-14 06:09:33 +00:00
const lang = Object.freeze({ "displayName": "GDScript", "fileTypes": ["gd"], "name": "gdscript", "patterns": [{ "include": "#statement" }, { "include": "#expression" }], "repository": { "annotated_parameter": { "begin": "(?x)\n\\s* ([a-zA-Z_]\\w*) \\s* (:)\\s* ([a-zA-Z_]\\w*)?\n", "beginCaptures": { "1": { "name": "variable.parameter.function.language.gdscript" }, "2": { "name": "punctuation.separator.annotation.gdscript" }, "3": { "name": "entity.name.type.class.builtin.gdscript" } }, "end": "(,)|(?=\\))", "endCaptures": { "1": { "name": "punctuation.separator.parameters.gdscript" } }, "patterns": [{ "include": "#base_expression" }, { "match": "=(?!=)", "name": "keyword.operator.assignment.gdscript" }] }, "annotations": { "captures": { "1": { "name": "entity.name.function.decorator.gdscript" }, "2": { "name": "entity.name.function.decorator.gdscript" } }, "match": "(@)(export|export_color_no_alpha|export_dir|export_enum|export_exp_easing|export_file|export_flags|export_flags_2d_navigation|export_flags_2d_physics|export_flags_2d_render|export_flags_3d_navigation|export_flags_3d_physics|export_flags_3d_render|export_global_dir|export_global_file|export_multiline|export_node_path|export_placeholder|export_range|icon|onready|rpc|tool|warning_ignore|abstract)\\b" }, "any_method": { "match": "\\b([A-Za-z_]\\w*)\\b(?=\\s*(?:[(]))", "name": "support.function.any-method.gdscript" }, "any_property": { "captures": { "1": { "name": "punctuation.accessor.gdscript" }, "2": { "name": "constant.language.gdscript" }, "3": { "name": "variable.other.property.gdscript" } }, "match": "\\b(\\.)\\s*(?<![@\\$#%])(?:([A-Z_][A-Z_0-9]*)|([A-Za-z_]\\w*))\\b(?![(])" }, "any_variable": { "match": "\\b(?<![@\\$#%])([A-Za-z_]\\w*)\\b(?![(])", "name": "variable.other.gdscript" }, "arithmetic_operator": { "match": "->|\\+=|-=|\\*=|/=|%=|&=|\\|=|\\*|/|%|\\+|-|<<|>>|&|\\||\\^|~|!", "name": "keyword.operator.arithmetic.gdscript" }, "assignment_operator": { "match": "=", "name": "keyword.operator.assignment.gdscript" }, "base_expression": { "patterns": [{ "include": "#builtin_get_node_shorthand" }, { "include": "#nodepath_object" }, { "include": "#nodepath_function" }, { "include": "#strings" }, { "include": "#const_vars" }, { "include": "#keywords" }, { "include": "#logic_operator" }, { "include": "#compare_operator" }, { "include": "#arithmetic_operator" }, { "include": "#lambda_declaration" }, { "include": "#class_declaration" }, { "include": "#variable_declaration" }, { "include": "#signal_declaration_bare" }, { "include": "#signal_declaration" }, { "include": "#function_declaration" }, { "include": "#statement_keyword" }, { "include": "#assignment_operator" }, { "include": "#in_keyword" }, { "include": "#control_flow" }, { "include": "#round_braces" }, { "include": "#function_call" }, { "include": "#comment" }, { "include": "#self" }, { "include": "#func" }, { "include": "#letter" }, { "include": "#numbers" }, { "include": "#builtin_classes" }, { "include": "#pascal_case_class" }, { "include": "#line_continuation" }] }, "builtin_classes": { "match": "(?<![^.]\\.|:)\\b(OS|GDScript|Vector2|Vector2i|Vector3|Vector3i|Color|Rect2|Rect2i|Array|Basis|Dictionary|Plane|Quat|RID|Rect3|Transform|Transform2D|Transform3D|AABB|String|Color|NodePath|Object|PoolByteArray|PoolIntArray|PoolRealArray|PoolStringArray|PoolVector2Array|PoolVector3Array|PoolColorArray|bool|int|float|StringName|Quaternion|PackedByteArray|PackedInt32Array|PackedInt64Array|PackedFloat32Array|PackedFloat64Array|PackedStringArray|PackedVector2Array|PackedVector2iArray|PackedVector3Array|PackedVector3iArray|PackedColorArray|super)\\b", "name": "entity.name.type.class.builtin.gdscript" }, "builtin_get_node_shorthand": { "patterns": [{ "include": "#builtin_get_node_shorthand_quoted" }, { "include": "#builtin_get_node_shorthand_bare" }, { "include": "#builtin_get_node_shorthand_bare_multi" }] }, "builtin_get_node_shorthand_bare": { "captures": { "1": { "name": "keyword.control.flow.gdscript" }, "2": { "name": "constant.character.escape.gdscript" }, "3": { "name": "constant.character.escape.gdscript"
(?=^\\s*$)
|
(?! (\\s* [rR]? (\\'\\'\\'|\\"\\"\\"|\\'|\\"))
|
(\\G $) (?# '\\G' is necessary for ST)
)
`, "patterns": [{ "include": "#base_expression" }] }] }, "logic_operator": { "match": "\\b(and|or|not|!)\\b", "name": "keyword.operator.wordlike.gdscript" }, "loose_default": { "begin": "(=)", "beginCaptures": { "1": { "name": "keyword.operator.gdscript" } }, "end": "(,)|(?=\\))", "endCaptures": { "1": { "name": "punctuation.separator.parameters.gdscript" } }, "patterns": [{ "include": "#base_expression" }] }, "nodepath_function": { "begin": "(get_node_or_null|has_node|has_node_and_resource|find_node|get_node)\\s*(\\()", "beginCaptures": { "1": { "name": "entity.name.function.gdscript" }, "2": { "name": "punctuation.definition.parameters.begin.gdscript" } }, "end": "(\\))", "endCaptures": { "1": { "name": "punctuation.definition.parameters.end.gdscript" } }, "patterns": [{ "begin": `("|')`, "end": "\\1", "name": "string.quoted.gdscript meta.literal.nodepath.gdscript constant.character.escape", "patterns": [{ "match": "%", "name": "keyword.control.flow" }] }] }, "nodepath_object": { "begin": "(NodePath)\\s*(?:\\()", "beginCaptures": { "1": { "name": "support.class.library.gdscript" } }, "end": "(?:\\))", "name": "meta.literal.nodepath.gdscript", "patterns": [{ "begin": `("|')`, "end": "\\1", "name": "string.quoted.gdscript constant.character.escape.gdscript", "patterns": [{ "match": "%", "name": "keyword.control.flow.gdscript" }] }] }, "numbers": { "patterns": [{ "match": "0b[01_]+", "name": "constant.numeric.integer.binary.gdscript" }, { "match": "0x[0-9A-Fa-f_]+", "name": "constant.numeric.integer.hexadecimal.gdscript" }, { "match": "[-]?([0-9][0-9_]+\\.[0-9_]*(e[\\-\\+]?[0-9_]+)?)", "name": "constant.numeric.float.gdscript" }, { "match": "[-]?(\\.[0-9][0-9_]*(e[\\-\\+]?[0-9_]+)?)", "name": "constant.numeric.float.gdscript" }, { "match": "[-]?([0-9][0-9_]*e[\\-\\+]?\\[0-9_])", "name": "constant.numeric.float.gdscript" }, { "match": "[-]?[0-9][0-9_]*", "name": "constant.numeric.integer.gdscript" }] }, "parameters": { "begin": "(\\()", "beginCaptures": { "1": { "name": "punctuation.definition.parameters.begin.gdscript" } }, "end": "(\\))", "endCaptures": { "1": { "name": "punctuation.definition.parameters.end.gdscript" } }, "name": "meta.function.parameters.gdscript", "patterns": [{ "include": "#annotated_parameter" }, { "captures": { "1": { "name": "variable.parameter.function.language.gdscript" }, "2": { "name": "punctuation.separator.parameters.gdscript" } }, "match": "(?x)\n([a-zA-Z_]\\w*)\n\\s* (?: (,) | (?=[)#\\n=]))\n" }, { "include": "#comment" }, { "include": "#loose_default" }] }, "pascal_case_class": { "match": "\\b([A-Z][a-z_0-9]*([A-Z]?[a-z_0-9]+)*[A-Z]?)\\b", "name": "entity.name.type.class.gdscript" }, "round_braces": { "begin": "\\(", "beginCaptures": { "0": { "name": "punctuation.parenthesis.begin.gdscript" } }, "end": "\\)", "endCaptures": { "0": { "name": "punctuation.parenthesis.end.gdscript" } }, "patterns": [{ "include": "#base_expression" }, { "include": "#any_variable" }] }, "self": { "match": "\\bself\\b", "name": "variable.language.gdscript" }, "signal_declaration": { "begin": "(?x) \\s*\n(signal) \\s+\n([a-zA-Z_]\\w*) \\s*\n(?=\\()", "beginCaptures": { "1": { "name": "keyword.language.gdscript storage.type.function.gdscript" }, "2": { "name": "entity.name.function.gdscript" } }, "end": `((?=[#'"\\n]))`, "name": "meta.signal.gdscript", "patterns": [{ "include": "#parameters" }, { "include": "#line_continuation" }] }, "signal_declaration_bare": { "captures": { "1": { "name": "keyword.language.gdscript storage.type.function.gdscript" }, "2": { "name": "entity.name.function.gdscript" } }, "match": "(?x) \\s*\n(signal) \\s+\n([a-zA-Z_]\\w*)(?=[\\n\\s])", "name": "meta.signal.gdscript" }, "statement": { "patterns": [{ "include": "#extends_statement" }] }, "statement_keyword": { "patterns": [{ "match": "(?x)\n\\b(?<!\\.)(\ncontinue | assert | break | elif | else | if | pass | return | while )\\b\n", "name": "keyword.control.flow.gdscript" }, { "match": "\\b(?<!\\.)(class)\\b", "name": "storage.type.class.gdscript" }, { "captures": { "1": { "name": "keyword.control.flow.gdscript" } }, "match": `(?x)
^\\s*(
case | match
)(?=\\s*([-+\\w\\d(\\[{'":#]|$))\\b
` }] }, "string_formatting": { "captures": { "1": { "name": "constant.character.format.placeholder.other.gdscript" } }, "match": "(?x)\n(\n% (\\([\\w\\s]*\\))?\n[-+#0 ]*\n(\\d+|\\*)? (\\.(\\d+|\\*))?\n([hlL])?\n[diouxXeEfFgGcrsab%]\n)\n", "name": "meta.format.percent.gdscript" }, "strings": { "begin": `(r)?("""|'''|"|')`, "beginCaptures": { "1": { "name": "constant.character.escape.gdscript" } }, "end": "\\2", "name": "string.quoted.gdscript", "patterns": [{ "match": "\\\\.", "name": "constant.character.escape.gdscript" }, { "include": "#string_formatting" }] }, "variable_declaration": { "begin": "\\b(?:(var)|(const))\\s+(?:(\\b[A-Z_][A-Z_0-9]*\\b)|([A-Za-z_]\\w*))\\s*", "beginCaptures": { "1": { "name": "keyword.language.gdscript storage.type.var.gdscript" }, "2": { "name": "keyword.language.gdscript storage.type.const.gdscript" }, "3": { "name": "constant.language.gdscript" }, "4": { "name": "variable.other.gdscript" } }, "end": "$|;", "name": "meta.variable.gdscript", "patterns": [{ "captures": { "1": { "name": "punctuation.separator.annotation.gdscript" }, "2": { "name": "keyword.language.gdscript storage.type.const.gdscript" }, "3": { "name": "entity.name.function.gdscript" } }, "match": "(:)?\\s*(set|get)\\s+=\\s+([a-zA-Z_]\\w*)" }, { "match": ":=|=(?!=)", "name": "keyword.operator.assignment.gdscript" }, { "captures": { "1": { "name": "punctuation.separator.annotation.gdscript" }, "2": { "name": "entity.name.type.class.gdscript" } }, "match": "(:)\\s*([a-zA-Z_]\\w*)?" }, { "captures": { "1": { "name": "keyword.language.gdscript storage.type.const.gdscript" }, "2": { "name": "entity.name.function.gdscript" }, "3": { "name": "entity.name.function.gdscript" } }, "match": "(setget)\\s+([a-zA-Z_]\\w*)(?:[,]\\s*([a-zA-Z_]\\w*))?" }, { "include": "#expression" }, { "include": "#letter" }, { "include": "#any_variable" }, { "include": "#any_property" }, { "include": "#keywords" }] } }, "scopeName": "source.gdscript" });
var gdscript = [
lang
];
export { gdscript as default };