瀏覽代碼

conf.py: Format with black and rename extensions to _extensions

To match changes in master branch and ease cherrypicks.
Rémi Verschelde 5 年之前
父節點
當前提交
ce8cf81556

+ 349 - 0
_extensions/gdscript.py

@@ -0,0 +1,349 @@
+# -*- coding: utf-8 -*-
+"""
+    pygments.lexers.gdscript
+    ~~~~~~~~~~~~~~~~~~~~~~
+
+    Lexer for GDScript.
+
+    :copyright: Copyright 2xxx by The Godot Engine Community
+    :license: MIT.
+
+    modified by Daniel J. Ramirez <[email protected]> based on the original python.py pygment
+"""
+
+import re
+
+from pygments.lexer import (
+    Lexer,
+    RegexLexer,
+    include,
+    bygroups,
+    using,
+    default,
+    words,
+    combined,
+    do_insertions,
+)
+from pygments.util import get_bool_opt, shebang_matches
+from pygments.token import (
+    Text,
+    Comment,
+    Operator,
+    Keyword,
+    Name,
+    String,
+    Number,
+    Punctuation,
+    Generic,
+    Other,
+    Error,
+)
+from pygments import unistring as uni
+
+__all__ = ["GDScriptLexer"]
+
+line_re = re.compile(".*?\n")
+
+
+class GDScriptLexer(RegexLexer):
+    """
+    For `Godot source code <https://www.godotengine.org>`_ source code.
+    """
+
+    name = "GDScript"
+    aliases = ["gdscript", "gd"]
+    filenames = ["*.gd"]
+    mimetypes = ["text/x-gdscript", "application/x-gdscript"]
+
+    def innerstring_rules(ttype):
+        return [
+            # the old style '%s' % (...) string formatting
+            (
+                r"%(\(\w+\))?[-#0 +]*([0-9]+|[*])?(\.([0-9]+|[*]))?"
+                "[hlL]?[E-GXc-giorsux%]",
+                String.Interpol,
+            ),
+            # backslashes, quotes and formatting signs must be parsed one at a time
+            (r'[^\\\'"%\n]+', ttype),
+            (r'[\'"\\]', ttype),
+            # unhandled string formatting sign
+            (r"%", ttype),
+            # newlines are an error (use "nl" state)
+        ]
+
+    tokens = {
+        "root": [
+            (r"\n", Text),
+            (
+                r'^(\s*)([rRuUbB]{,2})("""(?:.|\n)*?""")',
+                bygroups(Text, String.Affix, String.Doc),
+            ),
+            (
+                r"^(\s*)([rRuUbB]{,2})('''(?:.|\n)*?''')",
+                bygroups(Text, String.Affix, String.Doc),
+            ),
+            (r"[^\S\n]+", Text),
+            (r"#.*$", Comment.Single),
+            (r"[]{}:(),;[]", Punctuation),
+            (r"\\\n", Text),
+            (r"\\", Text),
+            (r"(in|and|or|not)\b", Operator.Word),
+            (
+                r"!=|==|<<|>>|&&|\+=|-=|\*=|/=|%=|&=|\|=|\|\||[-~+/*%=<>&^.!|$]",
+                Operator,
+            ),
+            include("keywords"),
+            (r"(func)((?:\s|\\\s)+)", bygroups(Keyword, Text), "funcname"),
+            (r"(class)((?:\s|\\\s)+)", bygroups(Keyword, Text), "classname"),
+            include("builtins"),
+            (
+                '([rR]|[uUbB][rR]|[rR][uUbB])(""")',
+                bygroups(String.Affix, String.Double),
+                "tdqs",
+            ),
+            (
+                "([rR]|[uUbB][rR]|[rR][uUbB])(''')",
+                bygroups(String.Affix, String.Single),
+                "tsqs",
+            ),
+            (
+                '([rR]|[uUbB][rR]|[rR][uUbB])(")',
+                bygroups(String.Affix, String.Double),
+                "dqs",
+            ),
+            (
+                "([rR]|[uUbB][rR]|[rR][uUbB])(')",
+                bygroups(String.Affix, String.Single),
+                "sqs",
+            ),
+            (
+                '([uUbB]?)(""")',
+                bygroups(String.Affix, String.Double),
+                combined("stringescape", "tdqs"),
+            ),
+            (
+                "([uUbB]?)(''')",
+                bygroups(String.Affix, String.Single),
+                combined("stringescape", "tsqs"),
+            ),
+            (
+                '([uUbB]?)(")',
+                bygroups(String.Affix, String.Double),
+                combined("stringescape", "dqs"),
+            ),
+            (
+                "([uUbB]?)(')",
+                bygroups(String.Affix, String.Single),
+                combined("stringescape", "sqs"),
+            ),
+            include("name"),
+            include("numbers"),
+        ],
+        "keywords": [
+            (
+                words(
+                    (
+                        "and",
+                        "in",
+                        "not",
+                        "or",
+                        "as",
+                        "breakpoint",
+                        "class",
+                        "class_name",
+                        "extends",
+                        "is",
+                        "func",
+                        "setget",
+                        "signal",
+                        "tool",
+                        "const",
+                        "enum",
+                        "export",
+                        "onready",
+                        "static",
+                        "var",
+                        "break",
+                        "continue",
+                        "if",
+                        "elif",
+                        "else",
+                        "for",
+                        "pass",
+                        "return",
+                        "match",
+                        "while",
+                        "remote",
+                        "master",
+                        "puppet",
+                        "remotesync",
+                        "mastersync",
+                        "puppetsync",
+                    ),
+                    suffix=r"\b",
+                ),
+                Keyword,
+            ),
+        ],
+        "builtins": [
+            (
+                words(
+                    (
+                        "Color8",
+                        "ColorN",
+                        "abs",
+                        "acos",
+                        "asin",
+                        "assert",
+                        "atan",
+                        "atan2",
+                        "bytes2var",
+                        "ceil",
+                        "char",
+                        "clamp",
+                        "convert",
+                        "cos",
+                        "cosh",
+                        "db2linear",
+                        "decimals",
+                        "dectime",
+                        "deg2rad",
+                        "dict2inst",
+                        "ease",
+                        "exp",
+                        "floor",
+                        "fmod",
+                        "fposmod",
+                        "funcref",
+                        "hash",
+                        "inst2dict",
+                        "instance_from_id",
+                        "is_inf",
+                        "is_nan",
+                        "lerp",
+                        "linear2db",
+                        "load",
+                        "log",
+                        "max",
+                        "min",
+                        "nearest_po2",
+                        "pow",
+                        "preload",
+                        "print",
+                        "print_stack",
+                        "printerr",
+                        "printraw",
+                        "prints",
+                        "printt",
+                        "rad2deg",
+                        "rand_range",
+                        "rand_seed",
+                        "randf",
+                        "randi",
+                        "randomize",
+                        "range",
+                        "round",
+                        "seed",
+                        "sign",
+                        "sin",
+                        "sinh",
+                        "sqrt",
+                        "stepify",
+                        "str",
+                        "str2var",
+                        "tan",
+                        "tan",
+                        "tanh",
+                        "type_exist",
+                        "typeof",
+                        "var2bytes",
+                        "var2str",
+                        "weakref",
+                        "yield",
+                    ),
+                    prefix=r"(?<!\.)",
+                    suffix=r"\b",
+                ),
+                Name.Builtin,
+            ),
+            (r"((?<!\.)(self|false|true)|(PI|TAU|NAN|INF)" r")\b", Name.Builtin.Pseudo),
+            (
+                words(
+                    (
+                        "bool",
+                        "int",
+                        "float",
+                        "String",
+                        "NodePath" "Vector2",
+                        "Rect2",
+                        "Transform2D",
+                        "Vector3",
+                        "Rect3",
+                        "Plane",
+                        "Quat",
+                        "Basis",
+                        "Transform",
+                        "Color",
+                        "RID",
+                        "Object",
+                        "NodePath",
+                        "Dictionary",
+                        "Array",
+                        "PoolByteArray",
+                        "PoolIntArray",
+                        "PoolRealArray",
+                        "PoolStringArray",
+                        "PoolVector2Array",
+                        "PoolVector3Array",
+                        "PoolColorArray",
+                        "null",
+                    ),
+                    prefix=r"(?<!\.)",
+                    suffix=r"\b",
+                ),
+                Name.Builtin.Type,
+            ),
+        ],
+        "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"\d+j?", Number.Integer),
+        ],
+        "name": [("[a-zA-Z_]\w*", Name),],
+        "funcname": [("[a-zA-Z_]\w*", Name.Function, "#pop"), default("#pop"),],
+        "classname": [("[a-zA-Z_]\w*", Name.Class, "#pop")],
+        "stringescape": [
+            (
+                r'\\([\\abfnrtv"\']|\n|N\{.*?\}|u[a-fA-F0-9]{4}|'
+                r"U[a-fA-F0-9]{8}|x[a-fA-F0-9]{2}|[0-7]{1,3})",
+                String.Escape,
+            )
+        ],
+        "strings-single": innerstring_rules(String.Single),
+        "strings-double": innerstring_rules(String.Double),
+        "dqs": [
+            (r'"', String.Double, "#pop"),
+            (r'\\\\|\\"|\\\n', String.Escape),  # included here for raw strings
+            include("strings-double"),
+        ],
+        "sqs": [
+            (r"'", String.Single, "#pop"),
+            (r"\\\\|\\'|\\\n", String.Escape),  # included here for raw strings
+            include("strings-single"),
+        ],
+        "tdqs": [
+            (r'"""', String.Double, "#pop"),
+            include("strings-double"),
+            (r"\n", String.Double),
+        ],
+        "tsqs": [
+            (r"'''", String.Single, "#pop"),
+            include("strings-single"),
+            (r"\n", String.Single),
+        ],
+    }
+
+
+def setup(sphinx):
+    sphinx.add_lexer("gdscript", GDScriptLexer())

