[pod,px] Allow to reference an already defined variable instead of defining one in a var statement, via the '@' prefix. For example, in PX: var='@i = i + 1'. [pod] Repaired broken tests [gen] Bugfixes.

This commit is contained in:
Gaetan Delannay 2013-09-23 22:36:09 +02:00
parent bd80d63eda
commit 180b3473e8
11 changed files with 1903 additions and 1887 deletions

View file

@ -346,6 +346,10 @@ class VariablesAction(BufferAction):
# Evaluate variable expression in vRes.
vRes, error = self.evaluateExpression(result, context, expr)
if error: return
# Replace the value of global variables
if name.startswith('@'):
context[name[1:]] = vRes
continue
# Remember the variable previous value if already in the context
if name in context:
if not hidden:
@ -364,6 +368,7 @@ class VariablesAction(BufferAction):
if hidden: context.update(hidden)
# Delete not-hidden variables
for name, expr in self.variables:
if name.startswith('@'): continue
if hidden and (name in hidden): continue
del context[name]
# ------------------------------------------------------------------------------

View file

@ -242,7 +242,7 @@ class MemoryBuffer(Buffer):
actionRex = re.compile('(?:(\w+)\s*\:\s*)?do\s+(\w+)(-)?' \
'(?:\s+(for|if|else|with)\s*(.*))?')
forRex = re.compile('\s*([\w\-_]+)\s+in\s+(.*)')
varRex = re.compile('\s*([\w\-_]+)\s*=\s*(.*)')
varRex = re.compile('\s*(@?[\w\-_]+)\s*=\s*(.*)')
def __init__(self, env, parent):
Buffer.__init__(self, env, parent)

File diff suppressed because it is too large Load diff

Binary file not shown.

Binary file not shown.

Binary file not shown.