vector * quaternion: Simplified by precalculating the repeated products and removing math.fsum.
quaternion * quaternion: Add more F32's to get a result closer to SL's (still not there, but we're definitively closer now).
We left out quaternion/quaternion in the tests, and the q*q test was not general enough (had many zeros). Remedied that.
The algorithm for adding parentheses around unary operators was not working properly. It converted a * (-b) * c into a * -b * c, which LSL handles as a * -(b * c).
Fix and add test cases for that. One of the test cases shows an example where the difference matters: 0 * (-1e20) * 1e20 should result in 0.0, but if wrongly parenthesized, it gives NaN, because 1e20*1e20 gives infinity due to float overflow, and minus infinity times 0 is indeterminate.
The addition of parentheses has been improved, but it still does not eliminate every redundant parenthesis.
Also fix the horrendous typo of using "operands" where it should be "operators".
In the same places as state changes are allowed, i.e. in places where a parent of the AST node is a WHILE/DO/FOR or an IF without ELSE, it's allowed to use return statements with expressions that return void, e.g. llDie(), provided the function itself is declared as returning void.
The construction, when found, is rewritten to '{<void expression>; return;}' because the optimizer is not designed to deal with these monsters.
We've renamed the variable SuspiciousStSw to PruneBug, because it's used for both purposes now, though a better name might have been PruneBugPendingChecks, because these are only errors if the IF has an ELSE. We've also added the exception to raise as part of the data stored in the list.
Per report by Tonaie Resident.
Revert "Add support for C11-style _Pragma operator on processpre".
Revert "Add unit test for the _Pragma operator".
This reverts commits 31fcb331c7 and e261ac2121.
This should rather be the job of the preprocessor, which should generate #pragma lines. gcc does that.
Reverts f958b1cdf9, and adds the possibility of adding parameters after the system-inserted ones through a new command line parameter -A/--postarg.
Enables using e.g. both a command interpreter which requires the file to execute before any other parameters, and overriding the default definitions.
A minor difference is that strings and whitespace are parsed according to LSL rules, not to C rules, since this processing is performed in the lexer.
This could be fixed, but is it worth the trouble?
Includes PCPP as a submodule (which in turn pulls PLY as a submodule, so be sure to initialize submodules recursively). Also includes a file to interface PCPP with the optimizer, patching its behaviour according to our needs.
Special thanks to Niall Douglas and David Bezley for authoring PCPP.