[Mumps2Py:] [182] speculative fix for extended global variable variants.

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


Revision: 182
Author:   pgallot
Date:     2008-03-19 23:25:38 +0100 (Wed, 19 Mar 2008)

Log Message:
-----------
speculative fix for extended global variable variants.

Modified Paths:
--------------
    trunk/mumps2py/mumps2tok.py


Modified: trunk/mumps2py/mumps2tok.py
===================================================================
--- trunk/mumps2py/mumps2tok.py	2008-03-19 20:25:13 UTC (rev 181)
+++ trunk/mumps2py/mumps2tok.py	2008-03-19 22:25:38 UTC (rev 182)
@@ -287,17 +287,22 @@
 
     def consume_extglobal(mobj):
         """parses an extended global variable reference"""
+        in_parens = False
         pos = mobj.end()
         token = VarToken(EXTGLOBALVAR, mobj.start())
         global_dir = parse_expr( line, pos, r'[,|]|[]]')
         token.global_dir = global_dir
         pos = global_dir.end
         if line[pos] == ',':
-            dummy = parse_expr(line, pos + 1, r'[|]|[]]')
-            token.dummy = dummy
-            pos = dummy.end
+            volume = parse_expr(line, pos + 1, r'[|]|[]]')
+            token.volume = volume
+            pos = volume.end
 
         pos += 1
+        if line[pos:pos+2] == " (":
+            pos += 2
+            in_parens = True
+
         mobj2 = MUMPS_RE_DICT["var"].match(line, pos)
         if not mobj2:
             raise ParseError(line, "Unexpected extglobal pattern", pos)
@@ -307,6 +312,9 @@
         if mobj2.group("indexed"):
             pos, indices = consume_actuallist(line, pos + 1)
             token.indices = indices
+        if in_parens:
+            pos += 1
+        
         return (token, pos)
         
     def consume_extrinsic(mobj):
@@ -1072,8 +1080,8 @@
 
     try:
         mods = parse_for_routines("../testfiles/fm22.m2p", "./out")
-        #mods = parse_for_routines("../testfiles/problem_lines.mps", "./out")
-        #parsemodule(mods,"%YGE4")
+        #mods = parse_for_routines("../testfiles/famo_errors.mrt", "./out")
+        #parsemodule(mods,"KMPSGE")
         for the_module in mods:
             print the_module.mod_name
             parse_routine(the_module)


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