(block)
| 2164 | |
| 2165 | |
| 2166 | def analyzecommon(block): |
| 2167 | if not hascommon(block): |
| 2168 | return block |
| 2169 | commonvars = [] |
| 2170 | for k in list(block['common'].keys()): |
| 2171 | comvars = [] |
| 2172 | for e in block['common'][k]: |
| 2173 | m = re.match( |
| 2174 | r'\A\s*\b(?P<name>.*?)\b\s*(\((?P<dims>.*?)\)|)\s*\Z', e, re.I) |
| 2175 | if m: |
| 2176 | dims = [] |
| 2177 | if m.group('dims'): |
| 2178 | dims = [x.strip() |
| 2179 | for x in markoutercomma(m.group('dims')).split('@,@')] |
| 2180 | n = rmbadname1(m.group('name').strip()) |
| 2181 | if n in block['vars']: |
| 2182 | if 'attrspec' in block['vars'][n]: |
| 2183 | block['vars'][n]['attrspec'].append( |
| 2184 | f"dimension({','.join(dims)})") |
| 2185 | else: |
| 2186 | block['vars'][n]['attrspec'] = [ |
| 2187 | f"dimension({','.join(dims)})"] |
| 2188 | elif dims: |
| 2189 | block['vars'][n] = { |
| 2190 | 'attrspec': [f"dimension({','.join(dims)})"]} |
| 2191 | else: |
| 2192 | block['vars'][n] = {} |
| 2193 | if n not in commonvars: |
| 2194 | commonvars.append(n) |
| 2195 | else: |
| 2196 | n = e |
| 2197 | errmess( |
| 2198 | f'analyzecommon: failed to extract "<name>[(<dims>)]" from "{e}" in common /{k}/.\n') |
| 2199 | comvars.append(n) |
| 2200 | block['common'][k] = comvars |
| 2201 | if 'commonvars' not in block: |
| 2202 | block['commonvars'] = commonvars |
| 2203 | else: |
| 2204 | block['commonvars'] = block['commonvars'] + commonvars |
| 2205 | return block |
| 2206 | |
| 2207 | |
| 2208 | def analyzebody(block, args, tab=''): |
no test coverage detected
searching dependent graphs…