+ 0 - 0
extensions/sphinx_tabs/LICENSE → _extensions/sphinx_tabs/LICENSE


+ 0 - 0
extensions/sphinx_tabs/__init__.py → _extensions/sphinx_tabs/__init__.py


+ 0 - 0
extensions/sphinx_tabs/semantic-ui-2.2.10/LICENSE.md → _extensions/sphinx_tabs/semantic-ui-2.2.10/LICENSE.md


+ 0 - 0
extensions/sphinx_tabs/semantic-ui-2.2.10/menu.min.css → _extensions/sphinx_tabs/semantic-ui-2.2.10/menu.min.css


+ 0 - 0
extensions/sphinx_tabs/semantic-ui-2.2.10/segment.min.css → _extensions/sphinx_tabs/semantic-ui-2.2.10/segment.min.css


+ 0 - 0
extensions/sphinx_tabs/semantic-ui-2.2.10/tab.min.css → _extensions/sphinx_tabs/semantic-ui-2.2.10/tab.min.css


+ 0 - 0
extensions/sphinx_tabs/semantic-ui-2.2.10/tab.min.js → _extensions/sphinx_tabs/semantic-ui-2.2.10/tab.min.js


+ 0 - 0
extensions/sphinx_tabs/tabs.css → _extensions/sphinx_tabs/tabs.css


