Commit graph

278 commits

Author SHA1 Message Date
Sei Lisa
1160fea8cf Fix extendedtypecast problem with negative constants after typecasts. 2015-06-23 06:54:04 +02:00
Sei Lisa
4cc268b574 Fix parenthesizing of expressions having ~ or ! 2015-06-17 18:30:32 +02:00
Sei Lisa
f5d150f7c9 Fix typo in IsBool and add coverage test. Report and fix by Code Violet. 2015-06-17 02:51:46 +02:00
Sei Lisa
52ebe20a67 Refine a comment 2015-06-17 02:31:58 +02:00
Sei Lisa
e35431cecf Forgot to truncate llSqrt to F32. 2015-06-16 04:41:36 +02:00
Sei Lisa
bfabcd16db Fix parser bug where list = anytype was accepted. Fix also the test suite. 2015-06-16 04:16:59 +02:00
Sei Lisa
cdc3a63179 Fix problem due to not copying a node. It still needs more analysis, but this patch is an improvement in that it fixes known problematic cases and doesn't seem to introduce new ones. 2015-06-14 05:11:32 +02:00
Sei Lisa
aaa8d3b7f4 Fix crash when a global was optimized out and another global depended on it. 2015-06-14 03:36:54 +02:00
Sei Lisa
e1d0753fec When a state is removed, remove its global declaration too. 2015-06-13 02:19:15 +02:00
Sei Lisa
8ca88013a8 Minor fixes (remove deprecated .message, delete a variable at the right point, delete another variable) 2015-06-04 22:57:13 +02:00
Sei Lisa
d8629f9200 Update behaviour of llListFindList for LSO. 2015-05-24 04:22:31 +02:00
Sei Lisa
aad73fb71d Added command line option to display the preprocessor output.
Will help identify the source line until preprocessor line tracking is implemented.
2015-05-06 02:45:37 +02:00
Sei Lisa
7d0ee20058 Option -p needs an argument. 2015-05-05 22:50:28 +02:00
Sei Lisa
faf296fa74 Fix bug with scripts that have UTF-8 characters.
The parser expects bytes, not unicode.
2015-05-03 05:19:14 +02:00
Sei Lisa
621b29b0cc New upstream version of builtins.txt 2015-05-02 23:07:28 +02:00
Sei Lisa
dc2ab29a5c Update URL. 2015-04-29 00:49:34 +02:00
Sei Lisa
4302ea846d Don't fall through after optimizing a negable comparison, as it's folded already and the variables were incorrectly set and broke our invariants. 2015-04-21 06:11:25 +02:00
Sei Lisa
d58bc2d350 Implement library function parameter optimization.
So far only two kinds: angle in llSensor[Repeat] and null keys in functions that take a key parameter.

