Commit graph

102 commits

Author SHA1 Message Date
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
George Marques aa09b4f85d
Reintroduce code completion 2020-07-20 11:38:40 -03:00
George Marques 34c28eb2b8
Fix comments in beginning of file
Also improve error for unknown characters.
2020-07-20 11:38:39 -03:00
George Marques 5d6e853806
New GDScript tokenizer and parser
Sometimes to fix something you have to break it first.

This get GDScript mostly working with the new tokenizer and parser but
a lot of things isn't working yet. It compiles and it's usable, and that
should be enough for now.

Don't worry: other huge commits will come after this.
2020-07-20 11:38:39 -03:00
Aaron Franke 25c978730b
Rename String bin_to_int64 to bin_to_int
And also change String static to_int(const char *) to return int64_t
2020-06-03 00:04:15 -04:00
Aaron Franke e5ae89775a
Remove 32-bit String hex_to_int method 2020-06-03 00:03:34 -04:00
Aaron Franke bb8aa107fd
Remove 32-bit String to_int method 2020-06-03 00:03:34 -04:00
Rémi Verschelde 0ee0fa42e6 Style: Enforce braces around if blocks and loops
Using clang-tidy's `readability-braces-around-statements`.
https://clang.llvm.org/extra/clang-tidy/checks/readability-braces-around-statements.html
2020-05-14 21:57:34 +02:00
Rémi Verschelde 07bc4e2f96 Style: Enforce separation line between function definitions
I couldn't find a tool that enforces it, so I went the manual route:
```
find -name "thirdparty" -prune \
  -o -name "*.cpp" -o -name "*.h" -o -name "*.m" -o -name "*.mm" \
  -o -name "*.glsl" > files
perl -0777 -pi -e 's/\n}\n([^#])/\n}\n\n\1/g' $(cat files)
misc/scripts/fix_style.sh -c
```

This adds a newline after all `}` on the first column, unless they
are followed by `#` (typically `#endif`). This leads to having lots
of places with two lines between function/class definitions, but
clang-format then fixes it as we enforce max one line of separation.

This doesn't fix potential occurrences of function definitions which
are indented (e.g. for a helper class defined in a .cpp), but it's
better than nothing. Also can't be made to run easily on CI/hooks so
we'll have to be careful with new code.

Part of #33027.
2020-05-14 16:54:55 +02:00
Rémi Verschelde 0be6d925dc Style: clang-format: Disable KeepEmptyLinesAtTheStartOfBlocks
Which means that reduz' beloved style which we all became used to
will now be changed automatically to remove the first empty line.

This makes us lean closer to 1TBS (the one true brace style) instead
of hybridating it with some Allman-inspired spacing.

There's still the case of braces around single-statement blocks that
needs to be addressed (but clang-format can't help with that, but
clang-tidy may if we agree about it).

Part of #33027.
2020-05-14 16:54:55 +02:00