[Mumps2Py:] [168] handle a case causing an infinite loop.

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


Revision: 168
Author:   pgallot
Date:     2008-03-11 14:07:52 +0000 (Tue, 11 Mar 2008)

Log Message:
-----------
handle a case causing an infinite loop.

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


Modified: trunk/mumps2py/mumps2tok.py
===================================================================
--- trunk/mumps2py/mumps2tok.py	2008-03-11 13:37:12 UTC (rev 167)
+++ trunk/mumps2py/mumps2tok.py	2008-03-11 14:07:52 UTC (rev 168)
@@ -95,7 +95,7 @@
     token.end = None
     if line[pos] == '@':
         if MUMPS_RE_DICT["nakedRef"].match(line, pos + 1):
-            indirect = parse_expr(line, pos+1, r"([,+: ]|\s$)")
+            indirect = parse_expr(line, pos+1, r"([,+: ]|\s*$)")
             token.indirect = indirect
             pos = indirect.end
         else:
@@ -110,6 +110,10 @@
             routine = parse_expr(line, pos + 1, r"([ ,)(:]|\s*$)")
             token.routine = routine
             pos = routine.end
+    elif line[pos] == '$': #indirection via an intrinsic ?
+        indirect = parse_expr(line, pos, r"([,+: ]|\s*$)")
+        token.indirect = indirect
+        pos = indirect.end
     else:
         re_name = re.compile(r"[A-Za-z%0-9][A-Za-z0-9]*")
         m_name = re_name.match(line, pos)
@@ -1076,8 +1080,8 @@
 
     try:
         #mods = parse_for_routines("../testfiles/vista.m2p", "./out")
-        #mods = parse_for_routines("../testfiles/fm22.m2p", "./out")
-        mods = parse_for_routines("../testfiles/famo.m2p", "./out")
+        mods = parse_for_routines("../testfiles/fm22.m2p", "./out")
+        #mods = parse_for_routines("../testfiles/famo.m2p", "./out")
         #parsemodule(mods,"%YGE4")
         for the_module in mods:
             print the_module.mod_name


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