Salome HOME
commentaire
[tools/eficas.git] / Traducteur / removemocle.py
index d90ad636818b211049698c25fde43564f74708d3..07bfbb3020a44de1e56b8095ec74b34c4b9c94e8 100644 (file)
@@ -1,12 +1,30 @@
 # -*- coding: utf-8 -*-
+# Copyright (C) 2007-2012   EDF R&D
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+#
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+#
 import logging
-import regles
-from parseur import FactNode
-from dictErreurs import EcritErreur
-from dictErreurs import jdcSet
+from Traducteur import regles
+from Traducteur.parseur import FactNode
+from Traducteur.dictErreurs import EcritErreur
+from Traducteur.load import jdcSet
 
-#debug=1
 debug=0
+#debug=1
 #on n'a qu'un mocle par commande. On peut donc supprimer le mocle sans trop de précautions (a part iterer a l'envers sur les commandes)
 #avant de supprimer un autre mocle, on remet à jour l'arbre syntaxique (lineno,colno,etc.)
 
@@ -67,6 +85,13 @@ def removeCommande(jdc,command,ensemble=regles.SansRegle,erreur=0):
         logging.warning("Suppression de %s ligne %s",c.name,c.lineno)
     if boolChange : jdc.reset(jdc.getSource())
 
+#-------------------------------------------------------------
+def removeCommandeSiRegle(jdc,command,liste_regles):
+#-------------------------------------------------------------
+    if command not in jdcSet : return
+    mesRegles=regles.ensembleRegles(liste_regles)
+    removeCommande(jdc,command,mesRegles,0)
+
 #-------------------------------------------------------------
 def removeCommandeSiRegleAvecErreur(jdc,command,liste_regles):
 #-------------------------------------------------------------
@@ -187,5 +212,4 @@ def fusionne(jdc,numLigne):
        fusion=0
  
     if fusion : 
-       import load 
        jdc.joinLineandNext(numLigne)