diff --git a/lslopt/lslcommon.py b/lslopt/lslcommon.py index 4cf8879..91025a1 100644 --- a/lslopt/lslcommon.py +++ b/lslopt/lslcommon.py @@ -46,4 +46,7 @@ Bugs = set([6495]) # of how LSO's behaviour differs from Mono's in the fine details. LSO = False +# Set to True by lslcalc's main +IsCalc = False + DataPath = '' diff --git a/lslopt/lsloutput.py b/lslopt/lsloutput.py index d770254..16a09b5 100644 --- a/lslopt/lsloutput.py +++ b/lslopt/lsloutput.py @@ -18,7 +18,7 @@ # Convert an abstract syntax tree + symbol table back to a script as text. import lslfuncs -from lslcommon import Key, Vector, Quaternion +from lslcommon import * from lslparse import warning import math @@ -426,7 +426,7 @@ class outscript(object): if nt == 'EXPR': return self.dent() + self.OutExpr(child[0]) + ( - ';\n' if not self.lslcalc else '') + ';\n' if not IsCalc else '') if nt == 'LAMBDA': return '' @@ -444,7 +444,6 @@ class outscript(object): self.optsigns = self.optimize and 'optsigns' in options self.optfloats = self.optimize and 'optfloats' in options self.foldconst = self.optimize and 'constfold' in options - self.lslcalc = 'lslcalc' in options self.warntabs = 'warntabs' in options diff --git a/lslopt/lslparse.py b/lslopt/lslparse.py index c76cd50..5c1fca5 100644 --- a/lslopt/lslparse.py +++ b/lslopt/lslparse.py @@ -20,7 +20,7 @@ # TODO: Add info to be able to propagate error position to the source. -from lslcommon import Key, Vector, Quaternion +from lslcommon import * import lslcommon import lslfuncs import sys, re @@ -2621,8 +2621,8 @@ list lazy_list_set(list L, integer i, list v) self.linestart = True self.tok = self.GetToken() - self.globals = self.BuildTempGlobalsTable() if \ - 'lslcalc' not in options else self.funclibrary.copy() + self.globals = self.BuildTempGlobalsTable() if not IsCalc \ + else self.funclibrary.copy() # Restart @@ -2636,7 +2636,7 @@ list lazy_list_set(list L, integer i, list v) self.usedspots = 0 # Start the parsing proper - if 'lslcalc' in options: + if IsCalc: self.Parse_single_expression() else: self.Parse_script()