Minor bug fix.
This commit is contained in:
parent
64dc25a1c9
commit
9c89a6c0fe
2 changed files with 18 additions and 1 deletions
|
@ -217,7 +217,7 @@ class CrossRef:
|
|||
if defn.undef != None:
|
||||
# Local macros are only visible in the file where they were defined
|
||||
return defn.filename == fn and n >= defn.lineno and n <= defn.undef
|
||||
if self.properties[defn.namespace].get("export") == "yes":
|
||||
if defn.namespace in self.properties and self.properties[defn.namespace].get("export") == "yes":
|
||||
# Macros and resources in subtrees with export=yes are global
|
||||
return True
|
||||
elif not self.filelist.neighbors(defn.filename, fn):
|
||||
|
|
|
@ -1822,6 +1822,23 @@ def translator(filename, mapxforms, textxform, versions):
|
|||
else:
|
||||
# Map or mask -- just run everything together
|
||||
transformed = "".join(newdata)
|
||||
# Simple check for unbalanced macro calls
|
||||
unclosed = None
|
||||
linecount = 1
|
||||
depth = 0
|
||||
for i in range(len(transformed)):
|
||||
if transformed[i] == '\n':
|
||||
linecount += 1
|
||||
elif transformed[i] == '{':
|
||||
if depth == 0:
|
||||
unclosed = linecount
|
||||
depth += 1
|
||||
elif transformed[i] == '}':
|
||||
depth -= 1
|
||||
if depth == 0:
|
||||
unclosed = None
|
||||
if unclosed:
|
||||
print >>sys.stderr, '"%s", line %d: unbalanced {.' % (filename, unclosed)
|
||||
# Return None if the transformation functions made no changes.
|
||||
if modified:
|
||||
return transformed
|
||||
|
|
Loading…
Add table
Reference in a new issue