Skip to content

Commit

Permalink
Allow checking which doxygen style is used
Browse files Browse the repository at this point in the history
  • Loading branch information
kunaltyagi committed Sep 14, 2024
1 parent 655e0e9 commit a5c4e0f
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 15 deletions.
8 changes: 5 additions & 3 deletions nsiqcppstyle_checker.py
Original file line number Diff line number Diff line change
Expand Up @@ -362,7 +362,9 @@ def t_COMMENT(t):
r"/\*(.|\n)*?\*/"
t.lexer.lineno += t.value.count("\n")
if Search(r"/\*\*\s", t.value):
t.additional = "DOXYGEN"
t.additional = "DOXYGEN_JAVADOC"
elif Search(r"/\*\!\s", t.value):
t.additional = "DOXYGEN_QT"
return t


Expand All @@ -372,9 +374,9 @@ def t_COMMENT(t):
def t_CPPCOMMENT(t):
r"//.*"
if Search(r"^///\b", t.value):
t.additional = "DOXYGEN"
t.additional = "DOXYGEN_CPP"
if Search(r"^///<", t.value):
t.additional = "DOXYGENPOST"
t.additional = "DOXYGEN_POST"

return t

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,9 @@ def RunRule(lexer, currentType, fullName, decl, contextStack, typeContext):
lexer.PushTokenIndex()
t3 = lexer.GetPrevTokenInTypeList(["LBRACE", "SEMI", "PREPROCESSOR"], False, True)
lexer.PopTokenIndex()
if t2 is not None and t2.additional == "DOXYGEN" and (t3 is None or t2.lexpos > t3.lexpos):
return
if t2 is not None and (t3 is None or t2.lexpos > t3.lexpos):
if t2.additional in ["DOXYGEN_JAVADOC", "DOXYGEN_QT", "DOXYGEN_CPP"]:
return
nsiqcppstyle_reporter.Error(
t,
__name__,
Expand Down Expand Up @@ -99,12 +100,12 @@ def test4(self):
self.Analyze(
"thisfile.c",
"""
/**
/*!
*
*/
class J {
int k;
/**
/*!
*/
class T {
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,9 @@ def RunRule(lexer, currentType, fullName, decl, contextStack, typeContext):
lexer.PushTokenIndex()
t3 = lexer.GetPrevTokenInTypeList(["SEMI", "PREPROCESSOR", "LBRACE"], False, True)
lexer.PopTokenIndex()
if t2 is not None and t2.additional == "DOXYGEN" and (t3 is None or t2.lexpos > t3.lexpos):
return
if t2 is not None and (t3 is None or t2.lexpos > t3.lexpos):
if t2.additional in ["DOXYGEN_JAVADOC", "DOXYGEN_QT", "DOXYGEN_CPP"]:
return
nsiqcppstyle_reporter.Error(
t,
__name__,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,9 @@ def RunRule(lexer, currentType, fullName, decl, contextStack, context):
lexer.PushTokenIndex()
t3 = lexer.GetPrevTokenInTypeList(["SEMI", "PREPROCESSOR", "LBRACE"], False, True)
lexer.PopTokenIndex()
if t2 is not None and t2.additional == "DOXYGEN" and (t3 is None or t2.lexpos > t3.lexpos):
return
if t2 is not None and (t3 is None or t2.lexpos > t3.lexpos):
if t2.additional in ["DOXYGEN_JAVADOC", "DOXYGEN_QT", "DOXYGEN_CPP"]:
return
nsiqcppstyle_reporter.Error(
t,
__name__,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,9 @@ def RunRule(lexer, fullName, decl, contextStack, context):
lexer.PushTokenIndex()
t3 = lexer.GetPrevTokenInTypeList(["SEMI", "PREPROCESSOR"], False, True)
lexer.PopTokenIndex()
if t2 is not None and t2.additional == "DOXYGEN" and (t3 is None or t2.lexpos > t3.lexpos):
return
if t2 is not None and (t3 is None or t2.lexpos > t3.lexpos):
if t2.additional in ["DOXYGEN_JAVADOC", "DOXYGEN_QT", "DOXYGEN_CPP"]:
return
nsiqcppstyle_reporter.Error(
t,
__name__,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,9 @@ def RunRule(lexer, fullName, decl, contextStack, context):
lexer.PushTokenIndex()
t3 = lexer.GetPrevTokenInTypeList(["SEMI", "PREPROCESSOR"], False, True)
lexer.PopTokenIndex()
if t2 is not None and t2.additional == "DOXYGEN" and (t3 is None or t.lexpos > t3.lexpos):
return
if t2 is not None and (t3 is None or t.lexpos > t3.lexpos):
if t2.additional in ["DOXYGEN_JAVADOC", "DOXYGEN_QT", "DOXYGEN_CPP"]:
return
nsiqcppstyle_reporter.Error(
t,
__name__,
Expand Down

0 comments on commit a5c4e0f

Please sign in to comment.