Commit Graph

54 Commits

Author SHA1 Message Date
1085200f51 GDScript: Replace abstract keyword with @abstract annotation
Co-authored-by: Danil Alexeev <dalexeev12@yandex.ru>
2025-06-23 12:24:45 -07:00
ee121ef80e GDScript: Add support for variadic functions 2025-06-09 21:53:05 +03:00
a7cf2069d5 GDScript: Add abstract methods
Co-authored-by: ryanabx <ryanbrue@hotmail.com>
2025-06-09 20:11:58 +03:00
067704f1cd Add a keyword for abstract classes in GDScript
Co-authored-by: Danil Alexeev <danil@alexeev.xyz>
2025-05-02 00:03:04 -07:00
5c662f7707 Add errors for keywords removed in Godot 4
Update modules/gdscript/gdscript_parser.cpp

Co-authored-by: Danil Alexeev <dalexeev12@yandex.ru>

Improve error message

Add tests

Add errors for other removed keywords

Remove very old keywords and improve wording of errors
2025-04-24 22:32:34 -07:00
ab208af781 Merge pull request #100174 from Calinou/gdscript-add-deprecated-experimental-annotations
Tweak unknown annotation GDScript error for `@deprecated`/`@experimental`/`@tutorial`
2024-12-11 17:35:50 -06:00
79dd5179e3 Merge pull request #99887 from JackErb/gdscript-parser-error-fix
Improve misleading `Unexpected "x" in class body.` GDScript parser error
2024-12-10 14:15:50 -06:00
13fcb05e7b Improve GDScript "unexpected token in class body" parser error
This parser error was misleading.

Fixes:
1. Now points at correct line
2. For identifiers, prints out `Identifier "%s"`
2024-12-09 21:01:46 -08:00
6095a37d64 Tweak unknown annotation GDScript error for @deprecated/@experimental/@tutorial
These annotations don't exist at a source level, so the error messages
point to the documentation comment syntax.
2024-12-09 22:18:35 +01:00
7d65d0a908 GDScript: Add @warning_ignore_start and @warning_ignore_restore annotations 2024-12-06 15:37:02 +03:00
f86dcd4e67 GDScript: Support tracking multiple analyzer and runtime errors in tests 2024-11-21 22:09:50 +03:00
140c6a612e GDScript: Fix annotation parsing adding new annotation entries 2024-10-13 22:43:06 +02:00
85dfd89653 Add @export_tool_button annotation for easily creating inspector buttons
Co-authored-by: jordi <creptthrust@gmail.com>
Co-authored-by: K. S. Ernest (iFire) Lee <ernest.lee@chibifire.com>
Co-authored-by: Mack <86566939+Macksaur@users.noreply.github.com>
2024-09-27 22:24:15 +01:00
ef1909fca3 GDScript: Fix @warning_ignore annotation issues 2024-03-12 19:00:06 +03:00
0acc4276b6 Merge pull request #82952 from AbelToy/gds-export-array
Allow `@export`ed Arrays to set property hints for their elements
2024-03-06 09:49:53 +01:00
882441a0ad Support Array and PackedArray in @export_* 2024-03-06 16:17:54 +09:00
1e61e42250 [GDScript] Fix some test file paths 2024-03-04 19:11:28 +01:00
b4d0a09f15 GDScript: Reintroduce binary tokenization on export
This adds back a function available in 3.x: exporting the GDScript
files in a binary form by converting the tokens recognized by the
tokenizer into a data format.

It is enabled by default on export but can be manually disabled. The
format helps with loading times since, the tokens are easily
reconstructed, and with hiding the source code, since recovering it
would require a specialized tool. Code comments are not stored in this
format.

The `--test` command can also include a `--use-binary-tokens` flag
which will run the GDScript tests with the binary format instead of the
regular source code by converting them in-memory before the test runs.
2024-02-08 11:20:05 -03:00
745f8e112f Revert "Add UID support to GDScript files"
This reverts commit c7f68a27ec.

We still think GDScript files need UIDs to allow safe refactoring,
but we're still debating what form those should take exactly.

So far there seems to be agreement that it shouldn't be done via an
annotation as implemented here, so we're reverting this one for now,
to revisit the feature in a future PR.
2024-01-29 21:00:26 +01:00
c7f68a27ec Add UID support to GDScript files 2024-01-17 22:30:56 +01:00
54a1414500 GDScript: Implement pattern guards for match statement
Within a match statement, it is now possible to add guards in each
branch:

	var a = 0
	match a:
		0 when false: print("does not run")
		0 when true: print("but this does")

