Commit a7415992 authored by VIGNET Pierre's avatar VIGNET Pierre
Browse files

[lib] Chart xml parser: Delete UGLY code; delete XMLException useless class

parent 7a505286
......@@ -72,8 +72,7 @@ from cadbiom_gui.gt_gui.chart_static.chart_stat_controler import \
from cadbiom.models.guard_transitions.chart_model import ChartModel
from cadbiom.models.guard_transitions.translators.chart_lang import LangVisitor
from cadbiom.models.guard_transitions.translators.chart_xml import \
XmlVisitor, MakeModelFromXmlFile, \
MakeModelFromXmlString, XmlException
XmlVisitor, MakeModelFromXmlFile, MakeModelFromXmlString
from cadbiom.models.guard_transitions.translators.cadlangLexer import cadlangLexer
from cadbiom.models.guard_transitions.translators.cadlangParser import cadlangParser
from cadbiom.models.guard_transitions.analyser.static_analysis \
......@@ -710,8 +709,8 @@ class Charter(object):
mfile.close()
self.previously_written_folder = os.path.dirname(xml_file)
model.modified = False
except XmlException as xec:
cancel_warn(xec.message)
except Exception as e:
cancel_warn(e.message)
return
def choose_xml_file(self, widget):
......
......@@ -60,7 +60,7 @@ class XmlVisitor:
self.model = model
self.fact_list = []
self.xml = "" # string: xml representation of model
self.symb = dict() # symbol table to check double naming of nodes
self.symb = set() # symbol set used to check double naming of nodes
self.visit_chart_model()
def visit_chart_model(self):
......@@ -73,12 +73,10 @@ class XmlVisitor:
"""
Detect double declarations
"""
try:
self.symb[name]
except:
self.symb[name] = "ok"
return
raise XmlException("Node double declaration")
if name in self.symb:
raise Exception("XML Parsing: Node double declaration")
else:
self.symb.add(name)
def visit_cstart_node(self, snode):
"""
......@@ -512,16 +510,6 @@ class MakeModelFromXmlString:
return self.handler.model
class XmlException(Exception):
"""
For exception identification
"""
def __init__(self, mess):
self.message = mess
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment