def testRepl3Sub(): # test zur ueberleitung auf ar_codeListParameters te.checkComplainAndAdjustExpected( 0) codeList= codeListMake( codeListConfigMake(), codeListParametersMake( nil)) te.test( codeListCheck( codeList)) te.test( codeListConfigCheck( codeListGetConfig( codeList))) te.test( codeListParametersCheck( codeListGetParameters( codeList))) codeList= codeListMake( codeListConfigMake(), codeListParametersMake( ConsSimple( true, nil))) te.test( codeListCheck( codeList)) te.test( codeListConfigCheck( codeListGetConfig( codeList))) codeListParameters= codeListGetParameters( codeList) te.test( codeListParametersCheck( codeListParameters)) te.test( id( true) == id( codeListGetParameterValues( codeList).car())) te.test( id( true) == id( codeListGetParameterValuesCdrContainer( codeList).cdr().car())) te.test( id( true) == id( codeListParametersGetParameterValues( codeListParameters).car())) te.test( id( true) == id( codeListGetParameterValuesCdrContainer2( codeList).cdr().cdr().car())) te.checkComplainAndAdjustExpected( 10)
def __init__( self): self.debug= False selfInterpreter= self self.readbuf= ConsSimple( nil, nil) self.macroBuf= nil self.env_globals= Environment() env_locals= self.env_globals.newChild() self.env_quotationMode_globals= Environment() env_quotationMode_locals= self.env_quotationMode_globals.newChild() codeListConfig= codeListConfigMake( env_locals, False, env_quotationMode_locals) # 27f019a4b85c45ec9dbab2a59306eccc self.codeList= codeListMake( codeListConfig, codeListParametersMake( nil)) # ehemals 76ff812ddb0f47f5be9ca34925a4a3b6 del codeListConfig codeListGetParameters( self.codeList).cdr( ConsSimple( Symbol( 'progn-root'), nil)) self.codeListCurrentEvalTokenList= codeListGetParameterValuesCdrContainer2( self.codeList).cdr() self.codeListParent2EvalToken= nil self.codeCurrentLeafList= ConsSimple( self.codeList, nil) # 2bb546ca3ffd48bc851d17494f5c286f codeListEnsure( self.codeList) assert( ar_codeListConfig==self.getCurrentCodeListConfig().car()) self.codeLeafBackTree= ConsSimple( self.codeCurrentLeafList, nil) # 2bb546ca3ffd48bc851d17494f5c286f self.codeLevel= 0 self.essentials_macro_function= Essentials() #for i in ( pl_q1, pl_q2, pl_ql, pl_pyprint, pl_pyprintconses, pl_pyprintconsesRest, pl_pyprintStack, pl_eval, pl_qswap2): # i.setEssentials( self.essentials_macro_function) self.interpreterSymbolTable= InterpreterSymbolTable( self) ist= self.interpreterSymbolTable for k in 'pyprint pyprintconses pyprintconsesRest pyprintStack pyprintStack2 pyprintStackShort'.split(): ist.htInterpreterSymbolTableNames[ k].setEssentials( self.essentials_macro_function) del k for k in ist.htInterpreterSymbolTable: v= ist.htInterpreterSymbolTable[ k] self.env_globals.set( k, v) del k, v del ist
def evalToken( self, rodTyped, evalMode= False): # evalMode=True wird bei '(' nur zu beginn gesetzt, ob evaluiert wird, wird von aussen festgelegt rodType= rodTyped.car() rod= rodTyped.cdr() if id( rodType) not in [ id( ar_value), id( ar_retValue), id( ar_retList)]: print ConsRepr( rodTyped).repr_wrapped( None, [ CpctReprCodeListConfigMake, CpctReprConses]) raise Exception() if False: # 8337c49584d44686be0bc780cf310dfc pass elif '(' == rod: self.codeLevel+=1 codeListConfigCloned= codeListConfigClone( self.getCurrentCodeListConfig()) elem= codeListMake( codeListConfigCloned, codeListParametersMake( nil)) # ehemals 76ff812ddb0f47f5be9ca34925a4a3b6 self.codeCurrentLeafList= ConsSimple( elem, self.codeCurrentLeafList) # 2bb546ca3ffd48bc851d17494f5c286f self.codeLeafBackTree.car( self.codeCurrentLeafList) # 2bb546ca3ffd48bc851d17494f5c286f del codeListConfigCloned if True == evalMode: # 672b8ecafdae4e218d2268543f27119a elemNew= self.codeListCurrentEvalTokenList.cdr() elemNew.car( elem) elemCurrent= self.codeListCurrentEvalTokenList else: elemNew= ConsSimple( elem, nil) elemCurrent= consesDistanceSeek( self.codeListCurrentEvalTokenList) assert( not id( nil) == id( elemCurrent)) elemCurrent.cdr( elemNew) ( elemPrevious, elemCurrent, elemNew, elemParent) = ( elemCurrent, codeListGetParameterValuesCdrContainer( elem) # ehemals 76ff812ddb0f47f5be9ca34925a4a3b6 , None, elemNew) self.codeListParent2EvalToken= ConsSimple( elemPrevious, self.codeListParent2EvalToken) self.codeListCurrentEvalTokenList= codeListGetParameterValuesCdrContainer2( elem) # ist das wirklich notwendig? zumindest liefert der Check keinen Fehler (also ist es wenigstens korrekt) elif ')' == rod: self.codeLevel-=1 if nil == self.codeListParent2EvalToken: raise Exception( 'kann keine klammer mehr schliessen') elemParent2= self.codeListParent2EvalToken.car() self.codeListParent2EvalToken= self.codeListParent2EvalToken.cdr() ( elemCurrent2, elemParent)= ( elemParent2, None) self.codeListCurrentEvalTokenList= elemCurrent2 self.codeCurrentLeafList= self.codeCurrentLeafList.cdr() # 2bb546ca3ffd48bc851d17494f5c286f baustelle: die und die folgende Zeile sind ohne Testfehler austauschbar, pruefen self.codeLeafBackTree= ConsSimple( self.codeCurrentLeafList, self.codeLeafBackTree) # 2bb546ca3ffd48bc851d17494f5c286f else: # not rod in [ '(', ')'] elem= rod # 59cc177458e34abcb943fd4351d93149 if True == evalMode: # 672b8ecafdae4e218d2268543f27119a elemNew= self.codeListCurrentEvalTokenList # 7171a8bd3cd641babf4ebcca7394f4c6 if id( ar_retList) == id( rodType): # 7978cb4bee364b3a8359e2a0f8b7f1f4 # baustelle0: isinstance( elem, Cons) kann raus, sobald ar_retValue implementiert ist wrappedValues= elem elemNew.cdr( wrappedValues) # 7171a8bd3cd641babf4ebcca7394f4c6, ehemals 36268f550bcf4fb88d25868f8ea663bf hack self.codeListCurrentEvalTokenList= consesDistanceSeek( elemNew, 1, (lambda walker : isinstance( walker, Cons))) # 7171a8bd3cd641babf4ebcca7394f4c6, 80d1ab47171e42ba9bac8c8409b87bee #self.codeListCurrentEvalTokenList= consesDistanceSeek( elemNew, 1) # 7171a8bd3cd641babf4ebcca7394f4c6 elif id( ar_retValue) == id( rodType): # 7978cb4bee364b3a8359e2a0f8b7f1f4 # baustelle0: isinstance( elem, Cons) kann raus, sobald die restlichen ar_ Symbole implementiert sind elemNew.cdr().car( elem) elif id( ar_value) == id( rodType): # 7978cb4bee364b3a8359e2a0f8b7f1f4 # baustelle0: isinstance( elem, Cons) kann raus, sobald die restlichen ar_ Symbole implementiert sind elemNew.cdr().car( elem) else: raise Exception( ConsRepr( rodTyped).repr_wrapped( None, [ CpctReprCodeListConfigMake, CpctReprConses])) else: # False == evalMode elemNew= ConsSimple( elem, nil) elemCurrent= consesDistanceSeek( self.codeListCurrentEvalTokenList) elemCurrent.cdr( elemNew) ( elemPrevious, elemCurrent, elemNew) = ( elemCurrent, elemNew, None) self.codeListCurrentEvalTokenList= elemPrevious # baustelle ggf. wieder rauswerfen return rod
def tmp0( rest): # c3ee5239baaf4484a61bd525f589ef76 return codeListMake( codeListConfigMake( env_locals), codeListParametersMake( rest))
def tmp0( self, rest): # c3ee5239baaf4484a61bd525f589ef76 return codeListMake( codeListConfigMake( self.env), codeListParametersMake( rest))