Closes two TODOs.
2015-04-21 04:56:09 +02:00
Sei Lisa
595286f22a New keywords. 2015-04-21 04:26:18 +02:00
Sei Lisa
17bf0b7a1e Fix recently introduced bug: function renaming failed. 2015-04-17 03:37:24 +02:00
Sei Lisa
1c16355187 Small wording change. 2015-04-15 22:52:49 +02:00
Sei Lisa
be86216124 Do -(b + -c) -> -b+c. Also when a-b is transformed to a+-b, fold -b. 2015-03-29 06:09:26 +02:00
Sei Lisa
a859b3e8e4 Loop over (0, 1) instead of duplicating the code. 2015-03-29 05:43:38 +02:00
Sei Lisa
a19d49d193 Implement optimization of a>=const -> a>const-1 and similar, and fix cases where | -> & or a<0 -> a&0x80000000 is counter-productive.
The logic becomes quite convoluted.
2015-03-29 03:47:54 +02:00
Sei Lisa
274b563390 No need to simplify !!! to ! as FoldCond already takes care of that. 2015-03-29 01:27:08 +01:00
Sei Lisa
9aae475125 Implement bool(x < 0) -> bool(x & 0x80000000) w/ function domain check.
Cleans up three TODOs.
2015-03-29 00:16:17 +01:00
Sei Lisa
2cb9ad6fe5 Implement a first version of IsBool and use it to optimize && -> & 2015-03-28 23:49:10 +01:00
Sei Lisa
08f48a5c32 Make program flow more consistent, add TODO, refine another TODO. 2015-03-28 23:47:45 +01:00
Sei Lisa
01d8bba3f4 Don't always output a space after the unary minus, only when necessary. 2015-03-28 23:35:08 +01:00
Sei Lisa
4fbbda60a7 Elaborate on the TODO. 2015-03-28 23:34:07 +01:00
Sei Lisa
b8a7e88f1a Add TODO item 2015-03-28 23:31:11 +01:00
Sei Lisa
c154d5eb0d Deal with a number of issues in some expressions.
- Move TODO of <0 to !=-1 to boolean, as it's counter-productive otherwise.
- All a!=b except list!=list are equivalent to !(a==b).
- Change a>b to b<a to simplify cases to analize.
- Proper fall-through in some spots, or return in some others where it didn't apply.
- Simplify handling of a<-2147483648 as a&0, falling through, instead of coping with it ourselves.
2015-03-28 20:23:47 +01:00
Sei Lisa
de33c2df01 Simplify operands of bitwise OR expressions as booleans. Deals with a TODO in a more general way. 2015-03-28 20:16:06 +01:00
Sei Lisa
6813bb0458 Make the second pass of FoldScript look a bit more logic. 2015-03-28 20:14:17 +01:00
Sei Lisa
2a617b34d0 Fix bug where a<<1 was not immediately optimized, and other minor changes.
* Add a TODO.
* Don't make two fold passes if DCR is off.
* Remove comment about parentheses that no longer applies.
2015-03-28 14:45:53 +01:00
Sei Lisa
edbc240408 Remove 'Local' from symbol table; add note about an unimplemented feature; improve symbol table documentation; rename a helper variable. 2015-03-27 02:12:32 +01:00
Sei Lisa
921955f321 Implement function overriding syntax extension, fixing a bug on the way.
The funcoverride option allows defining multiple functions with the same name, each overriding the former. That's for compatibility with Firestorm, whose optimizer does that.

While on it, fix a bug where defining a function whose name matches a library function was not reporting an error, and rename self.functions to self.funclibrary for clarity. It also brings consistency with other parts of the code and with the code documentation.
2015-03-27 00:35:37 +01:00
Sei Lisa
3839863a21 EInternal is no longer reused. 2015-03-26 23:26:36 +01:00
Sei Lisa
e21173170e Simplify the builtins.txt parser REs by checking the types in the code.
Gives us more granularity reporting errors.
2015-03-26 23:08:54 +01:00
Sei Lisa
29d003b108 Add a comment about C backslash-return behaviour. 2015-03-24 21:56:35 +01:00
Sei Lisa
47eee0312b Revamp and fixes of REs for pre-preprocessing.
Easier to follow and to maintain this way. Fixes known and potential bugs, plus potential lack of greediness.
2015-03-20 17:45:38 +01:00
Sei Lisa
cd1826e9e0 Bump version. 2015-03-19 04:31:47 +01:00
Sei Lisa
df8a8b4e9e Revamp command line options to add mcpp mode with defaults.
Also remove stderr from subprocess call (let the subprocess do its own output to stderr without capturing and re-emitting it ourselves).
2015-03-19 04:11:29 +01:00
Sei Lisa
226f382c4f Switch the predefined macros to variadic, to allow commas. 2015-03-17 19:41:36 +01:00
Sei Lisa
aea101a823 Add --precmd, bump version, report 'version N' instead of 'vN' on --version 2015-03-15 20:28:53 +01:00
Sei Lisa
f93e6d65a4 Deal with encoding issues, and simplify subprocess poll loop. 2015-03-15 20:01:41 +01:00
Sei Lisa
c8bec32242 Add a comment to prevent mistakes. 2015-03-15 19:49:52 +01:00
Sei Lisa
56f40a9c76 Ensure the script is Unicode before parsing. 2015-03-15 19:19:57 +01:00
Sei Lisa
31b7048fc9 Remove debug info left by mistake. 2015-03-15 19:19:10 +01:00
Sei Lisa
3c962ef32b Add external preprocessor invocation. 2015-03-15 06:18:55 +01:00