if cursor.kind == clang.cindex.CursorKind.CXX_METHOD or cursor.kind == clang.cindex.CursorKind.CONSTRUCTOR or cursor.kind == clang.cindex.CursorKind.DESTRUCTOR:
# cursor ran into a C++ method
- logging.debug( "%5d %s%s(%s)" % (cursor.extent.start.line, indent, Colt(kind).magenta(), Colt(text).blue()) )
+ logging.debug( "%5d %s%s(%s)" % (cursor.location.line, indent, Colt(kind).magenta(), Colt(text).blue()) )
comment_method(cursor, comments)
elif cursor.kind == clang.cindex.CursorKind.FIELD_DECL:
# cursor ran into a data member declaration
- logging.debug( "%5d %s%s(%s)" % (cursor.extent.start.line, indent, Colt(kind).magenta(), Colt(text).blue()) )
+ logging.debug( "%5d %s%s(%s)" % (cursor.location.line, indent, Colt(kind).magenta(), Colt(text).blue()) )
comment_datamember(cursor, comments)
else:
- logging.debug( "%5d %s%s(%s)" % (cursor.extent.start.line, indent, kind, text) )
+ logging.debug( "%5d %s%s(%s)" % (cursor.location.line, indent, kind, text) )
for child_cursor in cursor.get_children():
traverse_ast(child_cursor, filename, comments, recursion+1)
def refactor_comment(comment):
recomm = r'^(/{2,}|/\*)?\s*(.*?)\s*((/{2,})?\s*|\*/)$'
+ regarbage = r'^[\s*=-_#]+$'
new_comment = []
insert_blank = False
mcomm = re.search( recomm, line_comment )
if mcomm:
new_line_comment = mcomm.group(2)
- if new_line_comment == '':
+ mgarbage = re.search( regarbage, new_line_comment )
+ if new_line_comment == '' or mgarbage is not None:
insert_blank = True
else:
if insert_blank and not wait_first_non_blank: