| 1 |
filetype: gdscript |
| 2 |
|
| 3 |
detect: |
| 4 |
filename: "\\.gd$" |
| 5 |
|
| 6 |
rules: |
| 7 |
# Built-in constants |
| 8 |
- constant: "\\b(INF|NAN|PI|TAU)\\b" |
| 9 |
- constant.bool: "\\b(null|true|false)\\b" |
| 10 |
# Built-in functions |
| 11 |
- identifier: "\\b(abs|acos|asin|atan|atan2|ceil|clamp|convert|cos|cosh|db2linear|decimals|deg2rad|ease|exp|float|floor|fmod|fposmod|hash|int|isinf|isnan|lerp|linear2db|load|log|max|min|nearest_po2|pow|preload|print|printerr|printraw|prints|printt|rad2deg|rand_range|rand_seed|randomize|randi|randf|range|round|seed|sin|slerp|sqrt|str|str2var|tan|typeof|var2str|weakref)\\b" |
| 12 |
# Built-in node names |
| 13 |
- identifier: "\\b(AnimationPlayer|AnimationTreePlayer|Button|Control|Engine|HTTPClient|HTTPRequest|Input|InputEvent|MainLoop|Node|Node2D|OS|SceneTree|Spatial|StreamPeer|PacketPeer|PacketPeerUDP|Timer|Tween)\\b" |
| 14 |
# Types |
| 15 |
- type: "\\b(AABB|Array|Basis|Color|Dictionary|NodePath|Object|Plane|PoolByteArray|PoolColorArray|PoolIntArray|PoolRealArray|PoolVector2Array|PoolVector3Array|Quat|Rect2|RID|String|Transform|Transform2D|Vector2|Vector3)\\b" |
| 16 |
# Definitions |
| 17 |
- identifier: "func [a-zA-Z_0-9]+" |
| 18 |
# Keywords |
| 19 |
- statement: "\\b(and|as|assert|break|breakpoint|class|const|continue|elif|else|enum|export|extends|for|func|if|in|is|map|master|mastersync|match|not|onready|or|pass|remote|remotesync|return|self|setget|slave|slavesync|signal|sync|tool|var|while|yield)\\b" |
| 20 |
|
| 21 |
# Operators |
| 22 |
- statement: "[.:;,+*|=!\\%@]|<|>|/|-|&" |
| 23 |
|
| 24 |
# Parentheses |
| 25 |
- statement: "[(){}]|\\[|\\]" |
| 26 |
|
| 27 |
# Numbers |
| 28 |
- constant: "\\b[0-9]+\\b" |
| 29 |
- constant.number: "\\b([0-9]+|0x[0-9a-fA-F]*)\\b|'.'" |
| 30 |
|
| 31 |
- comment: |
| 32 |
start: "\"\"\"" |
| 33 |
end: "\"\"\"" |
| 34 |
rules: |
| 35 |
- todo: "(TODO|XXX|FIXME):?" |
| 36 |
|
| 37 |
- comment: |
| 38 |
start: "'''" |
| 39 |
end: "'''" |
| 40 |
rules: |
| 41 |
- todo: "(TODO|XXX|FIXME):?" |
| 42 |
|
| 43 |
- constant.string: |
| 44 |
start: "\"" |
| 45 |
end: "\"" |
| 46 |
skip: "\\\\." |
| 47 |
rules: |
| 48 |
- constant.specialChar: "\\\\([0-7]{3}|x[A-Fa-f0-9]{2}|u[A-Fa-f0-9]{4}|U[A-Fa-f0-9]{8})" |
| 49 |
|
| 50 |
- constant.string: |
| 51 |
start: "'" |
| 52 |
end: "'" |
| 53 |
skip: "\\\\." |
| 54 |
rules: |
| 55 |
- constant.specialChar: "\\\\([0-7]{3}|x[A-Fa-f0-9]{2}|u[A-Fa-f0-9]{4}|U[A-Fa-f0-9]{8})" |
| 56 |
|
| 57 |
- comment: |
| 58 |
start: "#" |
| 59 |
end: "$" |
| 60 |
rules: |
| 61 |
- todo: "(TODO|XXX|FIXME):?" |