summaryrefslogtreecommitdiff
path: root/core/variant_parser.cpp
AgeCommit message (Collapse)Author
2020-06-08VariantParser: Fix crash on malformed vectorsRémi Verschelde
Each time `r_err_str` is set, we should return a parse error. Removed redundant `return OK;` which were already handled after the big `if`/`else if`/`else` for `TK_IDENTIFIER`. Part of #17372.
2020-05-19Style: Remove unnecessary semicolons from `core`Rémi Verschelde
Semicolons are not necessary after function definitions or control flow blocks, and having some code use them makes things inconsistent (and occasionally can mess up `clang-format`'s formatting). Removing them is tedious work though, I had to do this manually (regex + manual review) as I couldn't find a tool for that. All other code folders would need to get the same treatment.
2020-05-14Style: Enforce braces around if blocks and loopsRémi Verschelde
Using clang-tidy's `readability-braces-around-statements`. https://clang.llvm.org/extra/clang-tidy/checks/readability-braces-around-statements.html
2020-05-14Style: Enforce separation line between function definitionsRémi Verschelde
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-14Style: clang-format: Disable KeepEmptyLinesAtTheStartOfBlocksRémi Verschelde
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-10Revert "Renamed plane's d to distance"Rémi Verschelde
This reverts commit ec7b481170dcd6a7b4cf0e6c1221e204ff7945f3. This was wrong, `d` is not a distance but the `d` constant in the parametric equation `ax + by + cz = d` describing the plane.
2020-05-10Style: clang-format: Disable AllowShortCaseLabelsOnASingleLineRémi Verschelde
Part of #33027.
2020-05-10Renamed plane's d to distanceMarcus Elg
2020-03-26Refactored Input, create DisplayServer and DisplayServerX11Juan Linietsky
2020-03-04Merge pull request #36042 from sumit0190/exportInfNanRémi Verschelde
Read and write exported infs/nans correctly (#35388)
2020-02-25Variant: Added 64-bit packed arrays, renamed Variant::REAL to FLOAT.Juan Linietsky
- Renames PackedIntArray to PackedInt32Array. - Renames PackedFloatArray to PackedFloat32Array. - Adds PackedInt64Array and PackedFloat64Array. - Renames Variant::REAL to Variant::FLOAT for consistency. Packed arrays are for storing large amount of data and creating stuff like meshes, buffers. textures, etc. Forcing them to be 64 is a huge waste of memory. That said, many users requested the ability to have 64 bits packed arrays for their games, so this is just an optional added type. For Variant, the float datatype is always 64 bits, and exposed as `float`. We still have `real_t` which is the datatype that can change from 32 to 64 bits depending on a compile flag (not entirely working right now, but that's the idea). It affects math related datatypes and code only. Neither Variant nor PackedArray make use of real_t, which is only intended for math precision, so the term is removed from there to keep only float.
2020-02-24Fix project.godot for projects with class_namenathanwfranke
Fixes #36438
2020-02-23Merge pull request #36461 from akien-mga/c++17-fallthrough-attributeRémi Verschelde
Replace FALLTHROUGH macro by C++17 [[fallthrough]]
2020-02-23Replace FALLTHROUGH macro by C++17 [[fallthrough]]Rémi Verschelde
This attribute is now part of the standard we target so we no longer need compiler-specific hacks. Also enables -Wimplicit-fallthrough for Clang now that we can properly support it. It's already on by default for GCC's -Wextra. Fixes new warnings raised by Clang's -Wimplicit-fallthrough.
2020-02-22Add support for Vector2i, Rect2i and Vector3i to VariantJuan Linietsky
WARNING: Requires C++17 'guaranteed copy elision' to fix ambiguous operator problems in Variant. This was added for this commit (and future C++17 uses) in #36457.
2020-02-21Added StringName as a variant type.Juan Linietsky
Also changed all relevant properties defined manually to StringName.
2020-02-18PoolVector is gone, replaced by VectorJuan Linietsky
Typed `PoolTypeArray` types are now renamed `PackedTypeArray` and are sugar for `Vector<Type>`.
2020-02-13Remove more deprecated methods and codeRémi Verschelde
2020-02-10Fix VariantParser::StreamString EOF determinationPedro J. Estébanez
2020-02-09Read and write exported infs/nans correctly (#35388)sumit0190
2020-01-01Update copyright statements to 2020Rémi Verschelde
Happy new year to the wonderful Godot community! We're starting a new decade with a well-established, non-profit, free and open source game engine, and tons of further improvements in the pipeline from hundreds of contributors. Godot will keep getting better, and we're looking forward to all the games that the community will keep developing and releasing with it.
2019-12-20Encodes property names properly in project.godotHaoyu Qiu
2019-09-22Changed some code found by Clang Tidy and Coverityqarmin
2019-07-20Changed some code showed in LGTM and Coverageqarmin
2019-07-01Remove unnecessary code and add some error explanationsqarmin
2019-04-22Merge pull request #26787 from ptrojahn/utf8assignRémi Verschelde
Support UTF-8 input action names
2019-04-09Style: Apply new changes from clang-format 8.0Rémi Verschelde
It seems to stay compatible with formatting done by clang-format 6.0 and 7.0, so contributors can keep using those versions for now (they will not undo those changes).
2019-03-08Support UTF-8 input action namesPaul Trojahn
Fixes #26380
2019-02-21Fix VariantWriter overflow on 64-bit intRémi Verschelde
Integers in Godot are signed 64-bit ints (int64_t), but var2str used int behind the scenes and would thus overflow after 2^31. Also properly documented the actual bounds of int and the behaviour when overflowing them.
2019-02-20Add -Wshadow=local to warnings and fix reported issues.marxin
Fixes #25316.
2019-01-01Update copyright statements to 2019Rémi Verschelde
Happy new year to the wonderful Godot community!
2018-09-13Merge pull request #21982 from luzpaz/misc-typosRémi Verschelde
Misc. typos
2018-09-12Misc. typosluz.paz
Found via `codespell -q 3 -I ../godot-word-whitelist.txt --skip="./thirdparty,*.po"`
2018-09-12Make core/ includes absolute, remove subfolders from include pathRémi Verschelde
This allows more consistency in the manner we include core headers, where previously there would be a mix of absolute, relative and include path-dependent includes.
2018-01-20add template argument for size in StringBufferkarroffel
Until now the pre-allocated array size was defined to be 64 without a way of adjusting it from the calling side. This commit adds the size as a template parameter.
2018-01-05Add missing copyright headers and fix formattingRémi Verschelde
Using `misc/scripts/fix_headers.py` on all Godot files. Some missing header guards were added, and the header inclusion order was fixed in the Bullet module.
2018-01-01Update copyright statements to 2018Rémi Verschelde
Happy new year to the wonderful Godot community!
2017-11-20Make old scenes readable againJuan Linietsky
2017-11-17Rename Rect3 to AABB.Ferenc Arn
Fixes #12973.
2017-09-05Optimize memory allocations in VariantParser::get_tokenEvgeny Zuev
2017-08-27Use HTTPS URL for Godot's website in the headersRémi Verschelde
2017-08-24Convert Object::cast_to() to the static versionHein-Pieter van Braam
Currently we rely on some undefined behavior when Object->cast_to() gets called with a Null pointer. This used to work fine with GCC < 6 but newer versions of GCC remove all codepaths in which the this pointer is Null. However, the non-static cast_to() was supposed to be null safe. This patch makes cast_to() Null safe and removes the now redundant Null checks where they existed. It is explained in this article: https://www.viva64.com/en/b/0226/
2017-08-21Fix tokenization of doublesPedro J. Estébanez
Fixes #9600.
2017-07-25Update GDScript completion names for Pool*ArraysAndrii Doroshenko (Xrayez)
Notice: GDScript tokenizer used the old PoolFloatArray name. Renamed PoolFloatArray to PoolRealArray. Moved "project_settings.h" down one line to comply with the clang-format rules. Fixes #9638 Closed pull request #9714 because I messed up with commits, sorry!
2017-06-09renamed all Rect3.pos to Rect3.positionalexholly
2017-06-07Merge pull request #9015 from mcanders/mcanders/ParseObjectVariantFixRémi Verschelde
Fix Variant::OBJECT token parsing
2017-06-04Fix Variant::OBJECT token parsingCarter Anderson
2017-06-04renamed all Rect2.pos to Rect2.positionalexholly
2017-05-28-Added .hdr format supportJuan Linietsky
-Added default environment editor setting -Added environment created by default in new projects -Removed default light and ambient from spatial editor, to make the editor more PBR compliant
2017-05-20Removal of InputEvent as built-in Variant type..Juan Linietsky
this might cause bugs I haven't found yet..