Commit Graph

111 Commits

Author SHA1 Message Date
HolonProduction 06e732c3ed GDScript: Restore support for `Token::UNDERSCORE` in identifiers 2024-07-15 10:04:11 +02:00
Danil Alexeev 02253b6b91
GDScript: Fix continuation lines in `GDScriptTokenizerBuffer` 2024-04-10 08:51:02 +03:00
George Marques 72e5f8c31e
GDScript: Enable compression on export
Besides the regular option to export GDScript as binary tokens, this
also includes a compression option on top of it. The binary format
needs to encode some information which generally makes it bigger than
the source text. This option reduces that difference by using Zstandard
compression on the buffer.
2024-02-08 11:20:07 -03:00
George Marques 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
A Thousand Ships 66d55e62f0
[GDScript] Prevent running `String` number functions on invalid literal
Prevents printing excessive errors.
2024-02-04 14:35:22 +01:00
George Marques 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
Rémi Verschelde 888d3252ba
Merge pull request #81881 from lotuspar/patch-1
Rewrite a small comment in GDScript tokenizer code
2023-09-20 13:09:44 +02:00
Gio b6f1dbb340 Rewrite a bit of comment in tokenizer code
gdscript_tokenizer.cpp: `change` -> `changes`
2023-09-19 21:38:52 +08:00
Danil Alexeev 2964c7d51c
GDScript: Add raw string literals (r-strings) 2023-09-11 18:34:33 +03:00
Danil Alexeev 00ad9e484e
GDScript: Allow mixed indentation on blank lines 2023-08-17 10:54:43 +03:00
Yuri Sizov 62b4643d85 Merge pull request #73226 from AThousandShips/gdscript_tok_improvement
Improve GDScript identifier tokenization
2023-07-31 21:00:57 +02:00
Rémi Verschelde cfae05094a
Merge pull request #72824 from dalexeev/gds-invalid-char-error
GDScript: Fix invalid character error message
2023-06-19 15:39:58 +02:00
Rémi Verschelde 1ce2425c0e
Merge pull request #73363 from dalexeev/gds-fix-min-int-not-representable
GDScript: Fix `MIN_INT` not representable as numeric literal
2023-06-18 16:27:16 +02:00
Rémi Verschelde 3b4504afea
Merge pull request #75944 from akien-mga/style-modules-includes
Style: Harmonize header includes in modules
2023-06-15 15:26:14 +02:00
Rémi Verschelde 25b2f1780a
Style: Harmonize header includes in modules
This applies our existing style guide, and adds a new rule to that style
guide for modular components such as platform ports and modules:

Includes from the platform port or module ("local" includes) should be listed
first in their own block using relative paths, before Godot's "core" includes
which use "absolute" (project folder relative) paths, and finally thirdparty
includes.

Includes in `#ifdef`s come after their relevant section, i.e. the overall
structure is:

- Local includes
  * Conditional local includes
- Core includes
  * Conditional core includes
- Thirdparty includes
  * Conditional thirdparty includes
2023-06-15 14:35:45 +02:00
Danil Alexeev fba8cbe6db
GDScript: Fix repeated `_` are allowed after decimal point 2023-06-14 21:47:12 +03:00
Ninni Pipping f68beeb7fa Improvements to GDScript identifier tokenization 2023-04-26 16:29:04 +02:00
MistMage fecbc12d17 Fix for mixed tabs and spaces in gdscript 2023-04-20 12:08:23 +02:00
Danil Alexeev d15511725a
GDScript: Fix `MIN_INT` not representable as numeric literal 2023-02-15 17:41:46 +03:00
George Marques 03ea77407c
GDScript: Be more lenient with identifiers
- Allow identifiers similar to keywords if they are in ASCII range.
- Allow constants to be treated as regular identifiers.
- Allow keywords that can be used as identifiers in expressions.
2023-02-09 11:19:05 -03:00
Danil Alexeev 54770ba9c5
GDScript: Fix invalid character error message 2023-02-07 10:56:10 +03:00
George Marques 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
Adam Scott c45b9245ae Fix parse error using Vector{2,3,4}.INF 2023-01-08 16:14:40 -05:00
Rémi Verschelde d95794ec8a
One Copyright Update to rule them all
As many open source projects have started doing it, we're removing the
current year from the copyright notice, so that we don't need to bump
it every year.

It seems like only the first year of publication is technically
relevant for copyright notices, and even that seems to be something
that many companies stopped listing altogether (in a version controlled
codebase, the commits are a much better source of date of publication
than a hardcoded copyright statement).

We also now list Godot Engine contributors first as we're collectively
the current maintainers of the project, and we clarify that the
"exclusive" copyright of the co-founders covers the timespan before
opensourcing (their further contributions are included as part of Godot
Engine contributors).