+ 0 - 0
extensions/sphinx_tabs/tabs.js → _extensions/sphinx_tabs/tabs.js


+ 0 - 0
extensions/sphinx_tabs/tabs.py → _extensions/sphinx_tabs/tabs.py


+ 54 - 37
conf.py

@@ -7,24 +7,30 @@ import os
 
 
 # -- General configuration ------------------------------------------------
 # -- General configuration ------------------------------------------------
 
 
-needs_sphinx = '1.3'
+needs_sphinx = "1.3"
 
 
 # Sphinx extension module names and templates location
 # Sphinx extension module names and templates location
-sys.path.append(os.path.abspath('extensions'))
-extensions = ['gdscript', 'sphinx_tabs.tabs', 'sphinx.ext.imgmath']
-templates_path = ['_templates']
+sys.path.append(os.path.abspath("_extensions"))
+extensions = [
+    "gdscript",
+    "sphinx_tabs.tabs",
+    "sphinx.ext.imgmath",
+]
+templates_path = ["_templates"]
 
 
 # You can specify multiple suffix as a list of string: ['.rst', '.md']
 # You can specify multiple suffix as a list of string: ['.rst', '.md']
-source_suffix = '.rst'
-source_encoding = 'utf-8-sig'
+source_suffix = ".rst"
+source_encoding = "utf-8-sig"
 
 
 # The master toctree document
 # The master toctree document
