Add tab warning and future option documentation.

This commit is contained in:
Sei Lisa 2014-07-28 17:26:05 +02:00
parent 6c00400d7d
commit d55f873fd5
2 changed files with 9 additions and 0 deletions

View file

@ -30,6 +30,9 @@ class outscript(object):
else: else:
pfx = '((key)' pfx = '((key)'
sfx = ')' 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('\\','\\\\') \ return pfx + '"' + value.encode('utf8').replace('\\','\\\\') \
.replace('"','\\"').replace('\n','\\n') + '"' + sfx .replace('"','\\"').replace('\n','\\n') + '"' + sfx
if tvalue == int: if tvalue == int:
@ -59,6 +62,7 @@ class outscript(object):
# This should never happen (Python should always return a point or exponent) # This should never happen (Python should always return a point or exponent)
return s + '.' # pragma: no cover return s + '.' # pragma: no cover
exp = '' exp = ''
# TODO: Move this to a separate function to fix the above.
while s[-1] != '.' and lslfuncs.F32(float(s[:-1]+exp)) == value: while s[-1] != '.' and lslfuncs.F32(float(s[:-1]+exp)) == value:
s = s[:-1] s = s[:-1]
# TODO: Refine. # TODO: Refine.

View file

@ -33,6 +33,11 @@ Options (* means not implemented):
directives like: # 123 "filename". directives like: # 123 "filename".
optimize Runs the optimizer. optimize Runs the optimizer.
optsigns Optimize signs and float as int. 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. * allowcescapes Enables use of \r, \b, \xNN, \NNN, etc.
* enableswitch Enables Firestorm-compatible switch statements * enableswitch Enables Firestorm-compatible switch statements
(not recommended) (not recommended)