@@ -221,6 +221,7 @@ static const char *stateToString(int state);
221
221
222
222
// forward declarations for stateless functions
223
223
static inline int computeIndent (const char *s,int startIndent);
224
+ static inline void initMethodProtection (yyscan_t yyscanner,Protection prot);
224
225
static QCString stripQuotes (const char *s);
225
226
static bool nameIsOperator (QCString &name);
226
227
void fixArgumentListForJavaScript (ArgumentList &al);
@@ -282,11 +283,11 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP})
282
283
283
284
/* no comment start / end signs inside square brackets */
284
285
NCOMM [^/\*]
285
- // C start comment
286
+ // C start comment
286
287
CCS " /\*"
287
288
// C end comment
288
289
CCE " *\/"
289
- // Cpp comment
290
+ // Cpp comment
290
291
CPPC " /\/"
291
292
// doxygen C start comment
292
293
DCOMMC (" /\*!" |" /\**" )
@@ -438,6 +439,7 @@ NONLopt [^\n]*
438
439
%x RawString
439
440
%x RawGString
440
441
%x CSString
442
+ %x CppProt
441
443
442
444
%x IDLAttribute
443
445
%x IDLProp
@@ -590,105 +592,78 @@ NONLopt [^\n]*
590
592
REJECT;
591
593
}
592
594
<FindMembers>{B}*(" properties" ){BN}*" :" {BN}* { // IDL or Borland C++ builder property
595
+ initMethodProtection (yyscanner,Protection::Public);
593
596
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) ;
600
597
}
601
598
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;
609
602
}
610
603
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;
619
607
}
620
608
621
609
<FindMembers>{B}*" public" {BN}*(" slots" |" Q_SLOTS" ){BN}*" :" {BN}* {
622
- yyextra-> current -> protection = yyextra-> protection = Protection::Public ;
610
+ initMethodProtection (yyscanner, Protection::Public) ;
623
611
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);
629
612
}
630
613
631
614
<FindMembers>{B}*" protected" {BN}*(" slots" |" Q_SLOTS" ){BN}*" :" {BN}* {
632
- yyextra-> current -> protection = yyextra-> protection = Protection::Protected ;
615
+ initMethodProtection (yyscanner, Protection::Protected) ;
633
616
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);
639
617
}
640
618
641
619
<FindMembers>{B}*" private" {BN}*(" slots" |" Q_SLOTS" ){BN}*" :" {BN}* {
642
- yyextra-> current -> protection = yyextra-> protection = Protection::Private ;
620
+ initMethodProtection (yyscanner, Protection::Private) ;
643
621
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);
649
622
}
650
623
<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);
658
625
}
659
626
<FindMembers>{B}*" internal" {BN}*" :" {BN}* { // for now treat C++/CLI's internal as package...
660
627
if (yyextra->insideCli )
661
628
{
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);
669
630
}
670
631
else
671
632
{
672
633
REJECT;
673
634
}
674
635
}
675
636
<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);
683
638
}
684
639
<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;
692
667
}
693
668
<FindMembers>{B}*" event" {BN}+ {
694
669
if (yyextra->insideCli )
@@ -776,31 +751,13 @@ NONLopt [^\n]*
776
751
}
777
752
*/
778
753
<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);
786
755
}
787
756
<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);
795
758
}
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);
804
761
}
805
762
<FindMembers>[\-+]{BN}* {
806
763
if (!yyextra->insideObjC )
@@ -809,23 +766,17 @@ NONLopt [^\n]*
809
766
}
810
767
else
811
768
{
812
- lineCount (yyscanner);
813
769
yyextra->current ->fileName = yyextra->fileName ;
814
770
yyextra->current ->startLine = yyextra->yyLineNr ;
815
771
yyextra->current ->startColumn = yyextra->yyColNr ;
816
772
yyextra->current ->bodyLine = yyextra->yyLineNr ;
817
773
yyextra->current ->bodyColumn = yyextra->yyColNr ;
818
774
yyextra->current ->section = Entry::FUNCTION_SEC;
819
- yyextra->current ->protection = yyextra->protection = Protection::Public ;
820
775
yyextra->language = yyextra->current ->lang = SrcLangExt_ObjC;
821
776
yyextra->insideObjC = TRUE ;
822
777
yyextra->current ->virt = Specifier::Virtual;
823
778
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);
829
780
BEGIN ( ObjCMethod );
830
781
}
831
782
}
@@ -4749,7 +4700,7 @@ NONLopt [^\n]*
4749
4700
}
4750
4701
<CopyArgVerbatim>[\\@](" f$" |" f]" |" f}" |" f)" ) { // end of verbatim block
4751
4702
yyextra->fullArgString +=yytext;
4752
- if (yyextra->docBlockName ==&yytext[1 ])
4703
+ if (yyextra->docBlockName ==&yytext[1 ])
4753
4704
{
4754
4705
BEGIN (CopyArgCommentLine);
4755
4706
}
@@ -7256,6 +7207,17 @@ static inline int computeIndent(const char *s,int startIndent)
7256
7207
}
7257
7208
return col;
7258
7209
}
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
+ }
7259
7221
7260
7222
static void addType(yyscan_t yyscanner)
7261
7223
{
0 commit comments