Also fixed "cf." Frenchism - it's meant as "refer to / see".
2023-01-05 13:25:55 +01:00
bruvzg 0103af1ddd
Fix MSVC warnings, rename shadowed variables, fix uninitialized values, change warnings=all to use /W4. 2022-10-07 11:32:33 +03:00
Yuri Roubinsky dbd7a31507 Implement exponential operator (**) to GDScript/Expressions 2022-05-11 16:30:37 +03:00
Nathan Franke 1304d72fc1
improve OS.get_name classref, misc/scripts fixes, remove trailing quote 2022-04-22 17:13:08 -05:00
bruvzg 244db37508
Cleanup and move char functions to the `char_utils.h` header. 2022-02-04 11:35:01 +02:00
bruvzg 8e79c5fb8d
Add support for the escaped UTF-16 and UTF-32 Unicode characters in the scripts and expressions. 2022-01-30 20:16:04 +02:00
Rémi Verschelde fe52458154
Update copyright statements to 2022
Happy new year to the wonderful Godot community!
2022-01-03 21:27:34 +01:00
bruvzg 74b9892f7a [GDScript] Check string literals for Unicode direction control characters. 2021-11-11 15:41:59 +02:00
Max Hilbrunner 626ca50676 Improve GDScript indentation error message 2021-10-28 13:01:53 +02:00
Paulb23 bcfc591f86 Reorganise text editor settings 2021-08-16 17:18:49 +01:00
Rémi Verschelde ee4ef9709d
Merge pull request #46714 from HaSa1002/fix-gdscript-underscore-strict
Fix GDScript Tokenizer being very strict about the number of underscores
2021-05-06 20:19:45 +02:00
George Marques c6e66a43b0
GDScript: Add lambda syntax parsing
Lambda syntax is the same as a the function syntax (using the same
`func` keyword) except that the name is optional and it can be embedded
anywhere an expression is expected. E.g.:

    func _ready():
        var my_lambda = func(x):
            print(x)
        my_lambda.call("hello")
2021-04-28 10:56:16 -03:00
Alex Hirsch d7ac5ba1c6 Fix missing quote in multiline GDScript string
fix #47117
2021-03-19 01:24:18 +01:00
Anshul7sp1 91181c2086 Fixes small typos and grammar correction 2021-03-12 19:05:16 +05:30
Johannes 982a0ac348
Fix GDScript Tokenizer being very strict about the number of underscores
You can use multiple underscores in one number, just not two of them
together.
2021-03-06 01:57:37 +01:00
Rémi Verschelde b5334d14f7
Update copyright statements to 2021
Happy new year to the wonderful Godot community!

2020 has been a tough year for most of us personally, but a good year for
Godot development nonetheless with a huge amount of work done towards Godot
4.0 and great improvements backported to the long-lived 3.2 branch.

We've had close to 400 contributors to engine code this year, authoring near
7,000 commit! (And that's only for the `master` branch and for the engine code,
there's a lot more when counting docs, demos and other first-party repos.)

Here's to a great year 2021 for all Godot users 🎆
2021-01-01 20:19:21 +01:00
Marcel Admiraal 5b937d493f Rename empty() to is_empty() 2020-12-28 10:39:56 +00:00
Thakee Nathees d0e7d9b62f Documentation generation for GDScript
- ClassDoc added to GDScript and property reflection data were extracted
from parse tree

- GDScript comments are collected from tokenizer for documentation and
applied to the ClassDoc by the GDScript compiler

- private docs were excluded (name with underscore prefix and doesn't
have any doc comments)

- default values (of non exported vars), arguments are extraced from the
parser

- Integrated with GDScript 2.0 and new enums were added.

- merge conflicts fixed
2020-11-29 19:45:36 +05:30
reduz 127458ed17 Reorganized core/ directory, it was too fatty already
-Removed FuncRef, since Callable makes it obsolete
-Removed int_types.h as its obsolete in c++11+
-Changed color names code
2020-11-07 20:17:12 -03:00
Rémi Verschelde 3e78963bb9
Fix typos with codespell
Using codespell 1.17.1.

Method:
```
$ cat > ../godot-word-whitelist.txt << EOF
ang
curvelinear
dof
doubleclick
fave
findn
leapyear
lod
merchantibility
nd
numer
ois
ony
que
seeked
synching
te
uint
unselect
webp
EOF

$ codespell -w -q 3 -I ../godot-word-whitelist.txt --skip="./thirdparty,*.po"
$ git diff // undo unwanted changes
```
2020-09-18 13:44:25 +02:00
bruvzg 80b8eff6aa
[Complex Test Layouts] Change `String` to use UTF-32 encoding on all platforms. 2020-09-03 19:56:24 +03:00
George Marques 745ca3059d
Change GDScript compiler to use codegen abstraction 2020-09-01 14:36:22 -03:00
George Marques 164cc8705b
GDScript: Check for missing exponent when parsing numbers
Also forbid multiple underscores in a row as numeric separator.
2020-09-01 09:26:28 -03:00
George Marques a52e457ada
GDScript: Allow keywords to be used in $ notation 2020-08-19 10:19:05 -03:00
George Marques 9ecd042e78
GDScript: Allow "match" to be used as an identifier
This is needed to call the String.match() function.
2020-08-17 20:14:46 -03:00
Aaron Franke 56e2c6c704
Make all String float conversion methods be 64-bit 2020-07-27 18:38:53 -04:00
George Marques a0f54cb95e
Wrap up GDScript 2.0 base implementation 2020-07-22 11:07:51 -03:00