def testConsTrait5(): def testCrCr( ex, ou, htEnvLocals= None): if None==htEnvLocals: htEnvLocals= dict() test( ConsRepr( ex ).repr_wrapped( htEnvLocals), ConsRepr( ou ).repr_wrapped( htEnvLocals)) s= Symbol cs= ConsSimple te.checkComplainAndAdjustExpected( 0) uNames.next( usRename( ConsSimple, 'cs')) uNames.next( usRename( Symbol, 's')) csTest5= consesMake( 1, 2, 3, 4, 5) csTest2= consesMake( 6, 7) csTest1= consesMake( 8) testCrCr( csTest5.cdr().cdr().cdr().cdr(), consesDistanceSeek( csTest5, 0)) testCrCr( csTest5.cdr().cdr().cdr(), consesDistanceSeek( csTest5, 1)) testCrCr( csTest5.cdr().cdr(), consesDistanceSeek( csTest5, 2)) testCrCr( csTest5.cdr(), consesDistanceSeek( csTest5, 3)) testCrCr( csTest5, consesDistanceSeek( csTest5, 4)) testCrCr( csTest5, consesDistanceSeek( csTest5, 5)) testCrCr( csTest5, consesDistanceSeek( csTest5, 6)) testCrCr( csTest2, consesDistanceSeek( csTest2, 6)) testCrCr( csTest1, consesDistanceSeek( csTest1, 6)) uNames.undo() uNames.undo() te.checkComplainAndAdjustExpected( 9)
def codeListConfigMake( environment= None, quotationMode= None, environment_quotationMode= None): # 27f019a4b85c45ec9dbab2a59306eccc #ret= assocMake( consesMake( s_environment, environment)) ret= assocMake() if not None== environment: assocAdd( ret, consesMake( s_environment, environment)) if not None== quotationMode: assocAdd( ret, consesMake( s_macroLevel, quotationMode)) if not None== environment_quotationMode: assocAdd( ret, consesMake( s_environment_quotationMode, environment_quotationMode)) doSubConsType( ret, ar_codeListConfig) return ret
def testConsTrait4(): def testCrCr( ex, ou, htEnvLocals= None): if None==htEnvLocals: htEnvLocals= dict() test( ConsRepr( ex ).repr_wrapped( htEnvLocals), ConsRepr( ou ).repr_wrapped( htEnvLocals)) s= Symbol cs= ConsSimple te.checkComplainAndAdjustExpected( 0) uNames.next( usRename( ConsSimple, 'cs')) uNames.next( usRename( Symbol, 's')) test( nil, consesMake()) testCrCr( cs( 1, nil), consesMake( 1)) testCrCr( cs( 1, cs( 2, nil)), consesMake( 1, 2)) testCrCr( cs( ar_list, nil), listMake()) testCrCr( cs( ar_assoc, nil), assocMake()) testCrCr( cs( ar_assoc, nil), assocMakeIntern()) as1= assocMake( consesMake( '1'), consesMake( '2')) as2= assocMakeIntern( assocElemMake( '1'), assocElemMake( '2')) exp1= "assocInternGeneral( assocElemGeneral( '1'), assocElemGeneral( '2'))" exp2= "assocGeneral( consesMake( '1'), consesMake( '2'))" exp3= "consesMake( s( 'ar_assoc'), consesMake( s( 'ar_assocElem'), '1'), consesMake( s( 'ar_assocElem'), '2'))" test( exp1, ConsRepr( as1).repr_wrapped( None, [ CpctReprAssocInternGeneral, CpctReprAssocElemGeneral])) test( exp1, ConsRepr( as2).repr_wrapped( None, [ CpctReprAssocInternGeneral, CpctReprAssocElemGeneral])) test( exp2, ConsRepr( as1).repr_wrapped( None, [ CpctReprAssocGeneral, CpctReprConses])) test( exp2, ConsRepr( as2).repr_wrapped( None, [ CpctReprAssocGeneral, CpctReprConses])) test( exp3, ConsRepr( as1).repr_wrapped( None, [ CpctReprConses])) test( exp3, ConsRepr( as2).repr_wrapped( None, [ CpctReprConses])) testCrCr( as1, as2) uNames.undo() uNames.undo() te.checkComplainAndAdjustExpected( 13)
def stackMake( codeListCurrentEvalTokenList, codeListParent2EvalToken, codeCurrentLeafList, macroBuf, readbuf, codeLevel, codeList): return consesMake( ar_stack, codeListCurrentEvalTokenList, codeListParent2EvalToken, codeCurrentLeafList, macroBuf, readbuf, codeLevel, codeList)
def evalStep( self, rod): if False: # 8337c49584d44686be0bc780cf310dfc pass elif '(' == rod: evol= '(' elif ')' == rod: codeList= self.codeListCurrentEvalTokenList.cdr().car() codeListEnsure( codeList) codeListTmp= codeListGetParameterValues( codeList) executeObject= codeListTmp.car() executeParameters= codeListParametersMake( codeListTmp.cdr()) if id( ar_codeList)== id( executeObject): # baustelle1 : harte fehlerausgabe print "self.codeListCurrentEvalTokenList ", ConsRepr( self.codeListCurrentEvalTokenList).repr_wrapped() raise Exception( "") del codeListTmp evol= ')' if not self.quotationModeIsActivated(): codeList= self.codeCurrentLeafList.car() assert( id( ar_codeList)== id( codeList.car())) codeListConfig= codeList.cdr().car() assert( id( ar_codeListConfig)== id( codeListConfig.car())) del codeListConfig del codeList env_locals= self.getEnvLocals() if False: # 34c428c5375b49df9b919c610a5a9ce6 pass elif isinstance( executeObject, Macro): executeObject.setEnvironment( env_locals) executeObject.setParameters( executeParameters) execote= executeObject.execute() cs= ConsSimple def tmp0( rest): # c3ee5239baaf4484a61bd525f589ef76 return codeListMake( codeListConfigMake( env_locals), codeListParametersMake( rest)) assert( id( ar_retValueFromMacro) == id( execote.car())) # baustelle: ggf. auch ar_retListFromMacro, loesung von 8357c3268e594c2f92afaa3a3af12afb execote= execote.cdr() self.macroBufFeed_v2( tmp0( consesMake( Symbol( 'eval1'), execote))) elif isinstance( executeObject, Quotation): executeObject.setEnvironment( env_locals) executeObject.setParameters( executeParameters) # 0bea40a420ca4ffa9140051cf20b778f execote= executeObject.execute() self.evalToken( execote, True) elif isinstance( executeObject, Function): executeObject.setEnvironment( env_locals) # 0bea40a420ca4ffa9140051cf20b778f executeObject.setParameters( executeParameters) execote= executeObject.execute() #print ConsRepr( execote).repr_wrapped( None, [ CpctReprCodeListConfigMake, CpctReprConses]) self.evalToken( execote, True) else: print "typ nicht erwartet %s " % executeObject raise Exception( "") # baustelle1 ersetzt erstmal richtige Fehlermeldung else: # self.quotationModeIsActivated() 8191d96c8d9c4e31b9726088c66c7d67 pass # baustelle0: executeObject ist von der semantischen Bedeutung her doppelt belegt else: # not rod in [ '(', ')'] if not self.quotationModeIsActivated(): if noo == rod: # baustelle0 : so nicht - if None==self.codeListCurrentEvalTokenList: raise Exception() self.codeListCurrentEvalTokenList.cdr( nil) else: env_locals= self.getEnvLocals() if env_locals.has_key( rod): got= env_locals.get( rod) # baustelle1: noch zu unterscheiden: Value oder Symbol-Macro / Quotation self.evalToken( ConsSimple( ar_value, got), True) # baustelle1: in Funktion X001 auslagern, auch fuer den Listen-Fall | rod kann im aktuellen fall sogar eine Liste enthalten, die nicht in Einzelteilen an evalToken gefuettert werden muss, 7978cb4bee364b3a8359e2a0f8b7f1f4 if self.currentEvalTokenIsInExecutePosition(): if isinstance( got, Quotation) or isinstance( got, Macro): # 34c428c5375b49df9b919c610a5a9ce6 self.quotationModeActivate() else: print "not found %s" % ConsRepr( rod).repr_wrapped( None, [ CpctReprCodeListConfigMake, CpctReprConses]) raise Exception() else: # self.quotationModeIsActivated() 8191d96c8d9c4e31b9726088c66c7d67 """ behandlung bezueglich uqset1 """ if self.getEnvQuotationModeLocals().has_key( rod): # baustelle0 executeObject fuer diesen Fall umbenennen self.quotationModeDeActivate() env_quotationMode_locals= self.getEnvQuotationModeLocals().get( rod) del rod if self.currentEvalTokenIsInExecutePosition(): self.codeListCurrentEvalTokenList.cdr().car( self.getEnvLocals().get( Symbol( 'progn'))) # ddfdc08cdef344b7bcd44d4e093d12ab, erweiterbar, siehe ideen.txt, 96c8d565e4f946c38838d30756ce5c0d parentCodeListConfig= self.getCurrentCodeListConfig( self.codeCurrentLeafList.cdr().car()) self.quotationModeDeActivate( parentCodeListConfig) else: self.codeListCurrentEvalTokenList.cdr().car( nil) # ddfdc08cdef344b7bcd44d4e093d12ab, erweiterbar, siehe ideen.txt codeListConfig= self.getCurrentCodeListConfig() codeListConfigSet( codeListConfig, s_environment, env_quotationMode_locals) del env_quotationMode_locals del codeListConfig pass #evol= self.codeListCurrentEvalTokenList.cdr().car() evol= None # momentan bedeutungslos return evol