Update GDScript syntax highlighting for Godot 4.0
This commit is contained in:
parent
aaf6b3e504
commit
c2d13c9ae4
|
@ -88,6 +88,7 @@ class GDScriptLexer(RegexLexer):
|
|||
(r"(func)((?:\s|\\\s)+)", bygroups(Keyword, Text), "funcname"),
|
||||
(r"(class)((?:\s|\\\s)+)", bygroups(Keyword, Text), "classname"),
|
||||
include("builtins"),
|
||||
include("decorators"),
|
||||
(
|
||||
'([rR]|[uUbB][rR]|[rR][uUbB])(""")',
|
||||
bygroups(String.Affix, String.Double),
|
||||
|
@ -136,7 +137,10 @@ class GDScriptLexer(RegexLexer):
|
|||
words(
|
||||
(
|
||||
"and",
|
||||
"await",
|
||||
"in",
|
||||
"get",
|
||||
"set",
|
||||
"not",
|
||||
"or",
|
||||
"as",
|
||||
|
@ -161,6 +165,7 @@ class GDScriptLexer(RegexLexer):
|
|||
"return",
|
||||
"match",
|
||||
"while",
|
||||
"super",
|
||||
),
|
||||
suffix=r"\b",
|
||||
),
|
||||
|
@ -171,77 +176,114 @@ class GDScriptLexer(RegexLexer):
|
|||
(
|
||||
words(
|
||||
(
|
||||
"Color8",
|
||||
"ColorN",
|
||||
# doc/classes/@GlobalScope.xml
|
||||
"abs",
|
||||
"absf",
|
||||
"absi",
|
||||
"acos",
|
||||
"asin",
|
||||
"assert",
|
||||
"atan",
|
||||
"atan2",
|
||||
"await",
|
||||
"bytes2var",
|
||||
"bytes2var_with_objects",
|
||||
"ceil",
|
||||
"char",
|
||||
"clamp",
|
||||
"convert",
|
||||
"clampf",
|
||||
"clampi",
|
||||
"cos",
|
||||
"cosh",
|
||||
"cubic_interpolate",
|
||||
"db2linear",
|
||||
"decimals",
|
||||
"dectime",
|
||||
"deg2rad",
|
||||
"dict2inst",
|
||||
"ease",
|
||||
"error_string",
|
||||
"exp",
|
||||
"floor",
|
||||
"fmod",
|
||||
"fposmod",
|
||||
"funcref",
|
||||
"hash",
|
||||
"inst2dict",
|
||||
"instance_from_id",
|
||||
"inverse_lerp",
|
||||
"is_equal_approx",
|
||||
"is_inf",
|
||||
"is_instance_id_valid",
|
||||
"is_instance_valid",
|
||||
"is_nan",
|
||||
"is_zero_approx",
|
||||
"lerp",
|
||||
"lerp_angle",
|
||||
"linear2db",
|
||||
"load",
|
||||
"log",
|
||||
"max",
|
||||
"maxf",
|
||||
"maxi",
|
||||
"min",
|
||||
"minf",
|
||||
"mini",
|
||||
"move_toward",
|
||||
"nearest_po2",
|
||||
"pingpong",
|
||||
"posmod",
|
||||
"pow",
|
||||
"preload",
|
||||
"print",
|
||||
"print_stack",
|
||||
"print_verbose",
|
||||
"printerr",
|
||||
"printraw",
|
||||
"prints",
|
||||
"printt",
|
||||
"push_error",
|
||||
"push_warning",
|
||||
"rad2deg",
|
||||
"rand_range",
|
||||
"rand_seed",
|
||||
"rand_from_seed",
|
||||
"randf",
|
||||
"randf_range",
|
||||
"randfn",
|
||||
"randi",
|
||||
"randi_range",
|
||||
"randomize",
|
||||
"range",
|
||||
"range_lerp",
|
||||
"range_step_decimals",
|
||||
"rid_allocate_id",
|
||||
"rid_from_int64",
|
||||
"round",
|
||||
"seed",
|
||||
"sign",
|
||||
"signf",
|
||||
"signi",
|
||||
"sin",
|
||||
"sinh",
|
||||
"smoothstep",
|
||||
"snapped",
|
||||
"sqrt",
|
||||
"stepify",
|
||||
"step_decimals",
|
||||
"str",
|
||||
"str2var",
|
||||
"tan",
|
||||
"tan",
|
||||
"tanh",
|
||||
"type_exist",
|
||||
"typeof",
|
||||
"var2bytes",
|
||||
"var2bytes_with_objects",
|
||||
"var2str",
|
||||
"weakref",
|
||||
"wrapf",
|
||||
"wrapi",
|
||||
|
||||
# modules/gdscript/doc_classes/@GDScript.xml
|
||||
"Color8",
|
||||
"assert",
|
||||
"char",
|
||||
"convert",
|
||||
"dict2inst",
|
||||
"get_stack",
|
||||
"inst2dict",
|
||||
"len",
|
||||
"load",
|
||||
"preload",
|
||||
"print_debug",
|
||||
"print_stack",
|
||||
"range",
|
||||
"str",
|
||||
"type_exists",
|
||||
),
|
||||
prefix=r"(?<!\.)",
|
||||
suffix=r"\b",
|
||||
|
@ -256,14 +298,18 @@ class GDScriptLexer(RegexLexer):
|
|||
"int",
|
||||
"float",
|
||||
"String",
|
||||
"StringName",
|
||||
"NodePath",
|
||||
"Vector2",
|
||||
"Vector2i",
|
||||
"Rect2",
|
||||
"Rect2i",
|
||||
"Transform2D",
|
||||
"Vector3",
|
||||
"Rect3",
|
||||
"Vector3i",
|
||||
"AABB",
|
||||
"Plane",
|
||||
"Quat",
|
||||
"Quaternion",
|
||||
"Basis",
|
||||
"Transform3D",
|
||||
"Color",
|
||||
|
@ -279,7 +325,9 @@ class GDScriptLexer(RegexLexer):
|
|||
"PackedFloat64Array",
|
||||
"PackedStringArray",
|
||||
"PackedVector2Array",
|
||||
"PackedVector2iArray",
|
||||
"PackedVector3Array",
|
||||
"PackedVector3iArray",
|
||||
"PackedColorArray",
|
||||
"null",
|
||||
),
|
||||
|
@ -289,10 +337,46 @@ class GDScriptLexer(RegexLexer):
|
|||
Name.Builtin.Type,
|
||||
),
|
||||
],
|
||||
"decorators": [
|
||||
(
|
||||
words(
|
||||
(
|
||||
"@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",
|
||||
),
|
||||
prefix=r"(?<!\.)",
|
||||
suffix=r"\b",
|
||||
),
|
||||
Name.Decorator,
|
||||
),
|
||||
],
|
||||
"numbers": [
|
||||
(r"(\d+\.\d*|\d*\.\d+)([eE][+-]?[0-9]+)?j?", Number.Float),
|
||||
(r"\d+[eE][+-]?[0-9]+j?", Number.Float),
|
||||
(r"0[xX][a-fA-F0-9]+", Number.Hex),
|
||||
(r"0x[a-fA-F0-9]+", Number.Hex),
|
||||
(r"0b[01]+", Number.Bin),
|
||||
(r"\d+j?", Number.Integer),
|
||||
],
|
||||
"name": [(r"@?[a-zA-Z_]\w*", Name)],
|
||||
|
|
|
@ -147,7 +147,7 @@
|
|||
--highlight-keyword-color: #ff7085;
|
||||
--highlight-keyword2-color: #42ffc2;
|
||||
--highlight-number-color: #a1ffe0;
|
||||
--highlight-decorator-color: #abc8ff;
|
||||
--highlight-decorator-color: #ffb373;
|
||||
--highlight-type-color: #8effda;
|
||||
--highlight-type2-color: #c6ffed;
|
||||
--highlight-function-color: #57b3ff;
|
||||
|
|
Loading…
Reference in New Issue