Skip to content

Commit a08daa4

Browse files
Initial commit
0 parents  commit a08daa4

File tree

3 files changed

+105
-0
lines changed

3 files changed

+105
-0
lines changed

README.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# GDScript syntax for highlight.js
2+
3+
Syntax implementation of [Godot's](https://godotengine.org/) GDScript language for [highlight.js](https://github.com/highlightjs/highlight.js).
4+
5+
### Authors
6+
7+
The original code was written by [Khairul Hidayat](https://github.com/khairul169). The repository was eventually transfered and maintained by [Nelson Sylvest*r Fritsch](https://github.com/form-follows-function).
8+
9+
### Documentation
10+
11+
- https://highlightjs.org/
12+
- https://docs.godotengine.org/en/latest/getting_started/scripting/gdscript/gescript_basics.html

gdscript.js

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
/*
2+
Language: GDScript
3+
Author: Khairul Hidayat <[email protected]>
4+
Description: Programming language for Godot Game Engine
5+
*/
6+
7+
function(hljs) {
8+
var KEYWORDS = {
9+
keyword:
10+
'do var const extends is in export onready tool ' +
11+
'static setget signal breakpoint switch case ' +
12+
'assert break continue elif else for if ' +
13+
'pass return while match master sync slave rpc enum',
14+
15+
built_in:
16+
'Color8 ColorN abs acos asin assert atan atan2 ' +
17+
'bytes2var ceil char clamp convert cos cosh ' +
18+
'db2linear decimals dectime deg2rad dict2inst ' +
19+
'ease exp floor fmod fposmod funcref hash ' +
20+
'inst2dict instance_from_id is_inf is_nan lerp ' +
21+
'linear2db load log max min nearest_po2 pow ' +
22+
'preload print print_stack printerr printraw ' +
23+
'prints printt rad2deg rand_range rand_seed ' +
24+
'randf randi randomize range round seed sign ' +
25+
'sin sinh sqrt stepify str str2var tan ' +
26+
'tan tanh type_exist typeof var2bytes var2str ' +
27+
'weakref yield bool int float String NodePath ' +
28+
'Vector2 Rect2 Transform2D Vector3 Rect3 Plane ' +
29+
'Quat Basis Transform Color RID Object NodePath ' +
30+
'Dictionary Array PoolByteArray PoolIntArray ' +
31+
'PoolRealArray PoolStringArray PoolVector2Array ' +
32+
'PoolVector3Array PoolColorArray',
33+
34+
literal:
35+
'true false null'
36+
};
37+
38+
return {
39+
aliases: ['godot', 'gdscript'],
40+
keywords: KEYWORDS,
41+
contains: [
42+
hljs.NUMBER_MODE,
43+
hljs.HASH_COMMENT_MODE,
44+
{
45+
className: 'comment',
46+
begin: /"""/, end: /"""/
47+
},
48+
hljs.QUOTE_STRING_MODE,
49+
{
50+
variants: [
51+
{
52+
className: 'function',
53+
beginKeywords: 'func'
54+
},
55+
{
56+
className: 'class',
57+
beginKeywords: 'class'
58+
}
59+
],
60+
end: /:/,
61+
contains: [
62+
hljs.UNDERSCORE_TITLE_MODE
63+
]
64+
}
65+
]
66+
};
67+
}

package.json

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
{
2+
"name": "highlightjs-gdscript",
3+
"version": "0.0.1",
4+
"description": "highlight.js syntax definition for Godot's GDScript language",
5+
"main": "gdscript.js",
6+
"scripts": {
7+
"test": "echo \"Error: no test specified\" && exit 1"
8+
},
9+
"repository": {
10+
"type": "git",
11+
"url": "git+ssh://[email protected]/form-follows-function/highlightjs-gdscript.git"
12+
},
13+
"keywords": [
14+
"Godot",
15+
"GDScript"
16+
"highlight.js",
17+
"highlightjs",
18+
"syntax"
19+
],
20+
"author": "form-follows-function",
21+
"license": "MIT",
22+
"bugs": {
23+
"url": "https://github.com/form-follows-function/highlightjs-gdscript/issues"
24+
},
25+
"homepage": "https://github.com/form-follows-function/highlightjs-gdscript#readme"
26+
}

0 commit comments

Comments
 (0)