-master_doc = 'index'
+master_doc = "index"
 
 
 # General information about the project
 # General information about the project
-project = 'Godot Engine'
-copyright = '2014-2019, Juan Linietsky, Ariel Manzur and the Godot community (CC-BY 3.0)'
-author = 'Juan Linietsky, Ariel Manzur and the Godot community'
+project = "Godot Engine"
+copyright = (
+    "2014-2019, Juan Linietsky, Ariel Manzur and the Godot community (CC-BY 3.0)"
+)
+author = "Juan Linietsky, Ariel Manzur and the Godot community"
 
 
 # Version info for the project, acts as replacement for |version| and |release|
 # Version info for the project, acts as replacement for |version| and |release|
 # The short X.Y version
 # The short X.Y version
@@ -33,34 +39,40 @@ version = os.getenv("READTHEDOCS_VERSION", "3.1")
 release = version
 release = version
 
 
 # Parse Sphinx tags passed from RTD via environment
 # Parse Sphinx tags passed from RTD via environment
-env_tags = os.getenv('SPHINX_TAGS')
+env_tags = os.getenv("SPHINX_TAGS")
 if env_tags != None:
 if env_tags != None:
-   for tag in env_tags.split(','):
-       print("Adding Sphinx tag: %s" % tag.strip())
-       tags.add(tag.strip())
+    for tag in env_tags.split(","):
+        print("Adding Sphinx tag: %s" % tag.strip())
+        tags.add(tag.strip())
 
 
 # Language / i18n
 # Language / i18n
-language = os.getenv('READTHEDOCS_LANGUAGE', 'en')
-is_i18n = tags.has('i18n')
+language = os.getenv("READTHEDOCS_LANGUAGE", "en")
+is_i18n = tags.has("i18n")
 
 
-exclude_patterns = ['_build']
+exclude_patterns = ["_build"]
 
 
+# fmt: off
+# These imports should *not* be moved to the start of the file,
+# they depend on the sys.path.append call registering "extensions".
 # GDScript syntax highlighting
 # GDScript syntax highlighting
 from gdscript import GDScriptLexer
 from gdscript import GDScriptLexer
 from sphinx.highlighting import lexers
 from sphinx.highlighting import lexers
-lexers['gdscript'] = GDScriptLexer()
+
+lexers["gdscript"] = GDScriptLexer()
+# fmt: on
 
 
 # Pygments (syntax highlighting) style to use
 # Pygments (syntax highlighting) style to use
-pygments_style = 'sphinx'
-highlight_language = 'gdscript'
+pygments_style = "sphinx"
+highlight_language = "gdscript"
 
 
 # -- Options for HTML output ----------------------------------------------
 # -- Options for HTML output ----------------------------------------------
 
 
 # on_rtd is whether we are on readthedocs.org, this line of code grabbed from docs.readthedocs.org
 # on_rtd is whether we are on readthedocs.org, this line of code grabbed from docs.readthedocs.org
-on_rtd = os.environ.get('READTHEDOCS', None) == 'True'
+on_rtd = os.environ.get("READTHEDOCS", None) == "True"
 
 
 import sphinx_rtd_theme
 import sphinx_rtd_theme
-html_theme = 'sphinx_rtd_theme'
+
+html_theme = "sphinx_rtd_theme"
 html_theme_path = [sphinx_rtd_theme.get_html_theme_path()]
 html_theme_path = [sphinx_rtd_theme.get_html_theme_path()]
 if on_rtd:
 if on_rtd:
     using_rtd_theme = True
     using_rtd_theme = True
