mirror of
https://github.com/cheat/cheat.git
synced 2024-12-25 14:09:44 +01:00
1790aec85d
Bump `alecthomas/chroma` to `v2`: https://github.com/cheat/cheat/issues/735
271 lines
13 KiB
XML
271 lines
13 KiB
XML
<lexer>
|
|
<config>
|
|
<name>GDScript3</name>
|
|
<alias>gdscript3</alias>
|
|
<alias>gd3</alias>
|
|
<filename>*.gd</filename>
|
|
<mime_type>text/x-gdscript</mime_type>
|
|
<mime_type>application/x-gdscript</mime_type>
|
|
<analyse>
|
|
<regex pattern="func (_ready|_init|_input|_process|_unhandled_input)" score="0.8"/>
|
|
<regex pattern="(extends |class_name |onready |preload|load|setget|func [^_])" score="0.4"/>
|
|
<regex pattern="(var|const|enum|export|signal|tool)" score="0.2"/>
|
|
</analyse>
|
|
</config>
|
|
<rules>
|
|
<state name="builtins">
|
|
<rule pattern="(?<!\.)(instance_from_id|nearest_po2|print_stack|type_exist|rand_range|linear2db|var2bytes|dict2inst|randomize|bytes2var|rand_seed|db2linear|inst2dict|printerr|printraw|decimals|preload|deg2rad|str2var|stepify|var2str|convert|weakref|fposmod|funcref|rad2deg|dectime|printt|is_inf|is_nan|assert|Color8|typeof|ColorN|prints|floor|atan2|yield|randf|print|range|clamp|round|randi|sqrt|tanh|cosh|ceil|ease|acos|load|fmod|lerp|seed|sign|atan|sinh|hash|asin|sin|str|cos|tan|pow|exp|min|abs|log|max)\b">
|
|
<token type="NameBuiltin"/>
|
|
</rule>
|
|
<rule pattern="(?<!\.)(self|false|true|PI|NAN|INF)\b">
|
|
<token type="NameBuiltinPseudo"/>
|
|
</rule>
|
|
<rule pattern="(?<!\.)(Physics2DShapeQueryParameters|PhysicsShapeQueryParameters|Physics2DDirectBodyStateSW|NavigationPolygonInstance|ResourceInteractiveLoader|Physics2DDirectSpaceState|Physics2DShapeQueryResult|Physics2DTestMotionResult|InputEventJoystickButton|InputEventJoystickMotion|Physics2DDirectBodyState|PhysicsDirectBodyStateSW|PhysicsShapeQueryResult|PhysicsDirectSpaceState|SpatialSound2DServerSW|PackedDataContainerRef|NavigationMeshInstance|ResourceImportMetadata|PhysicsDirectBodyState|ConcavePolygonShape2D|CanvasItemShaderGraph|EditorScenePostImport|InputEventScreenTouch|InputEventMouseButton|InputEventMouseMotion|SpatialSound2DServer|AudioStreamOGGVorbis|VisibilityNotifier2D|InputEventScreenDrag|ConvexPolygonShape2D|SpatialSoundServerSW|ParticleAttractor2D|PackedDataContainer|SpatialStreamPlayer|RenderTargetTexture|AnimationTreePlayer|ConcavePolygonShape|InstancePlaceholder|MaterialShaderGraph|AudioStreamPlayback|VisibilityEnabler2D|SpatialSamplePlayer|DampedSpringJoint2D|InterpolatedCamera|ConvexPolygonShape|ConfirmationDialog|SpatialSoundServer|BakedLightInstance|ParallaxBackground|CollisionPolygon2D|CanvasItemMaterial|VisibilityNotifier|EditorImportPlugin|VideoStreamTheora|TouchScreenButton|ResourcePreloader|OccluderPolygon2D|BakedLightSampler|CollisionObject2D|RemoteTransform2D|PolygonPathFinder|StyleBoxImageMask|NavigationPolygon|TranslationServer|MultiMeshInstance|ImmediateGeometry|Physics2DServerSW|ColorPickerButton|VisibilityEnabler|PHashTranslation|RectangleShape2D|DirectionalLight|AnimatedSprite3D|WorldEnvironment|CollisionShape2D|EventStreamChibi|InputEventAction|CollisionPolygon|AudioStreamSpeex|EditorFileDialog|GeometryInstance|Generic6DOFJoint|PacketPeerStream|CanvasItemShader|KinematicBody2D|StyleBoxTexture|PhysicsServerSW|VSplitContainer|CenterContainer|GDFunctionState|AudioStreamOpus|TextureProgress|MarginContainer|CollisionObject|LightOccluder2D|AnimationPlayer|HSplitContainer|ScrollContainer|SoundRoomParams|Physics2DServer|MaterialShader|ShaderMaterial|ViewportSprite|SplitContainer|AudioStreamMPC|VisualInstance|PanelContainer|BackBufferCopy|SamplePlayer2D|CanvasModulate|ResourceLoader|CapsuleShape2D|ReferenceFrame|NavigationMesh|CollisionShape|ConeTwistJoint|ProximityGroup|AnimatedSprite|SegmentShape2D|BoneAttachment|RichTextLabel|CircleShape2D|VBoxContainer|PacketPeerUDP|SpatialPlayer|TextureButton|KinematicBody|SoundPlayer2D|PhysicsServer|ParallaxLayer|InputEventKey|GrooveJoint2D|PhysicsBody2D|FixedMaterial|GridContainer|HBoxContainer|StreamPeerSSL|StyleBoxEmpty|StreamPeerTCP|SampleLibrary|GDNativeClass|AudioServerSW|ResourceSaver|SpriteBase3D|StreamPlayer|AtlasTexture|VisualServer|SamplePlayer|StyleBoxFlat|StaticBody2D|SpriteFrames|MeshDataTool|MeshInstance|Vector3Array|BoxContainer|TabContainer|HButtonArray|LargeTexture|Navigation2D|WindowDialog|EditorScript|EditorPlugin|TextureFrame|AcceptDialog|ImageTexture|CapsuleShape|VehicleWheel|VButtonArray|Vector2Array|InputDefault|OptionButton|PathFollow2D|VehicleBody|ColorPicker|PopupDialog|ProgressBar|CanvasLayer|Translation|Environment|EventPlayer|VideoPlayer|EventStream|VideoStream|ButtonGroup|Particles2D|Patch9Frame|ButtonArray|SurfaceTool|MeshLibrary|PackedScene|PhysicsBody|AudioStream|Performance|StringArray|AudioServer|RigidBody2D|LineShape2D|SliderJoint|SphereShape|ShaderGraph|CheckButton|StreamPeer|FileDialog|PathFollow|SceneState|RoomBounds|Dictionary|VSeparator|PacketPeer|VScrollBar|MenuButton|HTTPClient|PinJoint2D|BakedLight|PlaneShape|InputEvent|BaseButton|HSeparator|HScrollBar|Navigation|PopupPanel|StaticBody|Position2D|Position3D|ToolButton|HingeJoint|CanvasItem|RayShape2D|ColorArray|ConfigFile|TCP_Server|RayCast2D|ColorRamp|SpotLight|RealArray|GraphNode|Container|Reference|PopupMenu|Separator|Polygon2D|MultiMesh|Semaphore|Transform|OmniLight|GraphEdit|Particles|Animation|Marshalls|SceneTree|RigidBody|XMLParser|PathRemap|ScrollBar|Directory|PCKPacker|RawArray|TextEdit|MainLoop|TreeItem|StyleBox|Material|Geometry|Matrix32|Resource|UndoRedo|RayShape|TestCube|ItemList|CheckBox|Camera2D|Skeleton|Sprite3D|Viewport|NodePath|IntArray|BoxShape|PinJoint|InputMap|LineEdit|GDScript|Vector3|TileMap|HSlider|Spatial|SpinBox|World2D|IP_Unix|Curve2D|Curve3D|WeakRef|GridMap|Matrix3|VSlider|CubeMap|Joint2D|Globals|Shape2D|Texture|Control|TileSet|Light2D|FuncRef|Vector2|RayCast|Script|Node2D|Button|BitMap|Sample|Object|String|Shader|Area2D|Slider|Sprite|Thread|Path2D|Camera|Portal|float|Theme|World|YSort|Shape|Joint|Mutex|Tween|RegEx|Label|Rect2|Array|Plane|Light|Range|Color|Input|Popup|Panel|Timer|Image|Area|Quad|bool|AABB|Quat|File|Tabs|Path|Font|Tree|Room|Mesh|Node|RID|int|Nil|IP|OS)\b">
|
|
<token type="NameException"/>
|
|
</rule>
|
|
</state>
|
|
<state name="sqs">
|
|
<rule pattern="'">
|
|
<token type="LiteralStringSingle"/>
|
|
<pop depth="1"/>
|
|
</rule>
|
|
<rule pattern="\\\\|\\'|\\\n">
|
|
<token type="LiteralStringEscape"/>
|
|
</rule>
|
|
<rule>
|
|
<include state="strings-single"/>
|
|
</rule>
|
|
</state>
|
|
<state name="stringescape">
|
|
<rule pattern="\\([\\abfnrtv"\']|\n|N\{.*?\}|u[a-fA-F0-9]{4}|U[a-fA-F0-9]{8}|x[a-fA-F0-9]{2}|[0-7]{1,3})">
|
|
<token type="LiteralStringEscape"/>
|
|
</rule>
|
|
</state>
|
|
<state name="classname">
|
|
<rule pattern="[a-zA-Z_]\w*">
|
|
<token type="NameClass"/>
|
|
<pop depth="1"/>
|
|
</rule>
|
|
</state>
|
|
<state name="strings-single">
|
|
<rule pattern="%(\(\w+\))?[-#0 +]*([0-9]+|[*])?(\.([0-9]+|[*]))?[hlL]?[E-GXc-giorsux%]">
|
|
<token type="LiteralStringInterpol"/>
|
|
</rule>
|
|
<rule pattern="[^\\\'"%\n]+">
|
|
<token type="LiteralStringSingle"/>
|
|
</rule>
|
|
<rule pattern="[\'"\\]">
|
|
<token type="LiteralStringSingle"/>
|
|
</rule>
|
|
<rule pattern="%">
|
|
<token type="LiteralStringSingle"/>
|
|
</rule>
|
|
</state>
|
|
<state name="funcname">
|
|
<rule pattern="[a-zA-Z_]\w*">
|
|
<token type="NameFunction"/>
|
|
<pop depth="1"/>
|
|
</rule>
|
|
<rule>
|
|
<pop depth="1"/>
|
|
</rule>
|
|
</state>
|
|
<state name="numbers">
|
|
<rule pattern="(\d+\.\d*|\d*\.\d+)([eE][+-]?[0-9]+)?j?">
|
|
<token type="LiteralNumberFloat"/>
|
|
</rule>
|
|
<rule pattern="\d+[eE][+-]?[0-9]+j?">
|
|
<token type="LiteralNumberFloat"/>
|
|
</rule>
|
|
<rule pattern="0[xX][a-fA-F0-9]+">
|
|
<token type="LiteralNumberHex"/>
|
|
</rule>
|
|
<rule pattern="\d+j?">
|
|
<token type="LiteralNumberInteger"/>
|
|
</rule>
|
|
</state>
|
|
<state name="tdqs">
|
|
<rule pattern=""""">
|
|
<token type="LiteralStringDouble"/>
|
|
<pop depth="1"/>
|
|
</rule>
|
|
<rule>
|
|
<include state="strings-double"/>
|
|
</rule>
|
|
<rule pattern="\n">
|
|
<token type="LiteralStringDouble"/>
|
|
</rule>
|
|
</state>
|
|
<state name="name">
|
|
<rule pattern="[a-zA-Z_]\w*">
|
|
<token type="Name"/>
|
|
</rule>
|
|
</state>
|
|
<state name="root">
|
|
<rule pattern="\n">
|
|
<token type="Text"/>
|
|
</rule>
|
|
<rule pattern="^(\s*)([rRuUbB]{,2})("""(?:.|\n)*?""")">
|
|
<bygroups>
|
|
<token type="Text"/>
|
|
<token type="LiteralStringAffix"/>
|
|
<token type="LiteralStringDoc"/>
|
|
</bygroups>
|
|
</rule>
|
|
<rule pattern="^(\s*)([rRuUbB]{,2})('''(?:.|\n)*?''')">
|
|
<bygroups>
|
|
<token type="Text"/>
|
|
<token type="LiteralStringAffix"/>
|
|
<token type="LiteralStringDoc"/>
|
|
</bygroups>
|
|
</rule>
|
|
<rule pattern="[^\S\n]+">
|
|
<token type="Text"/>
|
|
</rule>
|
|
<rule pattern="#.*$">
|
|
<token type="CommentSingle"/>
|
|
</rule>
|
|
<rule pattern="[]{}:(),;[]">
|
|
<token type="Punctuation"/>
|
|
</rule>
|
|
<rule pattern="\\\n">
|
|
<token type="Text"/>
|
|
</rule>
|
|
<rule pattern="\\">
|
|
<token type="Text"/>
|
|
</rule>
|
|
<rule pattern="(in|and|or|not)\b">
|
|
<token type="OperatorWord"/>
|
|
</rule>
|
|
<rule pattern="!=|==|<<|>>|&&|\+=|-=|\*=|/=|%=|&=|\|=|\|\||[-~+/*%=<>&^.!|$]">
|
|
<token type="Operator"/>
|
|
</rule>
|
|
<rule>
|
|
<include state="keywords"/>
|
|
</rule>
|
|
<rule pattern="(def)((?:\s|\\\s)+)">
|
|
<bygroups>
|
|
<token type="Keyword"/>
|
|
<token type="Text"/>
|
|
</bygroups>
|
|
<push state="funcname"/>
|
|
</rule>
|
|
<rule pattern="(class)((?:\s|\\\s)+)">
|
|
<bygroups>
|
|
<token type="Keyword"/>
|
|
<token type="Text"/>
|
|
</bygroups>
|
|
<push state="classname"/>
|
|
</rule>
|
|
<rule>
|
|
<include state="builtins"/>
|
|
</rule>
|
|
<rule pattern="([rR]|[uUbB][rR]|[rR][uUbB])(""")">
|
|
<bygroups>
|
|
<token type="LiteralStringAffix"/>
|
|
<token type="LiteralStringDouble"/>
|
|
</bygroups>
|
|
<push state="tdqs"/>
|
|
</rule>
|
|
<rule pattern="([rR]|[uUbB][rR]|[rR][uUbB])(''')">
|
|
<bygroups>
|
|
<token type="LiteralStringAffix"/>
|
|
<token type="LiteralStringSingle"/>
|
|
</bygroups>
|
|
<push state="tsqs"/>
|
|
</rule>
|
|
<rule pattern="([rR]|[uUbB][rR]|[rR][uUbB])(")">
|
|
<bygroups>
|
|
<token type="LiteralStringAffix"/>
|
|
<token type="LiteralStringDouble"/>
|
|
</bygroups>
|
|
<push state="dqs"/>
|
|
</rule>
|
|
<rule pattern="([rR]|[uUbB][rR]|[rR][uUbB])(')">
|
|
<bygroups>
|
|
<token type="LiteralStringAffix"/>
|
|
<token type="LiteralStringSingle"/>
|
|
</bygroups>
|
|
<push state="sqs"/>
|
|
</rule>
|
|
<rule pattern="([uUbB]?)(""")">
|
|
<bygroups>
|
|
<token type="LiteralStringAffix"/>
|
|
<token type="LiteralStringDouble"/>
|
|
</bygroups>
|
|
<combined state="stringescape" state="tdqs"/>
|
|
</rule>
|
|
<rule pattern="([uUbB]?)(''')">
|
|
<bygroups>
|
|
<token type="LiteralStringAffix"/>
|
|
<token type="LiteralStringSingle"/>
|
|
</bygroups>
|
|
<combined state="stringescape" state="tsqs"/>
|
|
</rule>
|
|
<rule pattern="([uUbB]?)(")">
|
|
<bygroups>
|
|
<token type="LiteralStringAffix"/>
|
|
<token type="LiteralStringDouble"/>
|
|
</bygroups>
|
|
<combined state="stringescape" state="dqs"/>
|
|
</rule>
|
|
<rule pattern="([uUbB]?)(')">
|
|
<bygroups>
|
|
<token type="LiteralStringAffix"/>
|
|
<token type="LiteralStringSingle"/>
|
|
</bygroups>
|
|
<combined state="stringescape" state="sqs"/>
|
|
</rule>
|
|
<rule>
|
|
<include state="name"/>
|
|
</rule>
|
|
<rule>
|
|
<include state="numbers"/>
|
|
</rule>
|
|
</state>
|
|
<state name="keywords">
|
|
<rule pattern="(breakpoint|continue|onready|extends|signal|return|export|static|setget|switch|break|const|while|class|tool|pass|func|case|enum|else|elif|var|for|do|if)\b">
|
|
<token type="Keyword"/>
|
|
</rule>
|
|
</state>
|
|
<state name="dqs">
|
|
<rule pattern=""">
|
|
<token type="LiteralStringDouble"/>
|
|
<pop depth="1"/>
|
|
</rule>
|
|
<rule pattern="\\\\|\\"|\\\n">
|
|
<token type="LiteralStringEscape"/>
|
|
</rule>
|
|
<rule>
|
|
<include state="strings-double"/>
|
|
</rule>
|
|
</state>
|
|
<state name="tsqs">
|
|
<rule pattern="'''">
|
|
<token type="LiteralStringSingle"/>
|
|
<pop depth="1"/>
|
|
</rule>
|
|
<rule>
|
|
<include state="strings-single"/>
|
|
</rule>
|
|
<rule pattern="\n">
|
|
<token type="LiteralStringSingle"/>
|
|
</rule>
|
|
</state>
|
|
<state name="strings-double">
|
|
<rule pattern="%(\(\w+\))?[-#0 +]*([0-9]+|[*])?(\.([0-9]+|[*]))?[hlL]?[E-GXc-giorsux%]">
|
|
<token type="LiteralStringInterpol"/>
|
|
</rule>
|
|
<rule pattern="[^\\\'"%\n]+">
|
|
<token type="LiteralStringDouble"/>
|
|
</rule>
|
|
<rule pattern="[\'"\\]">
|
|
<token type="LiteralStringDouble"/>
|
|
</rule>
|
|
<rule pattern="%">
|
|
<token type="LiteralStringDouble"/>
|
|
</rule>
|
|
</state>
|
|
</rules>
|
|
</lexer>
|