[Mumps2Py:] [94] added support for translating $HOROLOG.

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


Revision: 94
Author:   pgallot
Date:     2008-02-12 03:21:58 +0000 (Tue, 12 Feb 2008)

Log Message:
-----------
added support for translating $HOROLOG.

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


Modified: trunk/mumps2py/tok2python.py
===================================================================
--- trunk/mumps2py/tok2python.py	2008-02-12 03:21:18 UTC (rev 93)
+++ trunk/mumps2py/tok2python.py	2008-02-12 03:21:58 UTC (rev 94)
@@ -237,20 +237,11 @@
                                    "incorrect number of parameters")
         return find_str
                            
-    def translate_intr_length(translation, token):
-        """ translates the Mumps Intrinsic function LENGTH to Python"""
-        if len(token.params) == 1:
-            length_str = "len(%s)" % \
-                       translate_expr(translation, token.params[0])
-        elif len(token.params) == 2:
-            length_str = "%s.count(%s) + 1" % \
-                         (translate_expr(translation, token.params[0]),
-                          translate_expr(translation, token.params[1]))
-        else:
-            raise TranslationError(translation, token,
-                                   "incorrect number of parameters")
-        return length_str
-
+    def translate_intr_horolog(translation, token):
+        """ translates the Mumps Intrinsic variable HOROLOG to Python"""
+        translation.add_cl_import()
+        return "Mf_horolog()"
+        
     def translate_intr_justify(translation, token):
         """ translates the Mumps Intrinsic function JUSTIFY to Python"""
         if len(token.params) == 2:
@@ -267,6 +258,20 @@
                                    "incorrect number of parameters")
         return justify_str
 
+    def translate_intr_length(translation, token):
+        """ translates the Mumps Intrinsic function LENGTH to Python"""
+        if len(token.params) == 1:
+            length_str = "len(%s)" % \
+                       translate_expr(translation, token.params[0])
+        elif len(token.params) == 2:
+            length_str = "%s.count(%s) + 1" % \
+                         (translate_expr(translation, token.params[0]),
+                          translate_expr(translation, token.params[1]))
+        else:
+            raise TranslationError(translation, token,
+                                   "incorrect number of parameters")
+        return length_str
+
     def translate_intr_piece(translation, token):
         """ translates the Mumps Intrinsic function PIECE to Python"""
         translation.add_import("re")
@@ -290,7 +295,7 @@
                 raise TranslationError(translation, token, \
                                        "incorrect number of parameters")
         return piece_str
-    
+
     def translate_intr_random(translation, token):
         """ translates the Mumps Intrinsic function RANDOM to Python"""
         if len(token.params) == 1:
@@ -390,6 +395,7 @@
         F_PIECE: translate_intr_piece,
         F_RANDOM: translate_intr_random,
         F_REVERSE: translate_intr_reverse,
+        V_HOROLOG: translate_intr_horolog,
         EXPR: translate_expr_list}
 
     if expr_transl_dict.has_key(token.toktype):


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