mirror of
https://github.com/Sei-Lisa/LSL-PyOptimizer
synced 2025-07-01 23:58:20 +00:00
Add tab warning and future option documentation.
This commit is contained in:
parent
6c00400d7d
commit
d55f873fd5
2 changed files with 9 additions and 0 deletions
|
@ -30,6 +30,9 @@ class outscript(object):
|
|||
else:
|
||||
pfx = '((key)'
|
||||
sfx = ')'
|
||||
if '\t' in value:
|
||||
warning('WARNING: A string contains a tab. Tabs are expanded to four'
|
||||
' spaces by the viewer when copy-pasting the code.')
|
||||
return pfx + '"' + value.encode('utf8').replace('\\','\\\\') \
|
||||
.replace('"','\\"').replace('\n','\\n') + '"' + sfx
|
||||
if tvalue == int:
|
||||
|
@ -59,6 +62,7 @@ class outscript(object):
|
|||
# This should never happen (Python should always return a point or exponent)
|
||||
return s + '.' # pragma: no cover
|
||||
exp = ''
|
||||
# TODO: Move this to a separate function to fix the above.
|
||||
while s[-1] != '.' and lslfuncs.F32(float(s[:-1]+exp)) == value:
|
||||
s = s[:-1]
|
||||
# TODO: Refine.
|
||||
|
|
5
main.py
5
main.py
|
@ -33,6 +33,11 @@ Options (* means not implemented):
|
|||
directives like: # 123 "filename".
|
||||
optimize Runs the optimizer.
|
||||
optsigns Optimize signs and float as int.
|
||||
* 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.
|
||||
* allowcescapes Enables use of \r, \b, \xNN, \NNN, etc.
|
||||
* enableswitch Enables Firestorm-compatible switch statements
|
||||
(not recommended)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue