You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by rm...@apache.org on 2012/08/28 04:54:02 UTC

svn commit: r1377954 - in /lucene/dev/branches/branch_4x: ./ dev-tools/ dev-tools/scripts/checkJavaDocs.py

Author: rmuir
Date: Tue Aug 28 02:54:02 2012
New Revision: 1377954

URL: http://svn.apache.org/viewvc?rev=1377954&view=rev
Log:
avoid false positives in regexes, and parse nested classes correctly

Modified:
    lucene/dev/branches/branch_4x/   (props changed)
    lucene/dev/branches/branch_4x/dev-tools/   (props changed)
    lucene/dev/branches/branch_4x/dev-tools/scripts/checkJavaDocs.py

Modified: lucene/dev/branches/branch_4x/dev-tools/scripts/checkJavaDocs.py
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/dev-tools/scripts/checkJavaDocs.py?rev=1377954&r1=1377953&r2=1377954&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/dev-tools/scripts/checkJavaDocs.py (original)
+++ lucene/dev/branches/branch_4x/dev-tools/scripts/checkJavaDocs.py Tue Aug 28 02:54:02 2012
@@ -22,8 +22,9 @@ reHREF = re.compile('<a.*?>(.*?)</a>', r
 reMarkup = re.compile('<.*?>')
 reDivBlock = re.compile('<div class="block">(.*?)</div>', re.IGNORECASE)
 reCaption = re.compile('<caption><span>(.*?)</span>', re.IGNORECASE)
-reTDLast = re.compile('<td class="colLast">.*<a href=".*#(.*?)">', re.IGNORECASE)
-reColOne = re.compile('<td class="colOne">.*<a href=".*#(.*?)">', re.IGNORECASE)
+reTDLastNested = re.compile('<td class="colLast"><code><strong><a href="[^>]*\.([^>]*?)\.html" title="class in[^>]*">', re.IGNORECASE)
+reTDLast = re.compile('<td class="colLast"><code><strong><a href="[^>]*#([^>]*?)">', re.IGNORECASE)
+reColOne = re.compile('<td class="colOne"><code><strong><a href="[^>]*#([^>]*?)">', re.IGNORECASE)
 
 def cleanHTML(s):
   s = reMarkup.sub('', s)
@@ -50,18 +51,25 @@ def checkClass(fullPath):
     if m is not None:
       lastCaption = m.group(1)
       #print('    caption %s' % lastCaption)
-    m = reTDLast.search(line)
+    m = reTDLastNested.search(line)
     if m is not None:
-      # TODO: this is actually the link anchor for the method, which we must
-      # somehow defer and only later check if the list at that anchor does not contain
-      # the text 'specified by' (in which case its an overridden method from an external library)
+      # nested classes
       lastItem = m.group(1)
       #print('      item %s' % lastItem)
     else:
-      m = reColOne.search(line)
+      m = reTDLast.search(line)
       if m is not None:
+        # methods etc
+        # TODO: this is actually the link anchor for the method, which we must
+        # somehow defer and only later check if the list at that anchor does not contain
+        # the text 'specified by' (in which case its an overridden method from an external library)
         lastItem = m.group(1)
-        #print('      item %s' % lastItem)
+      else:
+        # ctors etc
+        m = reColOne.search(line)
+        if m is not None:
+          lastItem = m.group(1)
+          #print('      item %s' % lastItem)
 
     lineLower = line.strip().lower()