[Checkins] SVN: Sandbox/malthe/chameleon.core/src/chameleon/core/generation.py Added method to generate unscoped temporary variables.
Malthe Borch
mborch at gmail.com
Mon Sep 29 11:00:52 EDT 2008
Log message for revision 91598:
Added method to generate unscoped temporary variables.
Changed:
U Sandbox/malthe/chameleon.core/src/chameleon/core/generation.py
-=-
Modified: Sandbox/malthe/chameleon.core/src/chameleon/core/generation.py
===================================================================
--- Sandbox/malthe/chameleon.core/src/chameleon/core/generation.py 2008-09-29 14:50:35 UTC (rev 91597)
+++ Sandbox/malthe/chameleon.core/src/chameleon/core/generation.py 2008-09-29 15:00:51 UTC (rev 91598)
@@ -67,7 +67,7 @@
annotations and temporary variables."""
t_prefix = '_tmp'
- v_prefix = '_var'
+ v_prefix = '_tmpv'
def __init__(self, symbols=None, encoding=None,
indentation=0, indentation_string="\t"):
@@ -83,8 +83,13 @@
self.annotations = {}
self._variables = {}
self.t_counter = 0
+ self.v_counter = 0
self.l_counter = 0
+ def new_var(self):
+ self.v_counter += 1
+ return "%s%d" % (self.v_prefix, self.v_counter)
+
def save(self):
self.t_counter += 1
return "%s%d" % (self.t_prefix, self.t_counter)
More information about the Checkins
mailing list