def executer(self, espace): elem = document.createElement("operation") appel = self.appellant.executer(espace) oper = self.operande.executer(espace) opg = document.createElement("opg") opd = document.createElement("opd") op = document.createElement("op") if isTuple(appel): opg.appendChild(appel[1]) appel = appel[0] else : opg.appendChild( document.createTextNode( str(appel) ) ) op.appendChild(document.createTextNode(self.char)) if isTuple(oper): opd.appendChild(oper[1]) oper = oper[0] else : opd.appendChild( document.createTextNode( str(oper) ) ) res = self.operateur( appel , oper ) elem.setAttribute("res" , str(res.val)) elem.appendChild( opg ) elem.appendChild( op ) elem.appendChild( opd ) return res , elem
def executer(self, espace): elem = document.createElement("ensemble") for enfant in self.enfants: res = enfant.executer(espace) if isTuple(res): elem.appendChild(res[1]) else: elem.appendChild(res) return elem
def executer(self, espace): elem = document.createElement("condition") res = self.condition.executer(espace) if isTuple(res): elem.appendChild(res[1]) res = res[0] else : elem.appendChild(document.createTextNode(str(res))) if res.val: resBloc = self.bloc.executer(espace) if isTuple(resBloc): elem.appendChild(resBloc[1]) resBloc = resBloc[0] else: elem.appendChild(resBloc) return True , elem return False , elem
def executer(self, espace): res = self.noeudExpression.executer(espace) elem = document.createElement("sortie") if isTuple(res): elem.appendChild(res[1]) res = res[0] else: elem.appendChild(document.createTextNode(str(res.val))) NoeudProgramme.resultat += str(res) + "\n" return elem
def executer(self, espace): elem = document.createElement("operation") op = document.createElement("op") opd = document.createElement("opd") res = self.operateur( self.appellant.executer(espace) ) if isTuple(res): opd.appendChild(res[1]) res = res[0] else: elem.appendChild(res) op.appendChild(document.createTextNode(self.char)) return elem
def executer(self, espace): elem = document.createElement("fairetantque" if self.faireDabord else "tantque") if self.faireDabord: while True: variables[espace].ajouterProfondeur() res = self.noeudConditionnel.executer(espace) if isTuple(res): elem.appendChild(res[1]) res = res[0] else: elem.appendChild(res) if not( res ): break; variables[espace].supprimerProfondeur() else: res = True while res: res = self.noeudConditionnel.executer(espace) if isTuple(res): elem.appendChild(res[1]) res = res[0] else: elem.appendChild(res) return elem
def executer(self, espace): elem = document.createElement("affectation") elem.setAttribute("nom" , self.nom.objet) res = self.noeudExpression.executer(espace) if isTuple(res): elem.appendChild(res[1]) res = res[0] else : elem.appendChild(document.createTextNode(str(res))) elem.setAttribute("valeur" , str(res)) variables[espace].modifier(self.nom.objet, res) return variables[espace].getVariable(self.nom.objet), elem
def executer(self, espace): if self.type in classes: elem = document.createElement("declaration") val = document.createElement("valeur") res = self.noeudExpression.executer(espace) if isTuple(res) : val.appendChild(res[1]) res = res[0] else : val.appendChild(document.createTextNode(str(res))) elem.appendChild(val) elem.setAttribute("nom" , self.nom ) elem.setAttribute("type" , self.type ) variables[espace].ajouter( self.nom , res , self.profondeur) return elem
def executer(self, espace): elem = document.createElement("sas") variables[espace].ajouterProfondeur() fini = False i = 0 while i < len(self.enfants) and not(fini): currentElem = document.createElement("si") currentElem.setAttribute("num" , str(i)) res = self.enfants[i].executer(espace) if isTuple(res): currentElem.appendChild(res[1]) res = res[0] else: currentElem.appendChild(document.createTextNode(str(res))) elem.appendChild(currentElem) i += 1 fini = res variables[espace].supprimerProfondeur() return elem