| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586 |
- # -*- 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
- further expanded and consolidated with the godot-docs lexer by Zackery R. Smith <[email protected]> and Ste.
- """
- from pygments.lexer import RegexLexer, include, bygroups, words, combined
- from pygments.token import (
- Keyword,
- Literal,
- Name,
- Comment,
- String,
- Number,
- Operator,
- Whitespace,
- Punctuation,
- )
- __all__ = ["GDScriptLexer"]
- class GDScriptLexer(RegexLexer):
- """
- For GDScript source code.
- """
- name = "GDScript"
- url = "https://www.godotengine.org"
- aliases = ["gdscript", "gd"]
- filenames = ["*.gd"]
- mimetypes = ["text/x-gdscript", "application/x-gdscript"]
- # taken from pygments/gdscript.py
- @staticmethod
- def inner_string_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 = {
- "whitespace": [(r"\s+", Whitespace)],
- "comment": [
- (r"##.*$", Comment.Doc),
- (r"#(?:end)?region.*$", Comment.Region),
- (r"#.*$", Comment.Single),
- ],
- "punctuation": [
- (r"[]{}(),:;[]", Punctuation),
- (r":\n", Punctuation),
- (r"\\", Punctuation),
- ],
- # NOTE: from github.com/godotengine/godot-docs
- "keyword": [
- (
- words(
- (
- # modules/gdscript/gdscript.cpp - GDScriptLanguage::get_reserved_words()
- # Declarations.
- "class",
- "class_name",
- "const",
- "enum",
- "extends",
- "func",
- "namespace", # Reserved for potential future use.
- "signal",
- "static",
- "trait", # Reserved for potential future use.
- "var",
- # Other keywords.
- "await",
- "breakpoint",
- "self",
- "super",
- "yield", # Reserved for potential future use.
- # Not really keywords, but used in property syntax.
- # also colored like functions, not keywords
- #"set",
- #"get",
- ),
- suffix=r"\b",
- ),
- Keyword,
- ),
- (
- words(
- (
- # modules/gdscript/gdscript.cpp - GDScriptLanguage::get_reserved_words()
- # Control flow.
- "break",
- "continue",
- "elif",
- "else",
- "for",
- "if",
- "match",
- "pass",
- "return",
- "when",
- "while",
- "yield",
- ),
- suffix=r"\b",
- ),
- # Custom control flow class used to give control flow keywords a different color,
- # like in the Godot editor.
- Keyword.ControlFlow,
- ),
- ],
- "builtin": [
- (
- words(
- ("true", "false", "PI", "TAU", "NAN", "INF", "null"),
- prefix=r"(?<!\.)",
- suffix=r"\b",
- ),
- Literal,
- ),
- # NOTE: from github.com/godotengine/godot-docs
- (
- words(
- (
- # doc/classes/@GlobalScope.xml
- "abs",
- "absf",
- "absi",
- "acos",
- "acosh",
- "angle_difference",
- "asin",
- "asinh",
- "atan",
- "atan2",
- "atanh",
- "bezier_derivative",
- "bezier_interpolate",
- "bytes_to_var",
- "bytes_to_var_with_objects",
- "ceil",
- "ceilf",
- "ceili",
- "clamp",
- "clampf",
- "clampi",
- "cos",
- "cosh",
- "cubic_interpolate",
- "cubic_interpolate_angle",
- "cubic_interpolate_angle_in_time",
- "cubic_interpolate_in_time",
- "db_to_linear",
- "deg_to_rad",
- "ease",
- "error_string",
- "exp",
- "floor",
- "floorf",
- "floori",
- "fmod",
- "fposmod",
- "hash",
- "instance_from_id",
- "inverse_lerp",
- "is_equal_approx",
- "is_finite",
- "is_inf",
- "is_instance_id_valid",
- "is_instance_valid",
- "is_nan",
- "is_same",
- "is_zero_approx",
- "lerp",
- "lerp_angle",
- "lerpf",
- "linear_to_db",
- "log",
- "max",
- "maxf",
- "maxi",
- "min",
- "minf",
- "mini",
- "move_toward",
- "nearest_po2",
- "pingpong",
- "posmod",
- "pow",
- "print",
- "print_rich",
- "print_verbose",
- "printerr",
- "printraw",
- "prints",
- "printt",
- "push_error",
- "push_warning",
- "rad_to_deg",
- "rand_from_seed",
- "randf",
- "randf_range",
- "randfn",
- "randi",
- "randi_range",
- "randomize",
- "remap",
- "rid_allocate_id",
- "rid_from_int64",
- "rotate_toward",
- "round",
- "roundf",
- "roundi",
- "seed",
- "sign",
- "signf",
- "signi",
- "sin",
- "sinh",
- "smoothstep",
- "snapped",
- "snappedf",
- "snappedi",
- "sqrt",
- "step_decimals",
- "str",
- "str_to_var",
- "tan",
- "tanh",
- "type_convert",
- "type_string",
- "typeof",
- "var_to_bytes",
- "var_to_bytes_with_objects",
- "var_to_str",
- "weakref",
- "wrap",
- "wrapf",
- "wrapi",
- # modules/gdscript/doc_classes/@GDScript.xml
- "Color8",
- "assert",
- "char",
- "convert",
- "dict_to_inst",
- "get_stack",
- "inst_to_dict",
- "is_instance_of",
- "len",
- "load",
- "ord",
- "preload",
- "print_debug",
- "print_stack",
- "range",
- "type_exists",
- ),
- prefix=r"(?<!\.)",
- suffix=r"\b",
- ),
- Name.Builtin.Function,
- ),
- (r"((?<!\.)(self)" r")\b", Name.Builtin.Pseudo),
- # NOTE: from github.com/godotengine/godot-docs
- (
- words(
- (
- # core/variant/variant.cpp - Variant::get_type_name()
- # `Nil` is excluded because it is not allowed in GDScript.
- "bool",
- "int",
- "float",
- "String",
- "Vector2",
- "Vector2i",
- "Rect2",
- "Rect2i",
- "Transform2D",
- "Vector3",
- "Vector3i",
- "Vector4",
- "Vector4i",
- "Plane",
- "AABB",
- "Quaternion",
- "Basis",
- "Transform3D",
- "Projection",
- "Color",
- "RID",
- "Object",
- "Callable",
- "Signal",
- "StringName",
- "NodePath",
- "Dictionary",
- "Array",
- "PackedByteArray",
- "PackedInt32Array",
- "PackedInt64Array",
- "PackedFloat32Array",
- "PackedFloat64Array",
- "PackedStringArray",
- "PackedVector2Array",
- "PackedVector3Array",
- "PackedColorArray",
- "PackedVector4Array",
- # The following are also considered types in GDScript.
- "Variant",
- "void",
- ),
- prefix=r"(?<!\.)",
- suffix=r"\b",
- ),
- Name.Builtin.Type,
- ),
- # copied from https://docs.godotengine.org/en/stable/classes/index.html
- (
- words(
- (
- # Nodes
- "Node",
- "AcceptDialog",
- "AnimatableBody2D",
- "AnimatableBody3D",
- "AnimatedSprite2D",
- "AnimatedSprite3D",
- "AnimationMixer",
- "AnimationPlayer",
- "AnimationTree",
- "Area2D",
- "Area3D",
- "AspectRatioContainer",
- "AudioListener2D",
- "AudioListener3D",
- "AudioStreamPlayer",
- "AudioStreamPlayer2D",
- "AudioStreamPlayer3D",
- "BackBufferCopy",
- "BaseButton",
- "Bone2D",
- "BoneAttachment3D",
- "BoxContainer",
- "Button",
- "Camera2D",
- "Camera3D",
- "CanvasGroup",
- "CanvasItem",
- "CanvasLayer",
- "CanvasModulate",
- "CenterContainer",
- "CharacterBody2D",
- "CharacterBody3D",
- "CheckBox",
- "CheckButton",
- "CodeEdit",
- "CollisionObject2D",
- "CollisionObject3D",
- "CollisionPolygon2D",
- "CollisionPolygon3D",
- "CollisionShape2D",
- "CollisionShape3D",
- "ColorPicker",
- "ColorPickerButton",
- "ColorRect",
- "ConeTwistJoint3D",
- "ConfirmationDialog",
- "Container",
- "Control",
- "CPUParticles2D",
- "CPUParticles3D",
- "CSGBox3D",
- "CSGCombiner3D",
- "CSGCylinder3D",
- "CSGMesh3D",
- "CSGPolygon3D",
- "CSGPrimitive3D",
- "CSGShape3D",
- "CSGSphere3D",
- "CSGTorus3D",
- "DampedSpringJoint2D",
- "Decal",
- "DirectionalLight2D",
- "DirectionalLight3D",
- "EditorCommandPalette",
- "EditorFileDialog",
- "EditorFileSystem",
- "EditorInspector",
- "EditorPlugin",
- "EditorProperty",
- "EditorResourcePicker",
- "EditorResourcePreview",
- "EditorScriptPicker",
- "EditorSpinSlider",
- "EditorToaster",
- "FileDialog",
- "FileSystemDock",
- "FlowContainer",
- "FogVolume",
- "Generic6DOFJoint3D",
- "GeometryInstance3D",
- "GPUParticles2D",
- "GPUParticles3D",
- "GPUParticlesAttractor3D",
- "GPUParticlesAttractorBox3D",
- "GPUParticlesAttractorSphere3D",
- "GPUParticlesAttractorVectorField3D",
- "GPUParticlesCollision3D",
- "GPUParticlesCollisionBox3D",
- "GPUParticlesCollisionHeightField3D",
- "GPUParticlesCollisionSDF3D",
- "GPUParticlesCollisionSphere3D",
- "GraphEdit",
- "GraphElement",
- "GraphFrame",
- "GraphNode",
- "GridContainer",
- "GridMap",
- "GridMapEditorPlugin",
- "GrooveJoint2D",
- "HBoxContainer",
- "HFlowContainer",
- "HingeJoint3D",
- "HScrollBar",
- "HSeparator",
- "HSlider",
- "HSplitContainer",
- "HTTPRequest",
- "ImporterMeshInstance3D",
- "InstancePlaceholder",
- "ItemList",
- "Joint2D",
- "Joint3D",
- "Label",
- "Label3D",
- "Light2D",
- "Light3D",
- "LightmapGI",
- "LightmapProbe",
- "LightOccluder2D",
- "Line2D",
- "LineEdit",
- "LinkButton",
- "LookAtModifier3D",
- "MarginContainer",
- "Marker2D",
- "Marker3D",
- "MenuBar",
- "MenuButton",
- "MeshInstance2D",
- "MeshInstance3D",
- "MissingNode",
- "MultiMeshInstance2D",
- "MultiMeshInstance3D",
- "MultiplayerSpawner",
- "MultiplayerSynchronizer",
- "NavigationAgent2D",
- "NavigationAgent3D",
- "NavigationLink2D",
- "NavigationLink3D",
- "NavigationObstacle2D",
- "NavigationObstacle3D",
- "NavigationRegion2D",
- "NavigationRegion3D",
- "NinePatchRect",
- "Node2D",
- "Node3D",
- "OccluderInstance3D",
- "OmniLight3D",
- "OpenXRBindingModifierEditor",
- "OpenXRCompositionLayer",
- "OpenXRCompositionLayerCylinder",
- "OpenXRCompositionLayerEquirect",
- "OpenXRCompositionLayerQuad",
- "OpenXRHand",
- "OpenXRInteractionProfileEditor",
- "OpenXRInteractionProfileEditorBase",
- "OpenXRVisibilityMask",
- "OptionButton",
- "Panel",
- "PanelContainer",
- "Parallax2D",
- "ParallaxBackground",
- "ParallaxLayer",
- "Path2D",
- "Path3D",
- "PathFollow2D",
- "PathFollow3D",
- "PhysicalBone2D",
- "PhysicalBone3D",
- "PhysicalBoneSimulator3D",
- "PhysicsBody2D",
- "PhysicsBody3D",
- "PinJoint2D",
- "PinJoint3D",
- "PointLight2D",
- "Polygon2D",
- "Popup",
- "PopupMenu",
- "PopupPanel",
- "ProgressBar",
- "Range",
- "RayCast2D",
- "RayCast3D",
- "ReferenceRect",
- "ReflectionProbe",
- "RemoteTransform2D",
- "RemoteTransform3D",
- "ResourcePreloader",
- "RetargetModifier3D",
- "RichTextLabel",
- "RigidBody2D",
- "RigidBody3D",
- "RootMotionView",
- "ScriptCreateDialog",
- "ScriptEditor",
- "ScriptEditorBase",
- "ScrollBar",
- "ScrollContainer",
- "Separator",
- "ShaderGlobalsOverride",
- "ShapeCast2D",
- "ShapeCast3D",
- "Skeleton2D",
- "Skeleton3D",
- "SkeletonIK3D",
- "SkeletonModifier3D",
- "Slider",
- "SliderJoint3D",
- "SoftBody3D",
- "SpinBox",
- "SplitContainer",
- "SpotLight3D",
- "SpringArm3D",
- "SpringBoneCollision3D",
- "SpringBoneCollisionCapsule3D",
- "SpringBoneCollisionPlane3D",
- "SpringBoneCollisionSphere3D",
- "SpringBoneSimulator3D",
- "Sprite2D",
- "Sprite3D",
- "SpriteBase3D",
- "StaticBody2D",
- "StaticBody3D",
- "StatusIndicator",
- "SubViewport",
- "SubViewportContainer",
- "TabBar",
- "TabContainer",
- "TextEdit",
- "TextureButton",
- "TextureProgressBar",
- "TextureRect",
- "TileMap",
- "TileMapLayer",
- "Timer",
- "TouchScreenButton",
- "Tree",
- "VBoxContainer",
- "VehicleBody3D",
- "VehicleWheel3D",
- "VFlowContainer",
- "VideoStreamPlayer",
- "Viewport",
- "VisibleOnScreenEnabler2D",
- "VisibleOnScreenEnabler3D",
- "VisibleOnScreenNotifier2D",
- "VisibleOnScreenNotifier3D",
- "VisualInstance3D",
- "VoxelGI",
- "VScrollBar",
- "VSeparator",
- "VSlider",
- "VSplitContainer",
- "Window",
- "WorldEnvironment",
- "XRAnchor3D",
- "XRBodyModifier3D",
- "XRCamera3D",
- "XRController3D",
- "XRFaceModifier3D",
- "XRHandModifier3D",
- "XRNode3D",
- "XROrigin3D",
- # Resources
- "Resource",
- "AnimatedTexture",
- "Animation",
- "AnimationLibrary",
- "AnimationNode",
- "AnimationNodeAdd2",
- "AnimationNodeAdd3",
- "AnimationNodeAnimation",
- "AnimationNodeBlend2",
- "AnimationNodeBlend3",
- "AnimationNodeBlendSpace1D",
- "AnimationNodeBlendSpace2D",
- "AnimationNodeBlendTree",
- "AnimationNodeExtension",
- "AnimationNodeOneShot",
- "AnimationNodeOutput",
- "AnimationNodeStateMachine",
- "AnimationNodeStateMachinePlayback",
- "AnimationNodeStateMachineTransition",
- "AnimationNodeSub2",
- "AnimationNodeSync",
- "AnimationNodeTimeScale",
- "AnimationNodeTimeSeek",
- "AnimationNodeTransition",
- "AnimationRootNode",
- "ArrayMesh",
- "ArrayOccluder3D",
- "AtlasTexture",
- "AudioBusLayout",
- "AudioEffect",
- "AudioEffectAmplify",
- "AudioEffectBandLimitFilter",
- "AudioEffectBandPassFilter",
- "AudioEffectCapture",
- "AudioEffectChorus",
- "AudioEffectCompressor",
- "AudioEffectDelay",
- "AudioEffectDistortion",
- "AudioEffectEQ",
- "AudioEffectEQ10",
- "AudioEffectEQ21",
- "AudioEffectEQ6",
- "AudioEffectFilter",
- "AudioEffectHardLimiter",
- "AudioEffectHighPassFilter",
- "AudioEffectHighShelfFilter",
- "AudioEffectLimiter",
- "AudioEffectLowPassFilter",
- "AudioEffectLowShelfFilter",
- "AudioEffectNotchFilter",
- "AudioEffectPanner",
- "AudioEffectPhaser",
- "AudioEffectPitchShift",
- "AudioEffectRecord",
- "AudioEffectReverb",
- "AudioEffectSpectrumAnalyzer",
- "AudioEffectStereoEnhance",
- "AudioStream",
- "AudioStreamGenerator",
- "AudioStreamInteractive",
- "AudioStreamMicrophone",
- "AudioStreamMP3",
- "AudioStreamOggVorbis",
- "AudioStreamPlaylist",
- "AudioStreamPolyphonic",
- "AudioStreamRandomizer",
- "AudioStreamSynchronized",
- "AudioStreamWAV",
- "BaseMaterial3D",
- "BitMap",
- "BoneMap",
- "BoxMesh",
- "BoxOccluder3D",
- "BoxShape3D",
- "ButtonGroup",
- "CameraAttributes",
- "CameraAttributesPhysical",
- "CameraAttributesPractical",
- "CameraTexture",
- "CanvasItemMaterial",
- "CanvasTexture",
- "CapsuleMesh",
- "CapsuleShape2D",
- "CapsuleShape3D",
- "CircleShape2D",
- "CodeHighlighter",
- "ColorPalette",
- "Compositor",
- "CompositorEffect",
- "CompressedCubemap",
- "CompressedCubemapArray",
- "CompressedTexture2D",
- "CompressedTexture2DArray",
- "CompressedTexture3D",
- "CompressedTextureLayered",
- "ConcavePolygonShape2D",
- "ConcavePolygonShape3D",
- "ConvexPolygonShape2D",
- "ConvexPolygonShape3D",
- "CryptoKey",
- "CSharpScript",
- "Cubemap",
- "CubemapArray",
- "Curve",
- "Curve2D",
- "Curve3D",
- "CurveTexture",
- "CurveXYZTexture",
- "CylinderMesh",
- "CylinderShape3D",
- "EditorNode3DGizmoPlugin",
- "EditorSettings",
- "EditorSyntaxHighlighter",
- "Environment",
- "ExternalTexture",
- "FastNoiseLite",
- "FBXDocument",
- "FBXState",
- "FogMaterial",
- "Font",
- "FontFile",
- "FontVariation",
- "GDExtension",
- "GDScript",
- "GDScriptSyntaxHighlighter",
- "GLTFAccessor",
- "GLTFAnimation",
- "GLTFBufferView",
- "GLTFCamera",
- "GLTFDocument",
- "GLTFDocumentExtension",
- "GLTFDocumentExtensionConvertImporterMesh",
- "GLTFLight",
- "GLTFMesh",
- "GLTFNode",
- "GLTFPhysicsBody",
- "GLTFPhysicsShape",
- "GLTFSkeleton",
- "GLTFSkin",
- "GLTFSpecGloss",
- "GLTFState",
- "GLTFTexture",
- "GLTFTextureSampler",
- "Gradient",
- "GradientTexture1D",
- "GradientTexture2D",
- "HeightMapShape3D",
- "Image",
- "ImageTexture",
- "ImageTexture3D",
- "ImageTextureLayered",
- "ImmediateMesh",
- "ImporterMesh",
- "InputEvent",
- "InputEventAction",
- "InputEventFromWindow",
- "InputEventGesture",
- "InputEventJoypadButton",
- "InputEventJoypadMotion",
- "InputEventKey",
- "InputEventMagnifyGesture",
- "InputEventMIDI",
- "InputEventMouse",
- "InputEventMouseButton",
- "InputEventMouseMotion",
- "InputEventPanGesture",
- "InputEventScreenDrag",
- "InputEventScreenTouch",
- "InputEventShortcut",
- "InputEventWithModifiers",
- "JSON",
- "LabelSettings",
- "LightmapGIData",
- "Material",
- "Mesh",
- "MeshLibrary",
- "MeshTexture",
- "MissingResource",
- "MultiMesh",
- "NavigationMesh",
- "NavigationMeshSourceGeometryData2D",
- "NavigationMeshSourceGeometryData3D",
- "NavigationPolygon",
- "Noise",
- "NoiseTexture2D",
- "NoiseTexture3D",
- "Occluder3D",
- "OccluderPolygon2D",
- "OggPacketSequence",
- "OpenXRAction",
- "OpenXRActionBindingModifier",
- "OpenXRActionMap",
- "OpenXRActionSet",
- "OpenXRAnalogThresholdModifier",
- "OpenXRBindingModifier",
- "OpenXRDpadBindingModifier",
- "OpenXRHapticBase",
- "OpenXRHapticVibration",
- "OpenXRInteractionProfile",
- "OpenXRIPBinding",
- "OpenXRIPBindingModifier",
- "OptimizedTranslation",
- "ORMMaterial3D",
- "PackedDataContainer",
- "PackedScene",
- "PanoramaSkyMaterial",
- "ParticleProcessMaterial",
- "PhysicalSkyMaterial",
- "PhysicsMaterial",
- "PlaceholderCubemap",
- "PlaceholderCubemapArray",
- "PlaceholderMaterial",
- "PlaceholderMesh",
- "PlaceholderTexture2D",
- "PlaceholderTexture2DArray",
- "PlaceholderTexture3D",
- "PlaceholderTextureLayered",
- "PlaneMesh",
- "PointMesh",
- "PolygonOccluder3D",
- "PolygonPathFinder",
- "PortableCompressedTexture2D",
- "PrimitiveMesh",
- "PrismMesh",
- "ProceduralSkyMaterial",
- "QuadMesh",
- "QuadOccluder3D",
- "RDShaderFile",
- "RDShaderSPIRV",
- "RectangleShape2D",
- "RibbonTrailMesh",
- "RichTextEffect",
- "SceneReplicationConfig",
- "Script",
- "ScriptExtension",
- "SegmentShape2D",
- "SeparationRayShape2D",
- "SeparationRayShape3D",
- "Shader",
- "ShaderInclude",
- "ShaderMaterial",
- "Shape2D",
- "Shape3D",
- "Shortcut",
- "SkeletonModification2D",
- "SkeletonModification2DCCDIK",
- "SkeletonModification2DFABRIK",
- "SkeletonModification2DJiggle",
- "SkeletonModification2DLookAt",
- "SkeletonModification2DPhysicalBones",
- "SkeletonModification2DStackHolder",
- "SkeletonModification2DTwoBoneIK",
- "SkeletonModificationStack2D",
- "SkeletonProfile",
- "SkeletonProfileHumanoid",
- "Skin",
- "Sky",
- "SphereMesh",
- "SphereOccluder3D",
- "SphereShape3D",
- "SpriteFrames",
- "StandardMaterial3D",
- "StyleBox",
- "StyleBoxEmpty",
- "StyleBoxFlat",
- "StyleBoxLine",
- "StyleBoxTexture",
- "SyntaxHighlighter",
- "SystemFont",
- "TextMesh",
- "Texture",
- "Texture2D",
- "Texture2DArray",
- "Texture2DArrayRD",
- "Texture2DRD",
- "Texture3D",
- "Texture3DRD",
- "TextureCubemapArrayRD",
- "TextureCubemapRD",
- "TextureLayered",
- "TextureLayeredRD",
- "Theme",
- "TileMapPattern",
- "TileSet",
- "TileSetAtlasSource",
- "TileSetScenesCollectionSource",
- "TileSetSource",
- "TorusMesh",
- "Translation",
- "TubeTrailMesh",
- "VideoStream",
- "VideoStreamPlayback",
- "VideoStreamTheora",
- "ViewportTexture",
- "VisualShader",
- "VisualShaderNode",
- "VisualShaderNodeBillboard",
- "VisualShaderNodeBooleanConstant",
- "VisualShaderNodeBooleanParameter",
- "VisualShaderNodeClamp",
- "VisualShaderNodeColorConstant",
- "VisualShaderNodeColorFunc",
- "VisualShaderNodeColorOp",
- "VisualShaderNodeColorParameter",
- "VisualShaderNodeComment",
- "VisualShaderNodeCompare",
- "VisualShaderNodeConstant",
- "VisualShaderNodeCubemap",
- "VisualShaderNodeCubemapParameter",
- "VisualShaderNodeCurveTexture",
- "VisualShaderNodeCurveXYZTexture",
- "VisualShaderNodeCustom",
- "VisualShaderNodeDerivativeFunc",
- "VisualShaderNodeDeterminant",
- "VisualShaderNodeDistanceFade",
- "VisualShaderNodeDotProduct",
- "VisualShaderNodeExpression",
- "VisualShaderNodeFaceForward",
- "VisualShaderNodeFloatConstant",
- "VisualShaderNodeFloatFunc",
- "VisualShaderNodeFloatOp",
- "VisualShaderNodeFloatParameter",
- "VisualShaderNodeFrame",
- "VisualShaderNodeFresnel",
- "VisualShaderNodeGlobalExpression",
- "VisualShaderNodeGroupBase",
- "VisualShaderNodeIf",
- "VisualShaderNodeInput",
- "VisualShaderNodeIntConstant",
- "VisualShaderNodeIntFunc",
- "VisualShaderNodeIntOp",
- "VisualShaderNodeIntParameter",
- "VisualShaderNodeIs",
- "VisualShaderNodeLinearSceneDepth",
- "VisualShaderNodeMix",
- "VisualShaderNodeMultiplyAdd",
- "VisualShaderNodeOuterProduct",
- "VisualShaderNodeOutput",
- "VisualShaderNodeParameter",
- "VisualShaderNodeParameterRef",
- "VisualShaderNodeParticleAccelerator",
- "VisualShaderNodeParticleBoxEmitter",
- "VisualShaderNodeParticleConeVelocity",
- "VisualShaderNodeParticleEmit",
- "VisualShaderNodeParticleEmitter",
- "VisualShaderNodeParticleMeshEmitter",
- "VisualShaderNodeParticleMultiplyByAxisAngle",
- "VisualShaderNodeParticleOutput",
- "VisualShaderNodeParticleRandomness",
- "VisualShaderNodeParticleRingEmitter",
- "VisualShaderNodeParticleSphereEmitter",
- "VisualShaderNodeProximityFade",
- "VisualShaderNodeRandomRange",
- "VisualShaderNodeRemap",
- "VisualShaderNodeReroute",
- "VisualShaderNodeResizableBase",
- "VisualShaderNodeRotationByAxis",
- "VisualShaderNodeSample3D",
- "VisualShaderNodeScreenNormalWorldSpace",
- "VisualShaderNodeScreenUVToSDF",
- "VisualShaderNodeSDFRaymarch",
- "VisualShaderNodeSDFToScreenUV",
- "VisualShaderNodeSmoothStep",
- "VisualShaderNodeStep",
- "VisualShaderNodeSwitch",
- "VisualShaderNodeTexture",
- "VisualShaderNodeTexture2DArray",
- "VisualShaderNodeTexture2DArrayParameter",
- "VisualShaderNodeTexture2DParameter",
- "VisualShaderNodeTexture3D",
- "VisualShaderNodeTexture3DParameter",
- "VisualShaderNodeTextureParameter",
- "VisualShaderNodeTextureParameterTriplanar",
- "VisualShaderNodeTextureSDF",
- "VisualShaderNodeTextureSDFNormal",
- "VisualShaderNodeTransformCompose",
- "VisualShaderNodeTransformConstant",
- "VisualShaderNodeTransformDecompose",
- "VisualShaderNodeTransformFunc",
- "VisualShaderNodeTransformOp",
- "VisualShaderNodeTransformParameter",
- "VisualShaderNodeTransformVecMult",
- "VisualShaderNodeUIntConstant",
- "VisualShaderNodeUIntFunc",
- "VisualShaderNodeUIntOp",
- "VisualShaderNodeUIntParameter",
- "VisualShaderNodeUVFunc",
- "VisualShaderNodeUVPolarCoord",
- "VisualShaderNodeVarying",
- "VisualShaderNodeVaryingGetter",
- "VisualShaderNodeVaryingSetter",
- "VisualShaderNodeVec2Constant",
- "VisualShaderNodeVec2Parameter",
- "VisualShaderNodeVec3Constant",
- "VisualShaderNodeVec3Parameter",
- "VisualShaderNodeVec4Constant",
- "VisualShaderNodeVec4Parameter",
- "VisualShaderNodeVectorBase",
- "VisualShaderNodeVectorCompose",
- "VisualShaderNodeVectorDecompose",
- "VisualShaderNodeVectorDistance",
- "VisualShaderNodeVectorFunc",
- "VisualShaderNodeVectorLen",
- "VisualShaderNodeVectorOp",
- "VisualShaderNodeVectorRefract",
- "VisualShaderNodeWorldPositionFromDepth",
- "VoxelGIData",
- "World2D",
- "World3D",
- "WorldBoundaryShape2D",
- "WorldBoundaryShape3D",
- "X509Certificate",
- # Other objects
- "Object",
- "AESContext",
- "AStar2D",
- "AStar3D",
- "AStarGrid2D",
- "AudioEffectInstance",
- "AudioEffectSpectrumAnalyzerInstance",
- "AudioSample",
- "AudioSamplePlayback",
- "AudioServer",
- "AudioStreamGeneratorPlayback",
- "AudioStreamPlayback",
- "AudioStreamPlaybackInteractive",
- "AudioStreamPlaybackOggVorbis",
- "AudioStreamPlaybackPlaylist",
- "AudioStreamPlaybackPolyphonic",
- "AudioStreamPlaybackResampled",
- "AudioStreamPlaybackSynchronized",
- "CallbackTweener",
- "CameraFeed",
- "CameraServer",
- "CharFXTransform",
- "ClassDB",
- "ConfigFile",
- "Crypto",
- "DirAccess",
- "DisplayServer",
- "DTLSServer",
- "EditorContextMenuPlugin",
- "EditorDebuggerPlugin",
- "EditorDebuggerSession",
- "EditorExportPlatform",
- "EditorExportPlatformAndroid",
- "EditorExportPlatformExtension",
- "EditorExportPlatformIOS",
- "EditorExportPlatformLinuxBSD",
- "EditorExportPlatformMacOS",
- "EditorExportPlatformPC",
- "EditorExportPlatformWeb",
- "EditorExportPlatformWindows",
- "EditorExportPlugin",
- "EditorExportPreset",
- "EditorFeatureProfile",
- "EditorFileSystemDirectory",
- "EditorFileSystemImportFormatSupportQuery",
- "EditorImportPlugin",
- "EditorInspectorPlugin",
- "EditorInterface",
- "EditorNode3DGizmo",
- "EditorPaths",
- "EditorResourceConversionPlugin",
- "EditorResourcePreviewGenerator",
- "EditorResourceTooltipPlugin",
- "EditorSceneFormatImporter",
- "EditorSceneFormatImporterBlend",
- "EditorSceneFormatImporterFBX2GLTF",
- "EditorSceneFormatImporterGLTF",
- "EditorSceneFormatImporterUFBX",
- "EditorScenePostImport",
- "EditorScenePostImportPlugin",
- "EditorScript",
- "EditorSelection",
- "EditorTranslationParserPlugin",
- "EditorUndoRedoManager",
- "EditorVCSInterface",
- "EncodedObjectAsID",
- "ENetConnection",
- "ENetMultiplayerPeer",
- "ENetPacketPeer",
- "Engine",
- "EngineDebugger",
- "EngineProfiler",
- "Expression",
- "FileAccess",
- "FramebufferCacheRD",
- "GDExtensionManager",
- "Geometry2D",
- "Geometry3D",
- "GLTFObjectModelProperty",
- "HashingContext",
- "HMACContext",
- "HTTPClient",
- "ImageFormatLoader",
- "ImageFormatLoaderExtension",
- "Input",
- "InputMap",
- "IntervalTweener",
- "IP",
- "JavaClass",
- "JavaClassWrapper",
- "JavaObject",
- "JavaScriptBridge",
- "JavaScriptObject",
- "JNISingleton",
- "JSONRPC",
- "KinematicCollision2D",
- "KinematicCollision3D",
- "Lightmapper",
- "LightmapperRD",
- "MainLoop",
- "Marshalls",
- "MeshConvexDecompositionSettings",
- "MeshDataTool",
- "MethodTweener",
- "MobileVRInterface",
- "MovieWriter",
- "MultiplayerAPI",
- "MultiplayerAPIExtension",
- "MultiplayerPeer",
- "MultiplayerPeerExtension",
- "Mutex",
- "NativeMenu",
- "NavigationMeshGenerator",
- "NavigationPathQueryParameters2D",
- "NavigationPathQueryParameters3D",
- "NavigationPathQueryResult2D",
- "NavigationPathQueryResult3D",
- "NavigationServer2D",
- "NavigationServer3D",
- "Node",
- "Node3DGizmo",
- "OfflineMultiplayerPeer",
- "OggPacketSequencePlayback",
- "OpenXRAPIExtension",
- "OpenXRExtensionWrapperExtension",
- "OpenXRInteractionProfileMetadata",
- "OpenXRInterface",
- "OS",
- "PackedDataContainerRef",
- "PacketPeer",
- "PacketPeerDTLS",
- "PacketPeerExtension",
- "PacketPeerStream",
- "PacketPeerUDP",
- "PCKPacker",
- "Performance",
- "PhysicsDirectBodyState2D",
- "PhysicsDirectBodyState2DExtension",
- "PhysicsDirectBodyState3D",
- "PhysicsDirectBodyState3DExtension",
- "PhysicsDirectSpaceState2D",
- "PhysicsDirectSpaceState2DExtension",
- "PhysicsDirectSpaceState3D",
- "PhysicsDirectSpaceState3DExtension",
- "PhysicsPointQueryParameters2D",
- "PhysicsPointQueryParameters3D",
- "PhysicsRayQueryParameters2D",
- "PhysicsRayQueryParameters3D",
- "PhysicsServer2D",
- "PhysicsServer2DExtension",
- "PhysicsServer2DManager",
- "PhysicsServer3D",
- "PhysicsServer3DExtension",
- "PhysicsServer3DManager",
- "PhysicsServer3DRenderingServerHandler",
- "PhysicsShapeQueryParameters2D",
- "PhysicsShapeQueryParameters3D",
- "PhysicsTestMotionParameters2D",
- "PhysicsTestMotionParameters3D",
- "PhysicsTestMotionResult2D",
- "PhysicsTestMotionResult3D",
- "ProjectSettings",
- "PropertyTweener",
- "RandomNumberGenerator",
- "RDAttachmentFormat",
- "RDFramebufferPass",
- "RDPipelineColorBlendState",
- "RDPipelineColorBlendStateAttachment",
- "RDPipelineDepthStencilState",
- "RDPipelineMultisampleState",
- "RDPipelineRasterizationState",
- "RDPipelineSpecializationConstant",
- "RDSamplerState",
- "RDShaderSource",
- "RDTextureFormat",
- "RDTextureView",
- "RDUniform",
- "RDVertexAttribute",
- "RefCounted",
- "RegEx",
- "RegExMatch",
- "RenderData",
- "RenderDataExtension",
- "RenderDataRD",
- "RenderingDevice",
- "RenderingServer",
- "RenderSceneBuffers",
- "RenderSceneBuffersConfiguration",
- "RenderSceneBuffersExtension",
- "RenderSceneBuffersRD",
- "RenderSceneData",
- "RenderSceneDataExtension",
- "RenderSceneDataRD",
- "Resource",
- "ResourceFormatLoader",
- "ResourceFormatSaver",
- "ResourceImporter",
- "ResourceImporterBitMap",
- "ResourceImporterBMFont",
- "ResourceImporterCSVTranslation",
- "ResourceImporterDynamicFont",
- "ResourceImporterImage",
- "ResourceImporterImageFont",
- "ResourceImporterLayeredTexture",
- "ResourceImporterMP3",
- "ResourceImporterOBJ",
- "ResourceImporterOggVorbis",
- "ResourceImporterScene",
- "ResourceImporterShaderFile",
- "ResourceImporterTexture",
- "ResourceImporterTextureAtlas",
- "ResourceImporterWAV",
- "ResourceLoader",
- "ResourceSaver",
- "ResourceUID",
- "SceneMultiplayer",
- "SceneState",
- "SceneTree",
- "SceneTreeTimer",
- "ScriptLanguage",
- "ScriptLanguageExtension",
- "Semaphore",
- "ShaderIncludeDB",
- "SkinReference",
- "StreamPeer",
- "StreamPeerBuffer",
- "StreamPeerExtension",
- "StreamPeerGZIP",
- "StreamPeerTCP",
- "StreamPeerTLS",
- "SubtweenTweener",
- "SurfaceTool",
- "TCPServer",
- "TextLine",
- "TextParagraph",
- "TextServer",
- "TextServerAdvanced",
- "TextServerDummy",
- "TextServerExtension",
- "TextServerFallback",
- "TextServerManager",
- "ThemeDB",
- "Thread",
- "TileData",
- "Time",
- "TLSOptions",
- "TranslationDomain",
- "TranslationServer",
- "TreeItem",
- "TriangleMesh",
- "Tween",
- "Tweener",
- "UDPServer",
- "UndoRedo",
- "UniformSetCacheRD",
- "UPNP",
- "UPNPDevice",
- "WeakRef",
- "WebRTCDataChannel",
- "WebRTCDataChannelExtension",
- "WebRTCMultiplayerPeer",
- "WebRTCPeerConnection",
- "WebRTCPeerConnectionExtension",
- "WebSocketMultiplayerPeer",
- "WebSocketPeer",
- "WebXRInterface",
- "WorkerThreadPool",
- "XMLParser",
- "XRBodyTracker",
- "XRControllerTracker",
- "XRFaceTracker",
- "XRHandTracker",
- "XRInterface",
- "XRInterfaceExtension",
- "XRPose",
- "XRPositionalTracker",
- "XRServer",
- "XRTracker",
- "XRVRS",
- "ZIPPacker",
- "ZIPReader",
- # Editor-only
- "EditorCommandPalette",
- "EditorContextMenuPlugin",
- "EditorDebuggerPlugin",
- "EditorDebuggerSession",
- "EditorExportPlatform",
- "EditorExportPlatformAndroid",
- "EditorExportPlatformExtension",
- "EditorExportPlatformIOS",
- "EditorExportPlatformLinuxBSD",
- "EditorExportPlatformMacOS",
- "EditorExportPlatformPC",
- "EditorExportPlatformWeb",
- "EditorExportPlatformWindows",
- "EditorExportPlugin",
- "EditorExportPreset",
- "EditorFeatureProfile",
- "EditorFileDialog",
- "EditorFileSystem",
- "EditorFileSystemDirectory",
- "EditorFileSystemImportFormatSupportQuery",
- "EditorImportPlugin",
- "EditorInspector",
- "EditorInspectorPlugin",
- "EditorInterface",
- "EditorNode3DGizmo",
- "EditorNode3DGizmoPlugin",
- "EditorPaths",
- "EditorPlugin",
- "EditorProperty",
- "EditorResourceConversionPlugin",
- "EditorResourcePicker",
- "EditorResourcePreview",
- "EditorResourcePreviewGenerator",
- "EditorResourceTooltipPlugin",
- "EditorSceneFormatImporter",
- "EditorSceneFormatImporterBlend",
- "EditorSceneFormatImporterFBX2GLTF",
- "EditorSceneFormatImporterGLTF",
- "EditorSceneFormatImporterUFBX",
- "EditorScenePostImport",
- "EditorScenePostImportPlugin",
- "EditorScript",
- "EditorScriptPicker",
- "EditorSelection",
- "EditorSettings",
- "EditorSpinSlider",
- "EditorSyntaxHighlighter",
- "EditorToaster",
- "EditorTranslationParserPlugin",
- "EditorUndoRedoManager",
- "EditorVCSInterface",
- "FileSystemDock",
- "ScriptCreateDialog",
- "ScriptEditor",
- "ScriptEditorBase",
- ),
- prefix=r"(?<!\.)",
- suffix=r"\b",
- ),
- Name.Builtin,
- ),
- # NOTE: from github.com/godotengine/godot-docs
- (
- words(
- (
- # modules/gdscript/doc_classes/@GDScript.xml
- "@abstract",
- "@export",
- "@export_category",
- "@export_color_no_alpha",
- "@export_custom",
- "@export_dir",
- "@export_enum",
- "@export_exp_easing",
- "@export_file",
- "@export_file_path",
- "@export_flags",
- "@export_flags_2d_navigation",
- "@export_flags_2d_physics",
- "@export_flags_2d_render",
- "@export_flags_3d_navigation",
- "@export_flags_3d_physics",
- "@export_flags_3d_render",
- "@export_flags_avoidance",
- "@export_global_dir",
- "@export_global_file",
- "@export_group",
- "@export_multiline",
- "@export_node_path",
- "@export_placeholder",
- "@export_range",
- "@export_storage",
- "@export_subgroup",
- "@export_tool_button",
- "@icon",
- "@onready",
- "@rpc",
- "@static_unload",
- "@tool",
- "@warning_ignore",
- "@warning_ignore_restore",
- "@warning_ignore_start",
- ),
- prefix=r"(?<!\.)",
- suffix=r"\b",
- ),
- Name.Decorator,
- ),
- ],
- "operator": [
- (
- r"!=|==|<<|>>|&&|\+=|-=|\*=|/=|%=|&=|\|=|\|\||[-~+/*%=<>&^.!|$]",
- Operator,
- ),
- (r"(in|is|and|as|or|not)\b", Operator.Word),
- ],
- "number": [
- (r"([\d_]+\.[\d_]*|[\d_]*\.[\d_]+)([eE][+-]?[\d_]+)?", Number.Float),
- (r"[\d_]+[eE][+-]?[\d_]+", Number.Float),
- (r"0[xX][a-fA-F\d_]+", Number.Hex),
- (r"(-)?0[bB]([01]|(?<=[01])_)+", Number.Bin),
- (r"[\d_]+", Number.Integer),
- ],
- "name": [(r"[a-zA-Z_]\w*", Name)],
- "typehint": [
- (r"[a-zA-Z_]\w*", Name.Class, "#pop"),
- ],
- "string_escape": [
- (
- r'\\([\\abfnrtv"\']|\n|N\{.*?\}|u[a-fA-F0-9]{4}|'
- r"U[a-fA-F0-9]{6}|x[a-fA-F0-9]{2}|[0-7]{1,3})",
- String.Escape,
- )
- ],
- "string_single": inner_string_rules(String.Single),
- "string_double": inner_string_rules(String.Double),
- "string_other": inner_string_rules(String.Other),
- "string_stringname": inner_string_rules(String.StringName),
- "string_nodepath": inner_string_rules(String.NodePath),
- "double_quotes": [
- (r'"', String.Double, "#pop"),
- (r'\\\\|\\"|\\\n', String.Escape), # included here for raw strings
- include("string_double"),
- ],
- "single_quotes": [
- (r"'", String.Single, "#pop"),
- (r"\\\\|\\'|\\\n", String.Escape), # included here for raw strings
- include("string_single"),
- ],
- "triple_double_quotes": [
- (r'"""', String.Double, "#pop"),
- include("string_double"),
- include("whitespace"),
- ],
- "triple_single_quotes": [
- (r"'''", String.Single, "#pop"),
- include("string_single"),
- include("whitespace"),
- ],
- "node_reference": [
- (r'[\$%]"', String.Other, include("node_reference_double")),
- (r"[\$%]'", String.Other, include("node_reference_single")),
- (r"[\$%][A-Za-z_][\w/]*/?", String.Other),
- ],
- "node_reference_double": [
- (r'"', String.Other, "#pop"),
- include("string_other"),
- ],
- "node_reference_single": [
- (r"'", String.Other, "#pop"),
- include("string_other"),
- ],
- "stringname": [
- (r'[&]"', String.StringName, include("stringname_double")),
- (r"[&]'", String.StringName, include("stringname_single")),
- ],
- "stringname_double": [
- (r'"', String.StringName, "#pop"),
- include("string_stringname"),
- ],
- "stringname_single": [
- (r"'", String.StringName, "#pop"),
- include("string_stringname"),
- ],
- "nodepath": [
- (r'[\^]"', String.NodePath, include("nodepath_double")),
- (r"[\^]'", String.NodePath, include("nodepath_single")),
- ],
- "nodepath_double": [
- (r'"', String.NodePath, "#pop"),
- include("string_nodepath"),
- ],
- "nodepath_single": [
- (r"'", String.NodePath, "#pop"),
- include("string_nodepath"),
- ],
- "function_name": [(r"[a-zA-Z_]\w*", Name.Function.Declaration, "#pop")],
- "enum_name": [(r"[a-zA-Z_]\w*", Name, "#pop")],
- "function": [
- (r"\b([a-zA-Z_]\w*)\s*(?=\()", Name.Function),
- (
- # colored like functions, even without braces
- words(("set", "get",), suffix=r"\b", ),
- Name.Function,
- ),
- ],
- #######################################################################
- # LEXER ENTRY POINT
- #######################################################################
- "root": [
- include("whitespace"),
- include("comment"),
- include("punctuation"),
- include("builtin"),
- # strings
- include("stringname"),
- include("nodepath"),
- include("node_reference"),
- (
- '(r)(""")',
- bygroups(String.Affix, String.Double),
- "triple_double_quotes",
- ),
- (
- "(r)(''')",
- bygroups(String.Affix, String.Single),
- "triple_single_quotes",
- ),
- (
- '(r)(")',
- bygroups(String.Affix, String.Double),
- "double_quotes",
- ),
- (
- "(r)(')",
- bygroups(String.Affix, String.Single),
- "single_quotes",
- ),
- (
- '(r?)(""")',
- bygroups(String.Affix, String.Double),
- combined("string_escape", "triple_double_quotes"),
- ),
- (
- "(r?)(''')",
- bygroups(String.Affix, String.Single),
- combined("string_escape", "triple_single_quotes"),
- ),
- (
- '(r?)(")',
- bygroups(String.Affix, String.Double),
- combined("string_escape", "double_quotes"),
- ),
- (
- "(r?)(')",
- bygroups(String.Affix, String.Single),
- combined("string_escape", "single_quotes"),
- ),
- # consider Name after a . as instance/members variables
- (r"(?<!\.)(\.)([a-zA-Z_]\w*)\b(?!\s*\()", bygroups(Operator, Name.Variable.Instance)),
- include("operator"),
- # Lookahead to not match the start of function_name to dodge errors on nameless lambdas
- (r"(func)(\s+)(?=[a-zA-Z_])", bygroups(Keyword, Whitespace), "function_name"),
- (r"(enum)(\s+)(?=[a-zA-Z_])", bygroups(Keyword, Whitespace), "enum_name"),
- include("keyword"),
- include("function"),
- # NOTE:
- # This matches all PascalCase as a class. If this raises issues
- # please report it.
- # see: https://docs.godotengine.org/en/stable/tutorials/scripting/gdscript/gdscript_styleguide.html#naming-conventions
- #(r"\s*([A-Z][a-zA-Z0-9_]*)", Name.Class),
- # Only PascalCase, but exclude SCREAMING_SNAKE for constants
- (r"\b([A-Z][a-z0-9]+(?:[A-Z][a-z0-9]+)*)\b", Name.Class),
- include("name"),
- include("number"),
- ],
- }
- def setup(sphinx):
- sphinx.add_lexer("gdscript", GDScriptLexer)
- return {
- "parallel_read_safe": True,
- "parallel_write_safe": True,
- }
|