[Checkins] SVN: Sandbox/malthe/chameleon.core/ Added compiler feature: Support for unscoped variable assignment.

Malthe Borch mborch at gmail.com
Sun Oct 12 22:48:37 EDT 2008


Log message for revision 92088:
  Added compiler feature: Support for unscoped variable assignment.

Changed:
  U   Sandbox/malthe/chameleon.core/CHANGES.txt
  U   Sandbox/malthe/chameleon.core/src/chameleon/core/translation.py

-=-
Modified: Sandbox/malthe/chameleon.core/CHANGES.txt
===================================================================
--- Sandbox/malthe/chameleon.core/CHANGES.txt	2008-10-12 18:30:35 UTC (rev 92087)
+++ Sandbox/malthe/chameleon.core/CHANGES.txt	2008-10-13 02:48:35 UTC (rev 92088)
@@ -4,6 +4,8 @@
 head
 ~~~~
 
+- Added support for unscoped variable assignment. [malthe]
+
 1.0b2 (released 11/10/2008)
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~
 

Modified: Sandbox/malthe/chameleon.core/src/chameleon/core/translation.py
===================================================================
--- Sandbox/malthe/chameleon.core/src/chameleon/core/translation.py	2008-10-12 18:30:35 UTC (rev 92087)
+++ Sandbox/malthe/chameleon.core/src/chameleon/core/translation.py	2008-10-13 02:48:35 UTC (rev 92088)
@@ -30,6 +30,7 @@
     skip = None
     cdata = None
     omit = None
+    assign = None
     define = None
     macro = None
     use_macro = None
@@ -154,6 +155,15 @@
                     "repeat statement.")
             _.append(clauses.Repeat(variables[0], expression))
 
+        # assign
+        if self.assign is not None:
+            for declaration, expression in self.assign:
+                if len(declaration) != 1:
+                    raise ValueError("Can only assign single variable.")
+                variable = declaration[0]
+                _.append(clauses.Assign(
+                    expression, variable))        
+
         content = self.content
 
         # macro slot definition



More information about the Checkins mailing list