Skip to content

Commit 34ad008

Browse files
committed
Comment in <protection> : class part of Cpp
In case we have e.g.: ``` /// \file /// the class class cls2 { private /* some comment */: /// a fie void cls_fie1(); }; void cls2::cls_fie1() {} ``` We get (a.o.) a warning like: ``` warning: documented symbol 'void cls2::cls_fie1' was not declared or defined. ```
1 parent f40290b commit 34ad008

File tree

1 file changed

+61
-99
lines changed

1 file changed

+61
-99
lines changed

src/scanner.l

Lines changed: 61 additions & 99 deletions
Original file line numberDiff line numberDiff line change
@@ -221,6 +221,7 @@ static const char *stateToString(int state);
221221

222222
// forward declarations for stateless functions
223223
static inline int computeIndent(const char *s,int startIndent);
224+
static inline void initMethodProtection(yyscan_t yyscanner,Protection prot);
224225
static QCString stripQuotes(const char *s);
225226
static bool nameIsOperator(QCString &name);
226227
void fixArgumentListForJavaScript(ArgumentList &al);
@@ -282,11 +283,11 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP})
282283
283284
/* no comment start / end signs inside square brackets */
284285
NCOMM [^/\*]
285-
// C start comment
286+
// C start comment
286287
CCS "/\*"
287288
// C end comment
288289
CCE "*\/"
289-
// Cpp comment
290+
// Cpp comment
290291
CPPC "/\/"
291292
// doxygen C start comment
292293
DCOMMC ("/\*!"|"/\**")
@@ -438,6 +439,7 @@ NONLopt [^\n]*
438439
%x RawString
439440
%x RawGString
440441
%x CSString
442+
%x CppProt
441443
442444
%x IDLAttribute
443445
%x IDLProp
@@ -590,105 +592,78 @@ NONLopt [^\n]*
590592
REJECT;
591593
}
592594
<FindMembers>{B}*("properties"){BN}*":"{BN}* { // IDL or Borland C++ builder property
595+
initMethodProtection(yyscanner,Protection::Public);
593596
yyextra->current->mtype = yyextra->mtype = MethodTypes::Property;
594-
yyextra->current->protection = yyextra->protection = Protection::Public ;
595-
yyextra->current->type.resize(0);
596-
yyextra->current->name.resize(0);
597-
yyextra->current->args.resize(0);
598-
yyextra->current->argList.clear();
599-
lineCount(yyscanner) ;
600597
}
601598

