[Mumps2Py:] [55] any variable passed to the merge command will be indexed, so make sure it will be properly initialized. |
[ Thread Index |
Date Index
| More lists.mumps2py.org/discuss Archives
]
Revision: 55
Author: pgallot
Date: 2008-01-26 19:52:09 +0000 (Sat, 26 Jan 2008)
Log Message:
-----------
any variable passed to the merge command will be indexed, so make sure it will be properly initialized.
Modified Paths:
--------------
trunk/mumps2py/tokprepass.py
Modified: trunk/mumps2py/tokprepass.py
===================================================================
--- trunk/mumps2py/tokprepass.py 2008-01-26 19:49:36 UTC (rev 54)
+++ trunk/mumps2py/tokprepass.py 2008-01-26 19:52:09 UTC (rev 55)
@@ -49,16 +49,26 @@
""" Calls various functions to massage the tokens within a module."""
indentlevel_state = {'new':0, 'next':0}
localvars_state = {'collection':{} }
+ mergevars_state = {'collection':{} }
for token in a_mumps_module.TokenList:
fix_indent_levels(token, indentlevel_state)
findall_localvars(token, localvars_state)
+ if token.toktype == MERGECMD:
+ findall_localvars(token, mergevars_state)
# there are two things to be done with variables:
+ # (0a) Any variable in a merge command can be assumed to be indexed.
# (1)The variable names need to have any '%' characters replaced with
# something suitable, wherever that variable is used.
# (2) If any use of a variable is with indices, then all uses of that
# variable need to use indices.
+
+ if len(mergevars_state['collection']):
+ for token in mergevars_state['collection'][LOCALVAR]:
+ if not token.__dict__.has_key('indices'):
+ token.indices = None
+
vars_dict = {}
for token in localvars_state['collection'][LOCALVAR]:
if vars_dict.has_key(token.varname):