From: <de...@us...> - 2003-04-25 23:52:59
|
Update of /cvsroot/pymerase/pymerase/pymerase/input In directory sc8-pr-cvs1:/tmp/cvs-serv6929 Modified Files: parseGenexSchemaXML.py Log Message: Added code to support tracking some syntax errors in the table.dtd based xml files. Index: parseGenexSchemaXML.py =================================================================== RCS file: /cvsroot/pymerase/pymerase/pymerase/input/parseGenexSchemaXML.py,v retrieving revision 1.27 retrieving revision 1.28 diff -C2 -d -r1.27 -r1.28 *** parseGenexSchemaXML.py 9 Apr 2003 00:08:46 -0000 1.27 --- parseGenexSchemaXML.py 25 Apr 2003 23:52:56 -0000 1.28 *************** *** 253,259 **** --- 253,261 ---- ERClassMetaInfo(self.pymeraseConfig, cname)) self.currentTable = self.tables.setdefault(cname, erClass) + self.currentTable.setDefined(1) self.currentTable.setName(attributes.get('name', UNDEFINED)) self.currentTable.setType(attributes.get('type', UNDEFINED)) self.currentTable.setDescription(attributes.get('comment', None)) + self.currentTable.appendLocation("Defined in " + self.current_pathname) inherits = attributes.get('inherits_from', None) if not (inherits is None or inherits == u"none"): *************** *** 269,272 **** --- 271,275 ---- ERClassMetaInfo(self.pymeraseConfig, inherits)) + baseRef.appendLocation("Defined as a base class in "+self.current_pathname) self.currentTable.appendBaseClass(baseRef) self.currentTable.setFilename(self.current_pathname) *************** *** 277,280 **** --- 280,284 ---- # General attribute information + classAttribute.setDefined(1) classAttribute.setName(attributes.get('name', UNDEFINED)) classAttribute.setFriendlyName(attributes.get('full_name', UNDEFINED)) *************** *** 324,328 **** ERClassMetaInfo(self.pymeraseConfig, otherTypeName)) ! otherName = attributes.get('foreign_association_name') if otherName is None: --- 328,332 ---- ERClassMetaInfo(self.pymeraseConfig, otherTypeName)) ! otherEndType.appendLocation("Defined as foreign key in " + self.current_pathname) otherName = attributes.get('foreign_association_name') if otherName is None: *************** *** 391,394 **** --- 395,400 ---- self.tables[self.currentTable.getName(None)] = self.currentTable self.currentTable = None + else: + print "syntax error: table %s not defined" % (self.currentTable.getName(None)) *************** *** 406,408 **** parser.parse() ! return parser.tables.values() --- 412,431 ---- parser.parse() ! modelElements = parser.tables.values() ! ! errors = 0 ! for elementName, element in parser.tables.items(): ! if element.getDefined() == 0: ! errors += 1 ! warn(RuntimeWarning, "SyntaxError: %s was not defined" % (element.getName(None))) ! ! if errors > 0: ! raise(SyntaxError, "There were syntax errors found") ! else: ! return modelElements ! ! # FIXME: started working on trying to provide some error handling ! # FIXME: for if elements are misdefined and can't be resolved. ! # FIXME: should just write some ugly test cases, and use that for the testing. ! # FIXME: (Where ugly means all sorts of bad references. Then I can ! # FIXME: try and make sure I output the apporpriate error messages) |