602-
<FindMembers>{B}*"k_dcop"{BN}*":"{BN}* { yyextra->current->mtype = yyextra->mtype = MethodTypes::DCOP;
603-
yyextra->current->protection = yyextra->protection = Protection::Public ;
604-
yyextra->current->type.resize(0);
605-
yyextra->current->name.resize(0);
606-
yyextra->current->args.resize(0);
607-
yyextra->current->argList.clear();
608-
lineCount(yyscanner) ;
599+
<FindMembers>{B}*"k_dcop"{BN}*":"{BN}* {
600+
initMethodProtection(yyscanner,Protection::Public);
601+
yyextra->current->mtype = yyextra->mtype = MethodTypes::DCOP;
609602
}
610603

611-
<FindMembers>{B}*("signals"|"Q_SIGNALS"){BN}*":"{BN}* { yyextra->current->mtype = yyextra->mtype = MethodTypes::Signal;
612-
613-
yyextra->current->protection = yyextra->protection = Protection::Public ;
614-
yyextra->current->type.resize(0);
615-
yyextra->current->name.resize(0);
616-
yyextra->current->args.resize(0);
617-
yyextra->current->argList.clear();
618-
lineCount(yyscanner) ;
604+
<FindMembers>{B}*("signals"|"Q_SIGNALS"){BN}*":"{BN}* {
605+
initMethodProtection(yyscanner,Protection::Public);
606+
yyextra->current->mtype = yyextra->mtype = MethodTypes::Signal;
619607
}
620608

621609
<FindMembers>{B}*"public"{BN}*("slots"|"Q_SLOTS"){BN}*":"{BN}* {
622-
yyextra->current->protection = yyextra->protection = Protection::Public ;
610+
initMethodProtection(yyscanner,Protection::Public);
623611
yyextra->current->mtype = yyextra->mtype = MethodTypes::Slot;
624-
yyextra->current->type.resize(0);
625-
yyextra->current->name.resize(0);
626-
yyextra->current->args.resize(0);
627-
yyextra->current->argList.clear();
628-
lineCount(yyscanner);
629612
}
630613

631614
<FindMembers>{B}*"protected"{BN}*("slots"|"Q_SLOTS"){BN}*":"{BN}* {
632-
yyextra->current->protection = yyextra->protection = Protection::Protected ;
615+
initMethodProtection(yyscanner,Protection::Protected);
633616
yyextra->current->mtype = yyextra->mtype = MethodTypes::Slot;
634-
yyextra->current->type.resize(0);
635-
yyextra->current->name.resize(0);
636-
yyextra->current->args.resize(0);
637-
yyextra->current->argList.clear();
638-
lineCount(yyscanner);
639617
}
640618

641619
<FindMembers>{B}*"private"{BN}*("slots"|"Q_SLOTS"){BN}*":"{BN}* {
642-
yyextra->current->protection = yyextra->protection = Protection::Private ;
620+
initMethodProtection(yyscanner,Protection::Private);
643621
yyextra->current->mtype = yyextra->mtype = MethodTypes::Slot;
644-
yyextra->current->type.resize(0);
645-
yyextra->current->name.resize(0);
646-
yyextra->current->args.resize(0);
647-
yyextra->current->argList.clear();
648-
lineCount(yyscanner);
649622
}
650623
<FindMembers>{B}*("public"|"methods"|"__published"){BN}*":"{BN}* {
651-
yyextra->current->protection = yyextra->protection = Protection::Public ;
652-
yyextra->current->mtype = yyextra->mtype = MethodTypes::Method;
653-
yyextra->current->type.resize(0);
654-
yyextra->current->name.resize(0);
655-
yyextra->current->args.resize(0);
656-
yyextra->current->argList.clear();
657-
lineCount(yyscanner) ;
624+
initMethodProtection(yyscanner,Protection::Public);
658625
}
659626
<FindMembers>{B}*"internal"{BN}*":"{BN}* { // for now treat C++/CLI's internal as package...
660627
if (yyextra->insideCli)
661628
{
662-
yyextra->current->protection = yyextra->protection = Protection::Package ;
663-
yyextra->current->mtype = yyextra->mtype = MethodTypes::Method;
664-
yyextra->current->type.resize(0);
665-
yyextra->current->name.resize(0);
666-
yyextra->current->args.resize(0);
667-
yyextra->current->argList.clear();
668-
lineCount(yyscanner) ;
629+
initMethodProtection(yyscanner,Protection::Package);
669630
}
670631
else
671632
{
672633
REJECT;
673634
}
674635
}
675636
<FindMembers>{B}*"protected"{BN}*":"{BN}* {
676-
yyextra->current->protection = yyextra->protection = Protection::Protected ;
677-
yyextra->current->mtype = yyextra->mtype = MethodTypes::Method;
678-
yyextra->current->type.resize(0);
679-
yyextra->current->name.resize(0);
680-
yyextra->current->args.resize(0);
681-
yyextra->current->argList.clear();
682-
lineCount(yyscanner) ;
637+
initMethodProtection(yyscanner,Protection::Protected);
683638
}
684639
<FindMembers>{B}*"private"{BN}*":"{BN}* {
685-
yyextra->current->protection = yyextra->protection = Protection::Private ;
686-
yyextra->current->mtype = yyextra->mtype = MethodTypes::Method;
687-
yyextra->current->type.resize(0);
688-
yyextra->current->name.resize(0);
689-
yyextra->current->args.resize(0);
690-
yyextra->current->argList.clear();
691-
lineCount(yyscanner) ;
640+
initMethodProtection(yyscanner,Protection::Private);
641+
}
642+
<FindMembers>{B}*"public"/({BN}|{CCS}|{CPPC}) {
643+
if (!yyextra->insideCpp) REJECT;
644+
initMethodProtection(yyscanner,Protection::Public);
645+
BEGIN(CppProt);
646+
}
647+
<FindMembers>{B}*"protected"/({BN}|{CCS}|{CPPC}) {
648+
if (!yyextra->insideCpp) REJECT;
649+
initMethodProtection(yyscanner,Protection::Protected);
650+
BEGIN(CppProt);
651+
}
652+
<FindMembers>{B}*"private"/({BN}|{CCS}|{CPPC}) {
653+
if (!yyextra->insideCpp) REJECT;
654+
initMethodProtection(yyscanner,Protection::Private);
655+
BEGIN(CppProt);
656+
}
657+
<CppProt>":" {
658+
BEGIN(FindMembers);
659+
}
660+
<CppProt>{BN}+ { lineCount(yyscanner); }
661+
<CppProt>{CPPC}.*\n { lineCount(yyscanner); }
662+
<CppProt>{CCS} { yyextra->lastCContext = YY_START ;
663+
BEGIN( SkipComment ) ;
664+
}
665+
<CppProt>("slots"|"Q_SLOTS") {
666+
yyextra->current->mtype = yyextra->mtype = MethodTypes::Slot;
692667
}
693668
<FindMembers>{B}*"event"{BN}+ {
694669
if (yyextra->insideCli)
@@ -776,31 +751,13 @@ NONLopt [^\n]*
776751
}
777752
*/
778753
<FindMembers>{B}*"@private"{BN}+ {
779-
yyextra->current->protection = yyextra->protection = Protection::Private ;
780-
yyextra->current->mtype = yyextra->mtype = MethodTypes::Method;
781-
yyextra->current->type.resize(0);
782-
yyextra->current->name.resize(0);
783-
yyextra->current->args.resize(0);
784-
yyextra->current->argList.clear();
785-
lineCount(yyscanner) ;
754+
initMethodProtection(yyscanner,Protection::Private);
786755
}
787756
<FindMembers>{B}*"@protected"{BN}+ {
788-
yyextra->current->protection = yyextra->protection = Protection::Protected ;
789-
yyextra->current->mtype = yyextra->mtype = MethodTypes::Method;
790-
yyextra->current->type.resize(0);
791-
yyextra->current->name.resize(0);
792-
yyextra->current->args.resize(0);
793-
yyextra->current->argList.clear();
794-
lineCount(yyscanner) ;
757+
initMethodProtection(yyscanner,Protection::Protected);
795758
}
796-
<FindMembers>{B}*"@public"{BN}+ {
797-
yyextra->current->protection = yyextra->protection = Protection::Public ;
798-
yyextra->current->mtype = yyextra->mtype = MethodTypes::Method;
799-
yyextra->current->type.resize(0);
800-
yyextra->current->name.resize(0);
801-
yyextra->current->args.resize(0);
802-
yyextra->current->argList.clear();
803-
lineCount(yyscanner) ;
759+
<FindMembers>{B}*"@public"{BN}+ {
760+
initMethodProtection(yyscanner,Protection::Public);
804761
}
805762
<FindMembers>[\-+]{BN}* {
806763
if (!yyextra->insideObjC)
@@ -809,23 +766,17 @@ NONLopt [^\n]*
809766
}
810767
else
811768
{
812-
lineCount(yyscanner);
813769
yyextra->current->fileName = yyextra->fileName;
814770
yyextra->current->startLine = yyextra->yyLineNr;
815771
yyextra->current->startColumn = yyextra->yyColNr;
816772
yyextra->current->bodyLine = yyextra->yyLineNr;
817773
yyextra->current->bodyColumn = yyextra->yyColNr;
818774
yyextra->current->section = Entry::FUNCTION_SEC;
819-
yyextra->current->protection = yyextra->protection = Protection::Public ;
820775
yyextra->language = yyextra->current->lang = SrcLangExt_ObjC;
821776
yyextra->insideObjC = TRUE;
822777
yyextra->current->virt = Specifier::Virtual;
823778
yyextra->current->stat=yytext[0]=='+';
824-
yyextra->current->mtype = yyextra->mtype = MethodTypes::Method;
825-
yyextra->current->type.resize(0);
826-
yyextra->current->name.resize(0);
827-
yyextra->current->args.resize(0);
828-
yyextra->current->argList.clear();
779+
initMethodProtection(yyscanner,Protection::Public);
829780
BEGIN( ObjCMethod );
830781
}
831782
}
@@ -4749,7 +4700,7 @@ NONLopt [^\n]*
47494700
}
47504701
<CopyArgVerbatim>[\\@]("f$"|"f]"|"f}"|"f)") { // end of verbatim block
47514702
yyextra->fullArgString+=yytext;
4752-
if (yyextra->docBlockName==&yytext[1])
4703+
if (yyextra->docBlockName==&yytext[1])
47534704
{
47544705
BEGIN(CopyArgCommentLine);
47554706
}
@@ -7256,6 +7207,17 @@ static inline int computeIndent(const char *s,int startIndent)
72567207
}
72577208
return col;
72587209
}
7210+
static inline void initMethodProtection(yyscan_t yyscanner,Protection prot)
7211+
{
7212+
struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
7213+
yyextra->current->protection = yyextra->protection = prot;
7214+
yyextra->current->mtype = yyextra->mtype = MethodTypes::Method;
7215+
yyextra->current->type.resize(0);
7216+
yyextra->current->name.resize(0);
7217+
yyextra->current->args.resize(0);
7218+
yyextra->current->argList.clear();
7219+
lineCount(yyscanner) ;
7220+
}
72597221
72607222
static void addType(yyscan_t yyscanner)
72617223
{

0 commit comments

Comments
 (0)