[Mumps2Py:] [53] Tweaks in preparation for adding Merge command support.

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


Revision: 53
Author:   pgallot
Date:     2008-01-26 19:48:12 +0000 (Sat, 26 Jan 2008)

Log Message:
-----------
Tweaks in preparation for adding Merge command support.
Added a ZWRITECMD token, so that I could print non-scalar variables.

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


Modified: trunk/mumps2py/tokens.py
===================================================================
--- trunk/mumps2py/tokens.py	2008-01-24 21:42:49 UTC (rev 52)
+++ trunk/mumps2py/tokens.py	2008-01-26 19:48:12 UTC (rev 53)
@@ -33,7 +33,7 @@
 STRINGLITERAL, NUMLITERAL, INDIRECTION = 33, 34, 35
 UNKNOWNITEM, ENTRYREF = 36, 37
 FCC_NEWLINE, FCC_NEWPAGE, FCC_MOV, FCC_CHARVAL = 40, 41, 42, 43
-EMPTYLINE = 45
+EMPTYLINE, ZWRITECMD = 45, 46
 
 # NOTE: OPERATORS have token values starting at 50.
 OPADD, OPSUB, OPMULT, OPEXP = 50, 51, 52, 53 # +,-,*, **
@@ -155,6 +155,7 @@
                   "W":WRITECMD, "WRITE":WRITECMD,
                   "X":XECUTECMD, "XECUTE":XECUTECMD,
                   "ZQ":ZQUITCMD, "ZQUIT":ZQUITCMD,
+                  "ZWR":ZWRITECMD, "ZWRITE":ZWRITECMD,
                   "ZETRAP":ZETRAPCMD, # not sure what this is exactly...
                   ";":COMMENT}
 
@@ -256,6 +257,7 @@
     VIEWCMD:"VIEW",
     WRITECMD:"WRITE",
     XECUTECMD:"XECUTE",
+    ZWRITECMD:"ZWRITE",
     ZQUITCMD:"Unknown command",
     ZETRAPCMD:"Unknown command",
     EXPR:"Expression",
@@ -437,6 +439,7 @@
 
     def is_binaryop(self):
         """returns true if the token is a simple binary operator"""
+        #TODO: everything from OPCONCAT on is not a simple binary operato
         return (self.toktype in (OPADD, OPSUB, OPMULT, OPEXP,
                                  OPFRACDIV, OPINTDIV, OPMODULO,
                                  OPGT, OPLT, OPNGT, OPNLT,
@@ -466,3 +469,9 @@
         """if this instance of the variable has an index, returns it"""
         if self.is_indexed():
             return self.indices
+        else:
+            return False
+
+    def unindex(self):
+        """remove the index for just this instance."""
+        del self.__dict__['indices']


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