@@ -70,25 +82,25 @@ html_theme_options = {
     # 'typekit_id': 'hiw1hhg',
     # 'typekit_id': 'hiw1hhg',
     # 'analytics_id': '',
     # 'analytics_id': '',
     # 'sticky_navigation': True  # Set to False to disable the sticky nav while scrolling.
     # 'sticky_navigation': True  # Set to False to disable the sticky nav while scrolling.
-    'logo_only': True,  # if we have a html_logo below, this shows /only/ the logo with no title text
-    'collapse_navigation': False,  # Collapse navigation (False makes it tree-like)
+    "logo_only": True,  # if we have a html_logo below, this shows /only/ the logo with no title text
+    "collapse_navigation": False,  # Collapse navigation (False makes it tree-like)
     # 'display_version': True,  # Display the docs version
     # 'display_version': True,  # Display the docs version
     # 'navigation_depth': 4,  # Depth of the headers shown in the navigation bar
     # 'navigation_depth': 4,  # Depth of the headers shown in the navigation bar
 }
 }
 
 
 # VCS options: https://docs.readthedocs.io/en/latest/vcs.html#github
 # VCS options: https://docs.readthedocs.io/en/latest/vcs.html#github
 html_context = {
 html_context = {
-    "display_github": not is_i18n, # Integrate GitHub
-    "github_user": "godotengine", # Username
-    "github_repo": "godot-docs", # Repo name
-    "github_version": "master", # Version
-    "conf_py_path": "/", # Path in the checkout to the docs root
+    "display_github": not is_i18n,  # Integrate GitHub
+    "github_user": "godotengine",  # Username
+    "github_repo": "godot-docs",  # Repo name
+    "github_version": "master",  # Version
+    "conf_py_path": "/",  # Path in the checkout to the docs root
 }
 }
 
 
-html_logo = 'img/docs_logo.png'
+html_logo = "img/docs_logo.png"
 
 
 # Output file base name for HTML help builder
 # Output file base name for HTML help builder
-htmlhelp_basename = 'GodotEnginedoc'
+htmlhelp_basename = "GodotEnginedoc"
 
 
 # -- Options for reStructuredText parser ----------------------------------
 # -- Options for reStructuredText parser ----------------------------------
 
 
@@ -101,8 +113,13 @@ file_insertion_enabled = False
 # (source start file, target name, title,
 # (source start file, target name, title,
 #  author, documentclass [howto, manual, or own class]).
 #  author, documentclass [howto, manual, or own class]).
 latex_documents = [
 latex_documents = [
-  (master_doc, 'GodotEngine.tex', 'Godot Engine Documentation',
-   'Juan Linietsky, Ariel Manzur and the Godot community', 'manual'),
+    (
+        master_doc,
+        "GodotEngine.tex",
+        "Godot Engine Documentation",
+        "Juan Linietsky, Ariel Manzur and the Godot community",
+        "manual",
+    ),
 ]
 ]
 
 
 # -- Options for linkcheck builder ----------------------------------------
 # -- Options for linkcheck builder ----------------------------------------
@@ -114,7 +131,7 @@ linkcheck_timeout = 10
 
 
 # -- I18n settings --------------------------------------------------------
 # -- I18n settings --------------------------------------------------------
 
 
-locale_dirs = ['../sphinx/po/']
+locale_dirs = ["../sphinx/po/"]
 gettext_compact = False
 gettext_compact = False
 
 
 # Couldn't find a way to retrieve variables nor do advanced string
 # Couldn't find a way to retrieve variables nor do advanced string
