Author: esr
Date: Fri Apr  6 08:39:56 2007
New Revision: 16624

URL: http://svn.gna.org/viewcvs/wesnoth?rev=16624&view=rev
Log:
Teach macroscope not to treat macro formals as dangling references.

Modified:
    trunk/data/tools/macroscope

Modified: trunk/data/tools/macroscope
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/data/tools/macroscope?rev=16624&r1=16623&r2=16624&view=diff
==============================================================================
--- trunk/data/tools/macroscope (original)
+++ trunk/data/tools/macroscope Fri Apr  6 08:39:56 2007
@@ -67,14 +67,21 @@
     def check_macro_references(self, filelist):
         "Decorate definitions with all references from a specified filelist."
         self.unresolved = []
+        formals = []
         for filename in filelist:
             rfp = open(filename)
             for (n, line) in enumerate(rfp):
+                if line.startswith("#define"):
+                    formals = line.split()[2:]
+                elif line.startswith("#enddef"):
+                    formals = []
                 if line[0] == "#" or "{" not in line:
                     continue
-                for match in re.finditer(r"\{([A-Z][A-Z0-9_]+)\b", line):
+                for match in re.finditer(r"\{([A-Z][A-Z0-9_:]*[A-Z0-9])\b", 
line):
                     name = match.group(1)
-                    if name in self.xref:
+                    if name in formals:
+                        continue
+                    elif name in self.xref:
                         namedict = self.xref[name][1]
                         if filename not in namedict:
                             namedict[filename] = []


_______________________________________________
Wesnoth-commits mailing list
[email protected]
https://mail.gna.org/listinfo/wesnoth-commits

Reply via email to