NODOC_LINE_RE = re.compile(r'^([^:]+):(\d+): (\w+): (.*) is not documented\.$')
-THING_RE = re.compile(r'^Member ([a-zA-Z0-9_]+).*\((typedef|define|function|variable|enumeration)\) of (file|class) ')
+THING_RE = re.compile(r'^Member ([a-zA-Z0-9_]+).*\((typedef|define|function|variable|enumeration|macro definition)\) of (file|class) ')
SKIP_NAMES = [re.compile(s) for s in SKIP_NAME_PATTERNS]
"""Given a list of all the lines in the file (adjusted so 1-indexing works),
a line number that ident is alledgedly on, and ident, I figure out
the line where ident was really declared."""
+ lno = lineno
for lineno in xrange(lineno, 0, -1):
- if ident in lines[lineno]:
- return lineno
+ try:
+ if ident in lines[lineno]:
+ return lineno
+ except IndexError:
+ continue
return None
def hasdocdoc(lines, lineno, kind):
"""I return true if it looks like there's already a docdoc comment about
the thing on lineno of lines of type kind."""
- if "DOCDOC" in lines[lineno] or "DOCDOC" in lines[lineno-1]:
- return True
+ try:
+ if "DOCDOC" in lines[lineno]:
+ return True
+ except IndexError:
+ pass
+ try:
+ if "DOCDOC" in lines[lineno-1]:
+ return True
+ except IndexError:
+ pass
if kind == 'function' and FUNC_PAT.match(lines[lineno]):
if "DOCDOC" in lines[lineno-2]:
return True
e = read()
for fn, errs in e.iteritems():
+ print `(fn, errs)`
comments = checkf(fn, errs)
if comments:
applyComments(fn, comments)