@@ -126,10 +143,10 @@ rst_epilog = """
     :alt: Translation status
     :alt: Translation status
     :target: https://hosted.weblate.org/engage/godot-engine{target_locale}/?utm_source=widget
     :target: https://hosted.weblate.org/engage/godot-engine{target_locale}/?utm_source=widget
 """.format(
 """.format(
-    image_locale='-' if language == 'en' else language,
-    target_locale='' if language == 'en' else '/' + language
+    image_locale="-" if language == "en" else language,
+    target_locale="" if language == "en" else "/" + language,
 )
 )
 
 
 # Exclude class reference when marked with tag i18n.
 # Exclude class reference when marked with tag i18n.
 if is_i18n:
 if is_i18n:
-    exclude_patterns = ['classes']
+    exclude_patterns = ["classes"]

+ 0 - 171
extensions/gdscript.py

@@ -1,171 +0,0 @@
-# -*- coding: utf-8 -*-
-"""
-    pygments.lexers.gdscript
-    ~~~~~~~~~~~~~~~~~~~~~~
-
-    Lexer for GDScript.
-
-    :copyright: Copyright 2xxx by The Godot Engine Community
-    :license: MIT.
-
-    modified by Daniel J. Ramirez <[email protected]> based on the original python.py pygment
-"""
-
-import re
-
-from pygments.lexer import Lexer, RegexLexer, include, bygroups, using, \
-    default, words, combined, do_insertions
-from pygments.util import get_bool_opt, shebang_matches
-from pygments.token import Text, Comment, Operator, Keyword, Name, String, \
-    Number, Punctuation, Generic, Other, Error
-from pygments import unistring as uni
-
-__all__ = ['GDScriptLexer']
-
-line_re = re.compile('.*?\n')
-
-
-class GDScriptLexer(RegexLexer):
-    """
-    For `Godot source code <https://www.godotengine.org>`_ source code.
-    """
-
-    name = 'GDScript'
-    aliases = ['gdscript', 'gd']
-    filenames = ['*.gd']
-    mimetypes = ['text/x-gdscript', 'application/x-gdscript']
-
-    def innerstring_rules(ttype):
-        return [
-            # the old style '%s' % (...) string formatting
-            (r'%(\(\w+\))?[-#0 +]*([0-9]+|[*])?(\.([0-9]+|[*]))?'
-             '[hlL]?[E-GXc-giorsux%]', String.Interpol),
-            # backslashes, quotes and formatting signs must be parsed one at a time
-            (r'[^\\\'"%\n]+', ttype),
-            (r'[\'"\\]', ttype),
-            # unhandled string formatting sign
-            (r'%', ttype),
-            # newlines are an error (use "nl" state)
-        ]
-
-    tokens = {
-        'root': [
-            (r'\n', Text),
-            (r'^(\s*)([rRuUbB]{,2})("""(?:.|\n)*?""")',
-             bygroups(Text, String.Affix, String.Doc)),
-            (r"^(\s*)([rRuUbB]{,2})('''(?:.|\n)*?''')",
-             bygroups(Text, String.Affix, String.Doc)),
-            (r'[^\S\n]+', Text),
-            (r'#.*$', Comment.Single),
-            (r'[]{}:(),;[]', Punctuation),
-            (r'\\\n', Text),
-            (r'\\', Text),
-            (r'(in|and|or|not)\b', Operator.Word),
-            (r'!=|==|<<|>>|&&|\+=|-=|\*=|/=|%=|&=|\|=|\|\||[-~+/*%=<>&^.!|$]', Operator),
-            include('keywords'),
-            (r'(func)((?:\s|\\\s)+)', bygroups(Keyword, Text), 'funcname'),
-            (r'(class)((?:\s|\\\s)+)', bygroups(Keyword, Text), 'classname'),
-            include('builtins'),
-            ('([rR]|[uUbB][rR]|[rR][uUbB])(""")',
-             bygroups(String.Affix, String.Double), 'tdqs'),
-            ("([rR]|[uUbB][rR]|[rR][uUbB])(''')",
-             bygroups(String.Affix, String.Single), 'tsqs'),
-            ('([rR]|[uUbB][rR]|[rR][uUbB])(")',
-             bygroups(String.Affix, String.Double), 'dqs'),
-            ("([rR]|[uUbB][rR]|[rR][uUbB])(')",
-             bygroups(String.Affix, String.Single), 'sqs'),
-            ('([uUbB]?)(""")', bygroups(String.Affix, String.Double),
-             combined('stringescape', 'tdqs')),
-            ("([uUbB]?)(''')", bygroups(String.Affix, String.Single),
-             combined('stringescape', 'tsqs')),
-            ('([uUbB]?)(")', bygroups(String.Affix, String.Double),
-             combined('stringescape', 'dqs')),
-            ("([uUbB]?)(')", bygroups(String.Affix, String.Single),
-             combined('stringescape', 'sqs')),
-            include('name'),
-            include('numbers'),
-        ],
-        'keywords': [
-            (words((
-                'and', 'in', 'not', 'or', 'as', 'breakpoint', 'class', 'class_name',
-                'extends', 'is', 'func', 'setget', 'signal', 'tool', 'const',
-                'enum', 'export', 'onready', 'static', 'var', 'break', 'continue',
-                'if', 'elif', 'else', 'for', 'pass', 'return', 'match', 'while',
-                'remote', 'master', 'puppet', 'remotesync', 'mastersync',
-                'puppetsync'), suffix=r'\b'),
-             Keyword),
-        ],
-        'builtins': [
-            (words((
-                'Color8', 'ColorN', 'abs', 'acos', 'asin', 'assert', 'atan', 'atan2',
-                'bytes2var', 'ceil', 'char', 'clamp', 'convert', 'cos', 'cosh',
-                'db2linear', 'decimals', 'dectime', 'deg2rad', 'dict2inst',
-                'ease', 'exp', 'floor', 'fmod', 'fposmod', 'funcref', 'hash',
-                'inst2dict', 'instance_from_id', 'is_inf', 'is_nan', 'lerp',
-                'linear2db', 'load', 'log', 'max', 'min', 'nearest_po2', 'pow',
-                'preload', 'print', 'print_stack', 'printerr', 'printraw',
-                'prints', 'printt', 'rad2deg', 'rand_range', 'rand_seed',
-                'randf', 'randi', 'randomize', 'range', 'round', 'seed', 'sign',
-                'sin', 'sinh', 'sqrt', 'stepify', 'str', 'str2var', 'tan',
-                'tan', 'tanh', 'type_exist', 'typeof', 'var2bytes', 'var2str',
-                'weakref', 'yield'),
-                prefix=r'(?<!\.)', suffix=r'\b'),
-             Name.Builtin),
-            (r'((?<!\.)(self|false|true)|(PI|TAU|NAN|INF)'
-             r')\b', Name.Builtin.Pseudo),
-            (words((
-                'bool', 'int', 'float', 'String', 'NodePath'
-                'Vector2', 'Rect2', 'Transform2D',
-                'Vector3', 'Rect3', 'Plane', 'Quat', 'Basis', 'Transform',
-                'Color', "RID", 'Object', 'NodePath', 'Dictionary',
-                'Array', 'PoolByteArray', 'PoolIntArray', 'PoolRealArray',
-                'PoolStringArray', 'PoolVector2Array', 'PoolVector3Array', 'PoolColorArray',
-                'null',
-            ), prefix=r'(?<!\.)', suffix=r'\b'), Name.Builtin.Type),
-        ],
-        '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'\d+j?', Number.Integer)
-        ],
-        'name': [
-            ('[a-zA-Z_]\w*', Name),
-        ],
-        'funcname': [
-            ('[a-zA-Z_]\w*', Name.Function, '#pop'),
-            default('#pop'),
-        ],
-        'classname': [
-            ('[a-zA-Z_]\w*', Name.Class, '#pop')
-        ],
-        'stringescape': [
-            (r'\\([\\abfnrtv"\']|\n|N\{.*?\}|u[a-fA-F0-9]{4}|'
-             r'U[a-fA-F0-9]{8}|x[a-fA-F0-9]{2}|[0-7]{1,3})', String.Escape)
-        ],
-        'strings-single': innerstring_rules(String.Single),
-        'strings-double': innerstring_rules(String.Double),
-        'dqs': [
-            (r'"', String.Double, '#pop'),
-            (r'\\\\|\\"|\\\n', String.Escape),  # included here for raw strings
-            include('strings-double')
-        ],
-        'sqs': [
-            (r"'", String.Single, '#pop'),
-            (r"\\\\|\\'|\\\n", String.Escape),  # included here for raw strings
-            include('strings-single')
-        ],
-        'tdqs': [
-            (r'"""', String.Double, '#pop'),
-            include('strings-double'),
-            (r'\n', String.Double)
-        ],
-        'tsqs': [
-            (r"'''", String.Single, '#pop'),
-            include('strings-single'),
-            (r'\n', String.Single)
-        ],
-    }
-
-def setup(sphinx):
-    sphinx.add_lexer('gdscript', GDScriptLexer())