瀏覽代碼

Improve GDScript lexer for Godot 3.x

- Add binary literals.
- Update list of built-in functions for Godot 3.4.
Hugo Locurcio 3 年之前
父節點
當前提交
bad5f91416
共有 1 個文件被更改,包括 27 次插入3 次删除
  1. 27 3
      _extensions/gdscript.py

+ 27 - 3
_extensions/gdscript.py

@@ -190,6 +190,7 @@ class GDScriptLexer(RegexLexer):
                         "atan",
                         "atan2",
                         "bytes2var",
+                        "cartesian2polar",
                         "ceil",
                         "char",
                         "clamp",
@@ -199,6 +200,7 @@ class GDScriptLexer(RegexLexer):
                         "db2linear",
                         "decimals",
                         "dectime",
+                        "deep_equal",
                         "deg2rad",
                         "dict2inst",
                         "ease",
@@ -207,26 +209,41 @@ class GDScriptLexer(RegexLexer):
                         "fmod",
                         "fposmod",
                         "funcref",
+                        "get_stack",
                         "hash",
                         "inst2dict",
                         "instance_from_id",
+                        "inverse_lerp",
+                        "is_equal_approx",
                         "is_inf",
+                        "is_instance_valid",
                         "is_nan",
+                        "is_zero_approx",
+                        "len",
                         "lerp",
+                        "lerp_angle",
                         "linear2db",
                         "load",
                         "log",
                         "max",
                         "min",
+                        "move_toward",
                         "nearest_po2",
+                        "ord",
+                        "parse_json",
+                        "polar2cartesian",
+                        "posmod",
                         "pow",
                         "preload",
                         "print",
+                        "print_debug",
                         "print_stack",
                         "printerr",
                         "printraw",
                         "prints",
                         "printt",
+                        "push_error",
+                        "push_warning",
                         "rad2deg",
                         "rand_range",
                         "rand_seed",
@@ -234,23 +251,29 @@ class GDScriptLexer(RegexLexer):
                         "randi",
                         "randomize",
                         "range",
+                        "range_lerp",
                         "round",
                         "seed",
                         "sign",
                         "sin",
                         "sinh",
+                        "smoothstep",
                         "sqrt",
+                        "step_decimals",
                         "stepify",
                         "str",
                         "str2var",
                         "tan",
-                        "tan",
                         "tanh",
-                        "type_exist",
+                        "to_json",
+                        "type_exists",
                         "typeof",
+                        "validate_json",
                         "var2bytes",
                         "var2str",
                         "weakref",
+                        "wrapf",
+                        "wrapi",
                         "yield",
                     ),
                     prefix=r"(?<!\.)",
@@ -300,7 +323,8 @@ class GDScriptLexer(RegexLexer):
         "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)],