Skip to content

Commit bbea155

Browse files
authored
Merge pull request #10 from Pacifist-Penguin/master
Made it work the way it works with other languages. (Edited module.exports)
2 parents cedd6ba + fd74cbd commit bbea155

File tree

2 files changed

+35
-43
lines changed

2 files changed

+35
-43
lines changed

dist/gdscript.min.js

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

src/languages/gdscript.js

Lines changed: 34 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -4,73 +4,65 @@ Author: Khairul Hidayat <me@khairul.my.id>, Nelson Sylvest*r Fritsch <info@nelso
44
Description: Programming language for Godot Engine
55
*/
66

7-
var module = module ? module : {}; // shim for browser use
8-
9-
function hljsDefineGDScript(hljs) {
7+
function GDScript(hljs) {
108
var KEYWORDS = {
119
keyword:
12-
'and in not or self void as assert breakpoint class class_name ' +
13-
'extends is func setget signal tool yield const enum export ' +
14-
'onready static var break continue if elif else for pass return ' +
15-
'match while remote sync master puppet remotesync mastersync ' +
16-
'puppetsync',
10+
"and in not or self void as assert breakpoint class class_name " +
11+
"extends is func setget signal tool yield const enum export " +
12+
"onready static var break continue if elif else for pass return " +
13+
"match while remote sync master puppet remotesync mastersync " +
14+
"puppetsync",
1715

1816
built_in:
19-
'Color8 ColorN abs acos asin atan atan2 bytes2var ' +
20-
'cartesian2polar ceil char clamp convert cos cosh db2linear ' +
21-
'decimals dectime deg2rad dict2inst ease exp floor fmod fposmod ' +
22-
'funcref get_stack hash inst2dict instance_from_id inverse_lerp ' +
23-
'is_equal_approx is_inf is_instance_valid is_nan is_zero_approx ' +
24-
'len lerp lerp_angle linear2db load log max min move_toward ' +
25-
'nearest_po2 ord parse_json polar2cartesian posmod pow preload ' +
26-
'print_stack push_error push_warning rad2deg rand_range ' +
27-
'rand_seed randf randi randomize range_lerp round seed sign sin ' +
28-
'sinh smoothstep sqrt step_decimals stepify str str2var tan tanh ' +
29-
'to_json type_exists typeof validate_json var2bytes var2str ' +
30-
'weakref wrapf wrapi bool int float String NodePath ' +
31-
'Vector2 Rect2 Transform2D Vector3 Rect3 Plane ' +
32-
'Quat Basis Transform Color RID Object NodePath ' +
33-
'Dictionary Array PoolByteArray PoolIntArray ' +
34-
'PoolRealArray PoolStringArray PoolVector2Array ' +
35-
'PoolVector3Array PoolColorArray',
17+
"Color8 ColorN abs acos asin atan atan2 bytes2var " +
18+
"cartesian2polar ceil char clamp convert cos cosh db2linear " +
19+
"decimals dectime deg2rad dict2inst ease exp floor fmod fposmod " +
20+
"funcref get_stack hash inst2dict instance_from_id inverse_lerp " +
21+
"is_equal_approx is_inf is_instance_valid is_nan is_zero_approx " +
22+
"len lerp lerp_angle linear2db load log max min move_toward " +
23+
"nearest_po2 ord parse_json polar2cartesian posmod pow preload " +
24+
"print_stack push_error push_warning rad2deg rand_range " +
25+
"rand_seed randf randi randomize range_lerp round seed sign sin " +
26+
"sinh smoothstep sqrt step_decimals stepify str str2var tan tanh " +
27+
"to_json type_exists typeof validate_json var2bytes var2str " +
28+
"weakref wrapf wrapi bool int float String NodePath " +
29+
"Vector2 Rect2 Transform2D Vector3 Rect3 Plane " +
30+
"Quat Basis Transform Color RID Object NodePath " +
31+
"Dictionary Array PoolByteArray PoolIntArray " +
32+
"PoolRealArray PoolStringArray PoolVector2Array " +
33+
"PoolVector3Array PoolColorArray",
3634

37-
literal:
38-
'true false null'
35+
literal: "true false null"
3936
};
4037

4138
return {
42-
aliases: ['godot', 'gdscript'],
39+
aliases: ["godot", "gdscript"],
4340
keywords: KEYWORDS,
4441
contains: [
4542
hljs.NUMBER_MODE,
4643
hljs.HASH_COMMENT_MODE,
4744
{
48-
className: 'comment',
49-
begin: /"""/, end: /"""/
45+
className: "comment",
46+
begin: /"""/,
47+
end: /"""/
5048
},
5149
hljs.QUOTE_STRING_MODE,
5250
{
5351
variants: [
5452
{
55-
className: 'function',
56-
beginKeywords: 'func'
53+
className: "function",
54+
beginKeywords: "func"
5755
},
5856
{
59-
className: 'class',
60-
beginKeywords: 'class'
57+
className: "class",
58+
beginKeywords: "class"
6159
}
6260
],
6361
end: /:/,
64-
contains: [
65-
hljs.UNDERSCORE_TITLE_MODE
66-
]
62+
contains: [hljs.UNDERSCORE_TITLE_MODE]
6763
}
6864
]
6965
};
7066
}
7167

72-
module.exports = function(hljs) {
73-
hljs.registerLanguage('gdscript', hljsDefineGDScript);
74-
};
75-
76-
module.exports.definer = hljsDefineGDScript;
68+
module.exports = GDScript;

0 commit comments

Comments
 (0)