Skip to content

Commit 2ab771b

Browse files
committed
Update to Godot 4 and highlight.js 11
Note that I couldn't get the ES module build to work in the browser, so maybe we should remove it.
1 parent cedd6ba commit 2ab771b

File tree

5 files changed

+170
-85
lines changed

5 files changed

+170
-85
lines changed

dist/gdscript.es.min.js

Lines changed: 19 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/gdscript.min.js

Lines changed: 19 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,11 @@
11
{
22
"name": "highlightjs-gdscript",
3-
"version": "0.0.1",
3+
"version": "1.0.0",
44
"description": "highlight.js syntax definition for Godot's GDScript language",
5-
"main": "gdscript.js",
5+
"main": "src/gdscript.js",
66
"scripts": {
77
"test": "echo \"Error: no test specified\" && exit 1"
88
},
9-
"repository": {
10-
"type": "git",
11-
"url": "git+ssh://[email protected]/form-follows-function/highlightjs-gdscript.git"
12-
},
139
"keywords": [
1410
"Godot",
1511
"GDScript",
@@ -20,7 +16,7 @@
2016
"author": "form-follows-function",
2117
"license": "MIT",
2218
"bugs": {
23-
"url": "https://github.com/form-follows-function/highlightjs-gdscript/issues"
19+
"url": "https://github.com/highlightjs/highlightjs-gdscript/issues"
2420
},
25-
"homepage": "https://github.com/form-follows-function/highlightjs-gdscript#readme"
21+
"homepage": "https://github.com/highlightjs/highlightjs-gdscript#readme"
2622
}

src/gdscript.js

Lines changed: 128 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,128 @@
1+
/*
2+
Language: GDScript
3+
Author: Hugo Locurcio <[email protected]>, Khairul Hidayat <[email protected]>, Nelson Sylvest*r Fritsch <[email protected]>
4+
Description: Programming language for Godot Engine (supports Godot 4.x and 3.x)
5+
*/
6+
7+
module.exports = function(hljs) {
8+
return {
9+
aliases: ['gdscript', 'godot'],
10+
keywords: {
11+
keyword:
12+
'class class_name const enum extends func namespace signal static ' +
13+
'trait var await breakpoint yield set get and in not or void as ' +
14+
'assert tool export onready break continue if elif else for pass ' +
15+
'return match when while remote sync master puppet remotesync ' +
16+
'mastersync puppetsync',
17+
18+
built_in:
19+
'abs absf absi acos acosh angle_difference asin asinh atan atan2 ' +
20+
'atanh bezier_derivative bezier_interpolate bytes_to_var ' +
21+
'bytes_to_var_with_objects ceil ceilf ceili clamp clampf clampi ' +
22+
'cos cosh cubic_interpolate cubic_interpolate_angle ' +
23+
'cubic_interpolate_angle_in_time cubic_interpolate_in_time ' +
24+
'db_to_linear deg_to_rad ease error_string exp floor floorf ' +
25+
'floori fmod fposmod hash instance_from_id inverse_lerp ' +
26+
'is_equal_approx is_finite is_inf is_instance_id_valid ' +
27+
'is_instance_valid is_nan is_same is_zero_approx lerp lerp_angle ' +
28+
'lerpf linear_to_db log max maxf maxi min minf mini move_toward ' +
29+
'nearest_po2 pingpong posmod pow print print_rich print_verbose ' +
30+
'printerr printraw prints printt push_error push_warning ' +
31+
'rad_to_deg rand_from_seed randf randf_range randfn randi ' +
32+
'randi_range randomize remap rid_allocate_id rid_from_int64 ' +
33+
'rotate_toward round roundf roundi seed sign signf signi sin sinh ' +
34+
'smoothstep snapped snappedf snappedi sqrt step_decimals str ' +
35+
'str_to_var tan tanh type_convert type_string typeof var_to_bytes ' +
36+
'var_to_bytes_with_objects var_to_str weakref wrap wrapf wrapi ' +
37+
'Color8 assert char convert dict_to_inst get_stack inst_to_dict ' +
38+
'is_instance_of len load preload print_debug print_stack range ' +
39+
'type_exists',
40+
41+
type:
42+
'bool int float String Vector2 Vector2i Rect2 Rect2i Transform2D ' +
43+
'Vector3 Vector3i Vector4 Vector4i Plane AABB Quaternion Basis ' +
44+
'Transform3D Projection Color RID Object Callable Signal ' +
45+
'StringName NodePath Dictionary Array PackedByteArray ' +
46+
'PackedInt32Array PackedInt64Array PackedFloat32Array ' +
47+
'PackedFloat64Array PackedStringArray PackedVector2Array ' +
48+
'PackedVector3Array PackedColorArray PackedVector4Array Variant ' +
49+
'void',
50+
51+
52+
'char.escape':
53+
'\\n \\t \\r \\a \\b \\f \\v \\" \\\' \\\\ ' +
54+
'\\u{[0-9a-fA-F]{1,4}} \\U{[0-9a-fA-F]{1,6}}',
55+
56+
'variable.language': 'self super',
57+
'variable.constant': 'PI TAU INF NAN',
58+
59+
literal: 'true false null',
60+
},
61+
contains: [
62+
hljs.NUMBER_MODE,
63+
{
64+
className: 'string',
65+
begin: /"""/,
66+
end: /"""/,
67+
},
68+
{
69+
className: 'string',
70+
begin: /'''/,
71+
end: /'''/,
72+
},
73+
{
74+
className: 'meta',
75+
begin: /#(end)?region/,
76+
end: /\n/,
77+
},
78+
hljs.COMMENT(
79+
'#',
80+
'$',
81+
{
82+
contains: [
83+
{
84+
className: 'doctag',
85+
begin: '@(tutorial|deprecated|experimental)+',
86+
end: /$/,
87+
},
88+
],
89+
},
90+
),
91+
hljs.QUOTE_STRING_MODE,
92+
{
93+
variants: [
94+
{
95+
className: 'function',
96+
beginKeywords: 'func',
97+
},
98+
{
99+
className: 'class',
100+
beginKeywords: 'class',
101+
},
102+
],
103+
end: /:/,
104+
contains: [
105+
hljs.UNDERSCORE_TITLE_MODE,
106+
],
107+
},
108+
{
109+
className: 'meta',
110+
begin: /@/,
111+
end: /[ ,\(,\n]/,
112+
keywords: {
113+
keyword:
114+
'@export @export_category @export_color_no_alpha @export_custom ' +
115+
'@export_dir @export_enum @export_exp_easing @export_file ' +
116+
'@export_flags @export_flags_2d_navigation @export_flags_2d_physics ' +
117+
'@export_flags_2d_render @export_flags_3d_navigation ' +
118+
'@export_flags_3d_physics @export_flags_3d_render ' +
119+
'@export_flags_avoidance @export_global_dir @export_global_file ' +
120+
'@export_group @export_multiline @export_node_path ' +
121+
'@export_placeholder @export_range @export_storage @export_subgroup ' +
122+
'@export_tool_button @icon @onready @rpc @static_unload @tool ' +
123+
'@warning_ignore @warning_ignore_restore @warning_ignore_start',
124+
},
125+
},
126+
],
127+
};
128+
};

src/languages/gdscript.js

Lines changed: 0 additions & 76 deletions
This file was deleted.

0 commit comments

Comments
 (0)