mirror of
https://github.com/Sei-Lisa/LSL-PyOptimizer
synced 2025-07-01 23:58:20 +00:00
- Parser and output modules are thoroughly tested and working. - Most LSL immutable functions are working; some not tested; llJsonSetValue not implemented. - Parser recognizes the following flags that alter syntax: extendedglobalexpr: Allow full expression syntax in globals. extendedtypecast: Allow full unary expressions in typecasts e.g. (float)~i. extendedassignment: Enable the C assignment operators &=, ^=, |=, <<=, >>=. explicitcast: Add explicit casts wherever they are done implicitly, e.g. float f=3; -> float f=(float)3;. Of them, only extendedglobalexpr is useless so far, as it requires the optimizer to be working.
23 lines
497 B
Python
23 lines
497 B
Python
#!/usr/bin/env python
|
|
|
|
from lslopt.lslparse import parser,EParse
|
|
from lslopt.lsloutput import outscript
|
|
import sys
|
|
|
|
def main():
|
|
if len(sys.argv) > 1:
|
|
p = parser()
|
|
try:
|
|
symtab = p.parsefile(sys.argv[1])
|
|
except EParse as e:
|
|
print e.message
|
|
return 1
|
|
del p
|
|
outs = outscript()
|
|
script = outs.output(symtab)
|
|
del outs
|
|
del symtab
|
|
print script.decode('utf8'),
|
|
return 0
|
|
|
|
sys.exit(main())
|