This allows more complex logic for deciding which branch to take.
2023-09-27 11:25:25 -03:00
2964c7d51c GDScript: Add raw string literals (r-strings) 2023-09-11 18:34:33 +03:00
8a06ec979e Change explicit 'Godot 4.0' references to 'Godot 4'
Fixes #79276.
2023-07-10 13:08:11 +02:00
bf04c55175 Fix lambda parsing continuing on subsequent lines #73273 2023-06-21 12:56:57 +02:00
fba8cbe6db GDScript: Fix repeated _ are allowed after decimal point 2023-06-14 21:47:12 +03:00
0ba6048ad3 Add support for static variables in GDScript
Which allows editable data associated with a particular class instead of
the instance. Scripts with static variables are kept in memory
indefinitely unless the `@static_unload` annotation is used or the
`static_unload()` method is called on the GDScript.

If the custom function `_static_init()` exists it will be called when
the class is loaded, after the static variables are set.
2023-04-27 09:51:44 -03:00
dbc3c82043 GDScript: Add some checks for @tool and @icon 2023-04-20 07:44:10 +03:00
5038a336be GDScript: Fix and improve annotation parsing 2023-04-14 21:28:46 +03:00
b0b1eaeb6d GDScript: Fix parsing unexpected break/continue in lambda 2023-02-23 10:49:06 +02:00
1bbe0a2b2f Fix global script class parsing.
* Broke with #72226
* Restored previous version of the code, made it even more error tolerant.
* Added a warning to **not** change the code.

Fixes #72226.
2023-01-31 12:43:25 +01:00
13215638a9 Clarify error message about script-level annotation 2023-01-24 13:10:45 +03:00
7548e043fc Add support for Unicode identifiers in GDScript
This is using an adapted version of UAX#31 to not rely on the ICU
database (which isn't available in builds without TextServerAdvanced).
It allows most characters used in diverse scripts but not everything.
2023-01-21 13:39:40 -03:00
1c3653e083 Merge pull request #67774 from aaronfranke/script-annotations
Make script annotations be placed before `class_name` and `extends`
2023-01-16 22:20:44 +01:00
44d1d72af1 Add GDScript .editorconfig rules
- Uniformize `.gd` unit test files indentation to tabs (where needed)
2023-01-10 12:25:35 -05:00
6590e1fd8a Make script annotations placed before class_name and extends 2022-12-19 22:01:29 -06:00
f0eb3ac5d3 Merge pull request #62701 from cdemirer/for-variable-conflict 2022-07-06 16:02:49 +02:00
f85bafaa11 Add grouping annotations for class properties in GDScript 2022-07-05 22:01:40 +03:00
dbdf0174b4 Do error when for variable conflicts with a variable in scope 2022-07-04 12:30:39 +03:00
eba3e0a9fc GDScript: Support % in shorthand for get_node
The `%` is used in scene unique nodes. Now `%` can also be used instead
of `$` for the shorthand, besides being allowed generally anywhere in
the path as the prefix for a node name.
2022-05-27 13:46:18 -03:00
0a28b4cd94 GDScript: Do not allow standalone lambdas
They cannot be accessed in this case, so an error is shown to avoid
misleading the uses, especially in case of named lambdas.
2022-05-23 12:25:03 -03:00
3c5b9d1be3 Fix issues with multiple bind patterns in match statement 2022-04-04 15:47:08 +08:00
1a15a3adf6 Fix GDScript parser crash on 'dollar mixed with assignment' expression
fixes #53696
2021-11-21 21:18:46 +01:00
626ca50676 Improve GDScript indentation error message 2021-10-28 13:01:53 +02:00
262d6c6bef GDScript: Show specific error when "yield" is used
To help people porting code, it gives a hint to use "await" instead of a
generic error.
2021-09-21 14:38:14 -03:00
82c12060b2 Merge pull request #52718 from Calinou/gdscript-add-integration-tests-2 2021-09-21 14:13:24 +02:00
651319de11 GDScript: Properly catch error when missing index in subscript 2021-09-17 14:31:51 -03:00
c6ca09dc6f Add more integration tests to the GDScript test suite
This also fixes a typo in the `bitwise_float_right_operand.gd` test.
2021-09-15 19:57:39 +02:00
a4187c9235 Merge pull request #52706 from vnen/gdscript-ternary-operator-crash
GDScript: Show error when missing expression after ternary else
2021-09-15 17:20:52 +02:00
107af38fd1 GDScript: Show error when missing expression after ternary else 2021-09-15 11:43:36 -03:00
d49046938a GDScript: Show error on unary operators without argument 2021-09-15 11:08:59 -03:00