mirror of
https://github.com/Sei-Lisa/LSL-PyOptimizer
synced 2025-07-01 23:58:20 +00:00
Add duplabels option (not yet implemented).
When disabled, it now disallows duplicate labels. The plan is that when enabled, it will auto-rename labels so that there are no repetitions within a function. Add coverage tests too, and also a coverage test that was missed after the latest changes.
This commit is contained in:
parent
523857ed23
commit
e29f16d3eb
3 changed files with 35 additions and 9 deletions
13
main.py
13
main.py
|
@ -14,14 +14,14 @@ Usage: %s [-O [+|-]option[,[+|-]option[,...]]] filename
|
|||
That's an upper case o, not the number zero.
|
||||
If filename is a dash (-) then standard input is used.
|
||||
|
||||
Options (+ means default):
|
||||
Options (+ means active by default, - means inactive by default):
|
||||
extendedglobalexpr + Enables arbitrary expressions in globals (as opposed to
|
||||
dull simple expressions allowed by regular LSL). Needs
|
||||
the optimizer to run for the result to be compilable.
|
||||
extendedtypecast + Allows extended typecast syntax e.g. (string)(integer)a
|
||||
is valid with this option.
|
||||
extendedassignment + Enables &=, |=, ^=, <<=, >>= assignment operators.
|
||||
explicitcast Add explicit casts where they are implicit. This option
|
||||
explicitcast - Add explicit casts where they are implicit. This option
|
||||
is useless with 'optimize' and 'optsigns', and is of
|
||||
basically no use in general.
|
||||
allowkeyconcat + Allow string + key and key + string (both return string)
|
||||
|
@ -37,12 +37,19 @@ Options (+ means default):
|
|||
optimize + Runs the optimizer.
|
||||
optsigns + Optimize signs in float and integer constants.
|
||||
optfloats + Optimize a float when it is an integral value.
|
||||
foldtabs Tabs can't be copy-pasted, so they aren't optimized by
|
||||
foldtabs - Tabs can't be copy-pasted, so they aren't optimized by
|
||||
default. But with support from the viewer, they can be
|
||||
folded too and make it to the uploaded source. This
|
||||
option overrides that check, enabling optimization of
|
||||
strings with tabs. The resulting source isn't guaranteed
|
||||
to be copy-paste-able to a different script, though.
|
||||
duplabels - Normally, a duplicate label within a function is allowed
|
||||
by the syntax by using {} blocks; however, the server
|
||||
will just refuse to save the script (under Mono) or do
|
||||
something completely unexpected (under LSO: all jumps
|
||||
will go to the last label with that name). This flag
|
||||
works around that limitation by replacing the names of
|
||||
the labels in the output with unique ones.
|
||||
|
||||
Note that the optimizer doesn't reorder expressions to fold constants. This
|
||||
means that e.g. a + 3 + 5 is not optimized to a + 8; however a + (3 + 5) is.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue