diff --git a/syntaxes/GDResource.tmLanguage.json b/syntaxes/GDResource.tmLanguage.json index 2f5e0861a..e8a936af9 100644 --- a/syntaxes/GDResource.tmLanguage.json +++ b/syntaxes/GDResource.tmLanguage.json @@ -1,329 +1,203 @@ { - "version": "v0.6.0", - "scopeName": "source.gdresource", - "uuid": "e076faa2-3c52-42fa-a8e6-9a7c453c1a5b", - "information_for_contributors": [ - "aster: galaster@foxmail.com" - ], - "patterns": [ - { - "include": "#embedded_shader" - }, - { - "include": "#embedded_gdscript" - }, - { - "include": "#comment" - }, - { - "include": "#heading" - }, - { - "include": "#key_value" - } - ], - "repository": { - "comment": { - "captures": { - "1": { - "name": "punctuation.definition.comment.gdresource" - } - }, - "match": "(;).*$\\n?", - "name": "comment.line.gdresource" - }, - "embedded_shader": { - "name": "meta.embedded.block.gdshader", - "begin": "(code) = \"", - "end": "\"", - "beginCaptures": { - "1": { - "name": "variable.other.property.gdresource" - } - }, - "patterns": [ - { - "include": "source.gdshader" - } - ] - }, - "embedded_gdscript": { - "comment": "meta.embedded.block.gdscript", - "begin": "(script/source) = \"", - "end": "\"", - "beginCaptures": { - "1": { - "name": "variable.other.property.gdresource" - } - }, - "patterns": [ - { - "include": "source.gdscript" - } - ] - }, - "heading": { - "begin": "\\[([a-z_]*)\\s?", - "beginCaptures": { - "1": { - "name": "keyword.control.gdresource" - } - }, - "end": "\\]", - "patterns": [ - { - "include": "#heading_properties" - }, - { - "include": "#data" - } - ] - }, - "heading_properties": { - "patterns": [ - { - "name": "invalid.deprecated.noValue.gdresource", - "match": "(\\s*[A-Za-z_\\-][A-Za-z0-9_\\-]*\\s*=)(?=\\s*$)" - }, - { - "begin": "\\s*([A-Za-z_-][^\\s]*|\".+\"|'.+'|[0-9]+)\\s*(=)\\s*", - "beginCaptures": { - "1": { - "name": "variable.other.property.gdresource" - }, - "2": { - "name": "punctuation.definition.keyValue.gdresource" - } - }, - "end": "($|(?==)|\\,?|\\s*(?=\\}))", - "patterns": [ - { - "include": "#data" - } - ] - } - ] - }, - "key_value": { - "patterns": [ - { - "name": "invalid.deprecated.noValue.gdresource", - "match": "(\\s*[A-Za-z_\\-][A-Za-z0-9_\\-]*\\s*=)(?=\\s*$)" - }, - { - "begin": "\\s*([A-Za-z_-][^\\s]*|\".+\"|'.+'|[0-9]+)\\s*(=)\\s*", - "beginCaptures": { - "1": { - "name": "variable.other.property.gdresource" - }, - "2": { - "name": "punctuation.definition.keyValue.gdresource" - } - }, - "end": "($|(?==)|\\,|\\s*(?=\\}))", - "patterns": [ - { - "include": "#data" - } - ] - } - ] - }, - "data": { - "patterns": [ - { - "include": "#comment" - }, - { - "begin": "(?=|==|<|>|!=", - "name": "keyword.operator.comparison.gdscript" - }, - "arithmetic_op": { - "match": "\\+=|-=|\\*=|/=|%=|&=|\\|=|\\*|/|%|\\+|-|<<|>>|&|\\||\\^|~", - "name": "keyword.operator.arithmetic.gdscript" - }, - "assignment_op": { - "match": "=", - "name": "keyword.operator.assignment.gdscript" - }, - - "keywords": { - "patterns": [ - { - "match": "\\b(?i:func|class|class_name|extends|is|in|onready|tool|static|export|setget|const|var|as|void|enum|preload|assert|yield|signal|breakpoint|rpc|sync|remote|master|puppet|slave|remotesync|mastersync|puppetsync|in)\\b", - "name": "keyword.language.gdscript" - }, - { - "match": "\\b(?i:if|elif|else|for|while|break|continue|pass|return|match)\\b", - "name": "keyword.control" - } - ] - }, - "letter": { - "match": "\\b(?i:true|false|null)\\b", - "name": "constant.language.gdscript" - }, - "numbers": { - "patterns": [{ - "match": "\\b(?i:0x\\h*)\\b", - "name": "constant.numeric.integer.hexadecimal.gdscript" - }, - { - "match": "\\b(?i:(\\d+\\.\\d*(e[\\-\\+]?\\d+)?))\\b", - "name": "constant.numeric.float.gdscript" - }, - { - "match": "\\b(?i:(\\.\\d+(e[\\-\\+]?\\d+)?))\\b", - "name": "constant.numeric.float.gdscript" - }, - { - "match": "\\b(?i:(\\d+e[\\-\\+]?\\d+))\\b", - "name": "constant.numeric.float.gdscript" - }, - { - "match": "\\b\\d+\\b", - "name": "constant.numeric.integer.gdscript" - } - ] - }, - "const_def": { - "match": "\\b(?i:(const))\\s+([a-zA-Z_][a-zA-Z_0-9]*)", - "captures": { - "1": { "name": "storage.type.const.gdscript" }, - "2": { "name": "constant.language.gdscript" } - } - }, - "var_def": { - "match": "\\b(?i:(var))\\s+([a-zA-Z_][a-zA-Z_0-9]*)", - "captures": { - "1": { "name": "storage.type.var.gdscript" }, - "2": { "name": "variable.language.gdscript" } - } - }, - "type_declear": { - "match": "\\:\\s*([a-zA-Z_][a-zA-Z_0-9]*)", - "captures": { - "1": { "name": "entity.name.type.class.gdscript" } - } - }, - "function-return-type": { - "match": "\\)\\s*\\-\\>\\s*([a-zA-Z_][a-zA-Z_0-9]*)\\s*\\:", - "captures": { - "1": { "name": "entity.name.type.class.gdscript" } - } - }, - "class_def": { - "captures": { - "1": { "name": "entity.name.type.class.gdscript" }, - "2": { "name": "class.other.gdscript" } - }, - "match": "(?<=^class)\\s+([a-zA-Z_]\\w*)\\s*(?=:)" - }, - "class_new": { - "captures": { - "1": { "name": "entity.name.type.class.gdscript" }, - "2": { "name": "storage.type.new.gdscript" } - }, - "match": "\\b([a-zA-Z_][a-zA-Z_0-9]*).(new)\\(" - }, - "class_is": { - "captures": { - "1": { "name": "storage.type.is.gdscript" }, - "2": { "name": "entity.name.type.class.gdscript" } - }, - "match": "\\s+(is)\\s+([a-zA-Z_][a-zA-Z_0-9]*)" - }, - "class_enum": { - "captures": { - "1": { "name": "entity.name.type.class.gdscript" }, - "2": { "name": "constant.language.gdscript" } - }, - "match": "\\b([A-Z][a-zA-Z_0-9]*)\\.([A-Z_0-9]+)" - }, - "class_name": { - "captures": { - "1": { "name": "entity.name.type.class.gdscript" }, - "2": { "name": "class.other.gdscript" } - }, - "match": "(?<=class_name)\\s+([a-zA-Z_][a-zA-Z_0-9]*(\\.([a-zA-Z_][a-zA-Z_0-9]*))?)" - }, - "extends": { - "match": "(?<=extends)\\s+[a-zA-Z_][a-zA-Z_0-9]*(\\.([a-zA-Z_][a-zA-Z_0-9]*))?", - "name": "entity.other.inherited-class.gdscript" - }, - "builtin_func": { - "match": "(?\"|')((\\.\\.\\/)+|\\/)?)[0-9A-Za-z_ ]+(\\/[0-9A-Za-z_ ]+)*\\k|[0-9A-Za-z_]+(\\/[0-9A-Za-z_]+)*)", - "name": "support.function.builtin.shorthand.gdscript" - }, - "builtin_classes": { - "match": "(?=|==|<|>|!=", + "name": "keyword.operator.comparison.gdscript" + }, + "arithmetic_op": { + "match": "\\+=|-=|\\*=|/=|%=|&=|\\|=|\\*|/|%|\\+|-|<<|>>|&|\\||\\^|~", + "name": "keyword.operator.arithmetic.gdscript" + }, + "assignment_op": { + "match": "=", + "name": "keyword.operator.assignment.gdscript" + }, + "keywords": { + "patterns": [ + { + "match": "\b(?i:func|class|class_name|extends|is|in|onready|tool|static|export|setget|const|var|as|void|enum|preload|assert|yield|signal|breakpoint|rpc|sync|remote|master|puppet|slave|remotesync|mastersync|puppetsync|in)\b", + "name": "keyword.language.gdscript" + }, + { + "match": "\b(?i:if|elif|else|for|while|break|continue|pass|return|match)\b", + "name": "keyword.control" + } + ] + }, + "letter": { + "match": "\b(?i:true|false|null)\b", + "name": "constant.language.gdscript" + }, + "numbers": { + "patterns": [ + { + "match": "\b(?i:0x\\h*)\b", + "name": "constant.numeric.integer.hexadecimal.gdscript" + }, + { + "match": "\b(?i:(\\d+\\.\\d*(e[\\-\\+]?\\d+)?))\b", + "name": "constant.numeric.float.gdscript" + }, + { + "match": "\b(?i:(\\.\\d+(e[\\-\\+]?\\d+)?))\b", + "name": "constant.numeric.float.gdscript" + }, + { + "match": "\b(?i:(\\d+e[\\-\\+]?\\d+))\b", + "name": "constant.numeric.float.gdscript" + }, + { "match": "\b\\d+\b", "name": "constant.numeric.integer.gdscript" } + ] + }, + "const_def": { + "match": "\b(?i:(const))\\s+([a-zA-Z_][a-zA-Z_0-9]*)", + "captures": { + "1": { "name": "storage.type.const.gdscript" }, + "2": { "name": "constant.language.gdscript" } + } + }, + "var_def": { + "match": "\b(?i:(var))\\s+([a-zA-Z_][a-zA-Z_0-9]*)", + "captures": { + "1": { "name": "storage.type.var.gdscript" }, + "2": { "name": "variable.language.gdscript" } + } + }, + "type_declear": { + "match": "\\:\\s*([a-zA-Z_][a-zA-Z_0-9]*)", + "captures": { "1": { "name": "entity.name.type.class.gdscript" } } + }, + "function-return-type": { + "match": "\\)\\s*\\-\\>\\s*([a-zA-Z_][a-zA-Z_0-9]*)\\s*\\:", + "captures": { "1": { "name": "entity.name.type.class.gdscript" } } + }, + "class_def": { + "captures": { + "1": { "name": "entity.name.type.class.gdscript" }, + "2": { "name": "class.other.gdscript" } + }, + "match": "(?<=^class)\\s+([a-zA-Z_]\\w*)\\s*(?=:)" + }, + "class_new": { + "captures": { + "1": { "name": "entity.name.type.class.gdscript" }, + "2": { "name": "storage.type.new.gdscript" } + }, + "match": "\b([a-zA-Z_][a-zA-Z_0-9]*).(new)\\(" + }, + "class_is": { + "captures": { + "1": { "name": "storage.type.is.gdscript" }, + "2": { "name": "entity.name.type.class.gdscript" } + }, + "match": "\\s+(is)\\s+([a-zA-Z_][a-zA-Z_0-9]*)" + }, + "class_enum": { + "captures": { + "1": { "name": "entity.name.type.class.gdscript" }, + "2": { "name": "constant.language.gdscript" } + }, + "match": "\b([A-Z][a-zA-Z_0-9]*)\\.([A-Z_0-9]+)" + }, + "class_name": { + "captures": { + "1": { "name": "entity.name.type.class.gdscript" }, + "2": { "name": "class.other.gdscript" } + }, + "match": "(?<=class_name)\\s+([a-zA-Z_][a-zA-Z_0-9]*(\\.([a-zA-Z_][a-zA-Z_0-9]*))?)" + }, + "extends": { + "match": "(?<=extends)\\s+[a-zA-Z_][a-zA-Z_0-9]*(\\.([a-zA-Z_][a-zA-Z_0-9]*))?", + "name": "entity.other.inherited-class.gdscript" + }, + "builtin_func": { + "match": "(?\"|')((\\.\\.\\/)+|\\/)?)[0-9A-Za-z_ ]+(\\/[0-9A-Za-z_ ]+)*\\k|[0-9A-Za-z_]+(\\/[0-9A-Za-z_]+)*)", + "name": "support.function.builtin.shorthand.gdscript" + }, + "builtin_classes": { + "match": "(?=|==|<|>|!=", - "name": "keyword.operator.comparison.gdscript" - }, - "arithmetic_op": { - "match": "\\+=|-=|\\*=|/=|%=|&=|\\|=|\\*|/|%|\\+|-|<<|>>|&|\\||\\^|~", - "name": "keyword.operator.arithmetic.gdscript" - }, - "assignment_op": { - "match": "=", - "name": "keyword.operator.assignment.gdscript" - }, - "control_flow": { - "match": "\\b(?i:if|elif|else|for|while|break|continue|pass|return|match|in|yield)\\b", - "name": "keyword.control.flow.gdscript" - }, - "keywords": { - "match": "\\b(?i:func|class|class_name|extends|is|onready|tool|static|export|setget|const|var|as|void|enum|preload|assert|signal|breakpoint|rpc|sync|remote|master|puppet|slave|remotesync|mastersync|puppetsync)\\b", - "name": "keyword.language.gdscript" - }, - "letter": { - "match": "\\b(?i:true|false|null)\\b", - "name": "constant.language.gdscript" - }, - "numbers": { - "patterns": [ - { - "match": "\\b(?i:0x\\h*)\\b", - "name": "constant.numeric.integer.hexadecimal.gdscript" - }, - { - "match": "\\b(?i:(\\d+\\.\\d*(e[\\-\\+]?\\d+)?))\\b", - "name": "constant.numeric.float.gdscript" - }, - { - "match": "\\b(?i:(\\.\\d+(e[\\-\\+]?\\d+)?))\\b", - "name": "constant.numeric.float.gdscript" - }, - { - "match": "\\b(?i:(\\d+e[\\-\\+]?\\d+))\\b", - "name": "constant.numeric.float.gdscript" - }, - { - "match": "\\b\\d+\\b", - "name": "constant.numeric.integer.gdscript" - } - ] - }, - "const_def": { - "match": "\\b(?i:(const))\\s+([a-zA-Z_][a-zA-Z_0-9]*)", - "captures": { - "1": { - "name": "storage.type.const.gdscript" - }, - "2": { - "name": "constant.language.gdscript" - } - } - }, - "var_def": { - "match": "\\b(?i:(var))\\s+([a-zA-Z_][a-zA-Z_0-9]*)", - "captures": { - "1": { - "name": "storage.type.var.gdscript" - }, - "2": { - "name": "variable.language.gdscript" - } - } - }, - "type_hint": { - "match": "\\:\\s*([a-zA-Z_][a-zA-Z_0-9]*)\\s*(?:[=\\n]|setget)", - "captures": { - "1": { - "name": "entity.name.type.class.gdscript" - } - } - }, - "function-return-type": { - "match": "\\)\\s*\\-\\>\\s*([a-zA-Z_][a-zA-Z_0-9]*)\\s*\\:", - "captures": { - "1": { - "name": "entity.name.type.class.gdscript" - } - } - }, - "class_def": { - "captures": { - "1": { - "name": "entity.name.type.class.gdscript" - }, - "2": { - "name": "class.other.gdscript" - } - }, - "match": "(?<=^class)\\s+([a-zA-Z_]\\w*)\\s*(?=:)" - }, - "class_new": { - "captures": { - "1": { - "name": "entity.name.type.class.gdscript" - }, - "2": { - "name": "storage.type.new.gdscript" - } - }, - "match": "\\b([a-zA-Z_][a-zA-Z_0-9]*).(new)\\(" - }, - "class_is": { - "captures": { - "1": { - "name": "storage.type.is.gdscript" - }, - "2": { - "name": "entity.name.type.class.gdscript" - } - }, - "match": "\\s+(is)\\s+([a-zA-Z_][a-zA-Z_0-9]*)" - }, - "class_enum": { - "captures": { - "1": { - "name": "entity.name.type.class.gdscript" - }, - "2": { - "name": "constant.language.gdscript" - } - }, - "match": "\\b([A-Z][a-zA-Z_0-9]*)\\.([A-Z_0-9]+)" - }, - "class_name": { - "captures": { - "1": { - "name": "entity.name.type.class.gdscript" - }, - "2": { - "name": "class.other.gdscript" - } - }, - "match": "(?<=class_name)\\s+([a-zA-Z_][a-zA-Z_0-9]*(\\.([a-zA-Z_][a-zA-Z_0-9]*))?)" - }, - "extends": { - "match": "(?<=extends)\\s+[a-zA-Z_][a-zA-Z_0-9]*(\\.([a-zA-Z_][a-zA-Z_0-9]*))?", - "name": "entity.other.inherited-class.gdscript" - }, - "builtin_func": { - "match": "(?=|==|<|>|!=", + "name": "keyword.operator.comparison.gdscript" + }, + "arithmetic_op": { + "match": "\\+=|-=|\\*=|/=|%=|&=|\\|=|\\*|/|%|\\+|-|<<|>>|&|\\||\\^|~", + "name": "keyword.operator.arithmetic.gdscript" + }, + "assignment_op": { + "match": "=", + "name": "keyword.operator.assignment.gdscript" + }, + "control_flow": { + "match": "\b(?i:if|elif|else|for|while|break|continue|pass|return|match|in|yield)\b", + "name": "keyword.control.flow.gdscript" + }, + "keywords": { + "match": "\b(?i:func|class|class_name|extends|is|onready|tool|static|export|setget|const|var|as|void|enum|preload|assert|signal|breakpoint|rpc|sync|remote|master|puppet|slave|remotesync|mastersync|puppetsync)\b", + "name": "keyword.language.gdscript" + }, + "letter": { + "match": "\b(?i:true|false|null)\b", + "name": "constant.language.gdscript" + }, + "numbers": { + "patterns": [ + { + "match": "\b(?i:0x\\h*)\b", + "name": "constant.numeric.integer.hexadecimal.gdscript" + }, + { + "match": "\b(?i:(\\d+\\.\\d*(e[\\-\\+]?\\d+)?))\b", + "name": "constant.numeric.float.gdscript" + }, + { + "match": "\b(?i:(\\.\\d+(e[\\-\\+]?\\d+)?))\b", + "name": "constant.numeric.float.gdscript" + }, + { + "match": "\b(?i:(\\d+e[\\-\\+]?\\d+))\b", + "name": "constant.numeric.float.gdscript" + }, + { "match": "\b\\d+\b", "name": "constant.numeric.integer.gdscript" } + ] + }, + "const_def": { + "match": "\b(?i:(const))\\s+([a-zA-Z_][a-zA-Z_0-9]*)", + "captures": { + "1": { "name": "storage.type.const.gdscript" }, + "2": { "name": "constant.language.gdscript" } + } + }, + "var_def": { + "match": "\b(?i:(var))\\s+([a-zA-Z_][a-zA-Z_0-9]*)", + "captures": { + "1": { "name": "storage.type.var.gdscript" }, + "2": { "name": "variable.language.gdscript" } + } + }, + "type_hint": { + "match": "\\:\\s*([a-zA-Z_][a-zA-Z_0-9]*)\\s*(?:[=\n]|setget)", + "captures": { "1": { "name": "entity.name.type.class.gdscript" } } + }, + "function-return-type": { + "match": "\\)\\s*\\-\\>\\s*([a-zA-Z_][a-zA-Z_0-9]*)\\s*\\:", + "captures": { "1": { "name": "entity.name.type.class.gdscript" } } + }, + "class_def": { + "captures": { + "1": { "name": "entity.name.type.class.gdscript" }, + "2": { "name": "class.other.gdscript" } + }, + "match": "(?<=^class)\\s+([a-zA-Z_]\\w*)\\s*(?=:)" + }, + "class_new": { + "captures": { + "1": { "name": "entity.name.type.class.gdscript" }, + "2": { "name": "storage.type.new.gdscript" } + }, + "match": "\b([a-zA-Z_][a-zA-Z_0-9]*).(new)\\(" + }, + "class_is": { + "captures": { + "1": { "name": "storage.type.is.gdscript" }, + "2": { "name": "entity.name.type.class.gdscript" } + }, + "match": "\\s+(is)\\s+([a-zA-Z_][a-zA-Z_0-9]*)" + }, + "class_enum": { + "captures": { + "1": { "name": "entity.name.type.class.gdscript" }, + "2": { "name": "constant.language.gdscript" } + }, + "match": "\b([A-Z][a-zA-Z_0-9]*)\\.([A-Z_0-9]+)" + }, + "class_name": { + "captures": { + "1": { "name": "entity.name.type.class.gdscript" }, + "2": { "name": "class.other.gdscript" } + }, + "match": "(?<=class_name)\\s+([a-zA-Z_][a-zA-Z_0-9]*(\\.([a-zA-Z_][a-zA-Z_0-9]*))?)" + }, + "extends": { + "match": "(?<=extends)\\s+[a-zA-Z_][a-zA-Z_0-9]*(\\.([a-zA-Z_][a-zA-Z_0-9]*))?", + "name": "entity.other.inherited-class.gdscript" + }, + "builtin_func": { + "match": "(?