From e82f5c28622af3185026fd249974dda0df2eaebc Mon Sep 17 00:00:00 2001 From: Robert Muir Date: Tue, 28 Aug 2012 02:53:39 +0000 Subject: [PATCH] avoid false positives in regexes, and parse nested classes correctly git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1377953 13f79535-47bb-0310-9956-ffa450edef68 --- dev-tools/scripts/checkJavaDocs.py | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/dev-tools/scripts/checkJavaDocs.py b/dev-tools/scripts/checkJavaDocs.py index 42a79f4bab1..cab679f830d 100644 --- a/dev-tools/scripts/checkJavaDocs.py +++ b/dev-tools/scripts/checkJavaDocs.py @@ -22,8 +22,9 @@ reHREF = re.compile('(.*?)', re.IGNORECASE) reMarkup = re.compile('<.*?>') reDivBlock = re.compile('
(.*?)
', re.IGNORECASE) reCaption = re.compile('(.*?)', re.IGNORECASE) -reTDLast = re.compile('.*', re.IGNORECASE) -reColOne = re.compile('.*', re.IGNORECASE) +reTDLastNested = re.compile('', re.IGNORECASE) +reTDLast = re.compile('', re.IGNORECASE) +reColOne = re.compile('', 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()