Support extracting doxygen comments when declspec or attributes are present

This commit is contained in:
Dustin Spicuzza
2022-12-15 00:50:08 -05:00
parent 079d643c67
commit 2ba5c3c829
2 changed files with 57 additions and 1 deletions

View File

@@ -308,25 +308,34 @@ class CxxParser:
";": lambda _1, _2: None,
}
_keep_doxygen = {"__declspec", "alignas", "__attribute__", "DBL_LBRACKET"}
tok = None
get_token_eof_ok = self.lex.token_eof_ok
get_doxygen = self.lex.get_doxygen
doxygen = None
try:
while True:
tok = get_token_eof_ok()
if not tok:
break
doxygen = get_doxygen()
if doxygen is None:
doxygen = get_doxygen()
fn = _translation_unit_tokens.get(tok.type)
if fn:
fn(tok, doxygen)
if tok.type not in _keep_doxygen:
doxygen = None
else:
# this processes ambiguous declarations
self._parse_declarations(tok, doxygen)
doxygen = None
except Exception as e:
if self.verbose: