|
| 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 | +}; |
0 commit comments