[Mumps2Py:] [141] improved ParseError handling, removed a needless if-statement.

[ Thread Index | Date Index | More lists.mumps2py.org/discuss Archives ]


Revision: 141
Author:   pgallot
Date:     2008-02-28 22:36:33 +0000 (Thu, 28 Feb 2008)

Log Message:
-----------
improved ParseError handling, removed a needless if-statement.

Modified Paths:
--------------
    trunk/mumps2py_ui.pyw


Modified: trunk/mumps2py_ui.pyw
===================================================================
--- trunk/mumps2py_ui.pyw	2008-02-28 20:33:51 UTC (rev 140)
+++ trunk/mumps2py_ui.pyw	2008-02-28 22:36:33 UTC (rev 141)
@@ -252,7 +252,8 @@
 
                 the_module.empty_tokenlist() # keep memory usage down
         except mumps2py.ParseError, err:
-            self.message(err.error_msg())
+            self.message(err.error_msg(),
+                         "Parse Error in " + the_module.mod_name)
         finally:
             print time.time() - tstart, "seconds to parse %d routines" % \
                   modcnt
@@ -267,13 +268,14 @@
         start_line = int(self.entry_val.get())
         popup.destroy()
         if self.modules:
-            for a_module in self.modules:
-                if a_module.end < start_line:
+            for the_module in self.modules:
+                if the_module.end < start_line:
                     continue
                 try:
-                    mumps2py.parseMumps(a_module)
+                    mumps2py.parseMumps(the_module)
                 except mumps2py.ParseError, err:
-                    self.message(err.error_msg(), "Parse Error")
+                    self.message(err.error_msg(),
+                                 "Parse Error in " + the_module.mod_name)
 
     def parsegivenmodule(self, popup):
         """parse the module specified by popup"""
@@ -300,7 +302,8 @@
                 try:
                     mumps2py.parseMumps(the_module)
                 except mumps2py.ParseError, err:
-                    self.message(err.error_msg(), "Parse Error")
+                    self.message(err.error_msg(),
+                                 "Parse Error in " + the_module.mod_name)
         elif len(self.modules) == 1:
             the_module = self.current_module
             try:
@@ -344,13 +347,13 @@
                 for modcnt, the_module in enumerate(modules_list):
                     if modcnt % 20 == 0: # cut down on console feedback
                         print the_module.mod_name
-                    if the_module.tokenlist_isempty():
-                        mumps2py.parseMumps(the_module, input_file)
+                    mumps2py.parseMumps(the_module, input_file)
                     for token in the_module.tokenized():
                         token.count_subtokens(toks)
                     the_module.empty_tokenlist() # keep memory usage down
             except mumps2py.ParseError, err:
-                self.message(err.error_msg())
+                self.message(err.error_msg(),
+                             "Parse Error in " + the_module.mod_name)
             except KeyboardInterrupt:
                 self.message("Interrupt while parsing " + the_module.mod_name)
             finally:


Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/