490 {
492 }
static char resolveTrigraph(char c)
493<Start>^{B}*"#" {
494 yyextra->yyColNr+=(int)yyleng;
495 yyextra->yyMLines=0;
496 yyextra->potentialDefine=yytext;
497 BEGIN(Command);
498 }
499<Start>^("%top{"|"%{") {
502 BEGIN(LexCopyLine);
503 }
static void outputArray(yyscan_t yyscanner, const char *a, yy_size_t len)
504<Start>^{Bopt}"cpp_quote"{Bopt}"("{Bopt}\" {
505 if (yyextra->insideIDL)
506 {
507 BEGIN(IDLquote);
508 }
509 else
510 {
511 REJECT;
512 }
513 }
514<IDLquote>"\\\\" {
516 }
517<IDLquote>"\\\"" {
519 }
520<IDLquote>"\""{Bopt}")" {
521 BEGIN(Start);
522 }
523<IDLquote>\n {
525 yyextra->yyLineNr++;
526 }
527<IDLquote>. {
529 }
530<Start>^{Bopt}/[^#] {
532 BEGIN(CopyLine);
533 }
534<Start>^{B}*[a-z_A-Z\x80-\xFF][a-z_A-Z0-9\x80-\xFF]+{B}*"("[^\)\n]*")"/{BN}{1,10}*[:{] { // constructors?
535 int i;
536 for (i=(int)yyleng-1;i>=0;i--)
537 {
538 unput(yytext[i]);
539 }
540 BEGIN(CopyLine);
541 }
542<Start>^{B}*[_A-Z][_A-Z0-9]+{B}*"("[^\(\)\n]*"("[^\)\n]*")"[^\)\n]*")"{B}*\n | // function list macro with one (...) argument, e.g. for K_GLOBAL_STATIC_WITH_ARGS
543<Start>^{B}*[_A-Z][_A-Z0-9]+{B}*"("[^\)\n]*")"{B}*\n | // function like macro
544<Start>^{B}*[_A-Z][_A-Z0-9]+{B}*"("[^\(\)\n]*"("[^\)\n]*")"[^\)\n]*")"/{B}*("//"|"/\*") | // function list macro with one (...) argument followed by comment
545<Start>^{B}*[_A-Z][_A-Z0-9]+{B}*"("[^\)\n]*")"/{B}*("//"|"/\*") { // function like macro followed by comment
548 int pos = name.find('(');
549 if (pos<0) pos=0;
550 name=name.left(pos).stripWhiteSpace();
#define Config_getBool(name)
551
553 if (skipFuncMacros && !yyextra->insideFtn &&
554 name!="Q_PROPERTY" &&
555 !(
556 (yyextra->includeStack.empty() || yyextra->curlyCount>0) &&
557 yyextra->macroExpansion &&
559
561 )
562 )
563 {
564
565 if (yytext[yyleng-1] == '\n')
566 {
568 yyextra->yyLineNr++;
569 }
570 }
571 else
572 {
573 int i;
574 for (i=(int)yyleng-1;i>=0;i--)
575 {
576 unput(yytext[i]);
577 }
578 BEGIN(CopyLine);
579 }
580 }
581<CopyLine,LexCopyLine>"extern"{BN}*"\""[^\"]+"\""{BN}*("{")? {
583 yyextra->yyLineNr+=text.
contains(
'\n');
585 }
586<CopyLine,LexCopyLine>{RAWBEGIN} {
589 BEGIN(CopyRawString);
590 }
QCString extractBeginRawStringDelimiter(const char *rawStart)
591<CopyLine,LexCopyLine>"{" { // count brackets inside the main file
592 if (yyextra->includeStack.empty())
593 {
594 yyextra->curlyCount++;
595 }
597 }
598<LexCopyLine>^"%}" {
600 }
601<CopyLine,LexCopyLine>"}" { // count brackets inside the main file
602 if (yyextra->includeStack.empty() && yyextra->curlyCount>0)
603 {
604 yyextra->curlyCount--;
605 }
607 }
608<CopyLine,LexCopyLine>"'"\\[0-7]{1,3}"'" {
610 }
611<CopyLine,LexCopyLine>"'"\\."'" {
613 }
614<CopyLine,LexCopyLine>"'"."'" {
616 }
617<CopyLine,LexCopyLine>[$]?@\" {
620 BEGIN( CopyStringCs );
621 }
622<CopyLine,LexCopyLine>\" {
625 {
626 BEGIN( CopyString );
627 }
628 else
629 {
630 BEGIN( CopyStringFtnDouble );
631 }
632 }
633<CopyLine,LexCopyLine>\' {
636 BEGIN( CopyStringFtn );
637 }
638<CopyString>[^\"\\\r\n]{1,1000} {
640 }
641<CopyStringCs>[^\"\r\n]{1,1000} {
643 }
644<CopyStringCs>\"\" {
646 }
647<CopyString>\\. {
649 }
650<CopyString,CopyStringCs>\" {
652 BEGIN( CopyLine );
653 }
654<CopyStringFtnDouble>[^\"\\\r\n]{1,1000} {
656 }
657<CopyStringFtnDouble>\\. {
659 }
660<CopyStringFtnDouble>\" {
662 BEGIN( CopyLine );
663 }
664<CopyStringFtn>[^\'\\\r\n]{1,1000} {
666 }
667<CopyStringFtn>\\. {
669 }
670<CopyStringFtn>\' {
672 BEGIN( CopyLine );
673 }
674<CopyRawString>{RAWEND} {
677 {
678 BEGIN( CopyLine );
679 }
680 }
QCString extractEndRawStringDelimiter(const char *rawEnd)
681<CopyRawString>[^)]{1,1000} {
683 }
684<CopyRawString>. {
686 }
687<CopyLine,LexCopyLine>{ID}/{BN}{0,80}"(" {
688 yyextra->expectGuard =
FALSE;
690
691
692
693
694
695
696
697
698 if ((yyextra->includeStack.empty() || yyextra->curlyCount>0) &&
699 yyextra->macroExpansion &&
702 )
703 {
704
705 yyextra->roundCount=0;
706 yyextra->defArgsStr=yytext;
708 {
713 }
714 else
715 {
716 yyextra->findDefArgContext = CopyLine;
717 BEGIN(FindDefineArgs);
718 }
719 }
720 else
721 {
723 }
724 }
static QCString expandMacro(yyscan_t yyscanner, const QCString &name)
725<CopyLine>{RulesDelim} {
727 yyextra->lexRulesPart = !yyextra->lexRulesPart;
729 }
730
731<CopyLine>{RulesSharp} {
732 if (!yyextra->lexRulesPart) REJECT;
733 if (yyextra->curlyCount) REJECT;
735 BEGIN(RulesPattern);
736 }
737<RulesPattern>{EscapeRulesChar} {
739 }
740<RulesPattern>{RulesCurly} {
742 }
743<RulesPattern>{StartDouble} {
745 yyextra->lastContext = YY_START;
746 BEGIN(RulesDouble);
747 }
748<RulesDouble,RulesRoundDouble>"\\\\" {
750 }
751<RulesDouble,RulesRoundDouble>"\\\"" {
753 }
754<RulesDouble>"\"" {
756 BEGIN( yyextra->lastContext ) ;
757 }
758<RulesRoundDouble>"\"" {
760 BEGIN(RulesRound) ;
761 }
762<RulesDouble,RulesRoundDouble>. {
764 }
765<RulesPattern>{StartSquare} {
767 yyextra->lastContext = YY_START;
768 BEGIN(RulesSquare);
769 }
770<RulesSquare,RulesRoundSquare>{CHARCE} {
772 }
773<RulesSquare,RulesRoundSquare>"\\[" |
774<RulesSquare,RulesRoundSquare>"\\]" {
776 }
777<RulesSquare>"]" {
779 BEGIN(RulesPattern);
780 }
781<RulesRoundSquare>"]" {
783 BEGIN(RulesRound) ;
784 }
785<RulesSquare,RulesRoundSquare>"\\\\" {
787 }
788<RulesSquare,RulesRoundSquare>. {
790 }
791<RulesPattern>{StartRoundQuest} {
793 yyextra->lastContext = YY_START;
794 BEGIN(RulesRoundQuest);
795 }
796<RulesRoundQuest>{nl} {
798 }
799<RulesRoundQuest>[^)] {
801 }
802<RulesRoundQuest>")" {
804 BEGIN(yyextra->lastContext);
805 }
806<RulesPattern>{StartRound} {
807 yyextra->roundCount++;
809 yyextra->lastContext = YY_START;
810 BEGIN(RulesRound);
811 }
812<RulesRound>{RulesCurly} {
814 }
815<RulesRound>{StartSquare} {
817 BEGIN(RulesRoundSquare);
818 }
819<RulesRound>{StartDouble} {
821 BEGIN(RulesRoundDouble);
822 }
823<RulesRound>{EscapeRulesChar} {
825 }
826<RulesRound>"(" {
827 yyextra->roundCount++;
829 }
830<RulesRound>")" {
831 yyextra->roundCount--;
833 if (!yyextra->roundCount) BEGIN( yyextra->lastContext ) ;
834 }
835<RulesRound>{nl} {
837 }
838<RulesRound>{B} {
840 }
841<RulesRound>. {
843 }
844<RulesPattern>{B} {
846 BEGIN(CopyLine);
847 }
848<RulesPattern>. {
850 }
851
852<CopyLine,LexCopyLine>{ID} {
854 if ((yyextra->includeStack.empty() || yyextra->curlyCount>0) &&
855 yyextra->macroExpansion &&
859 )
860 {
865 }
866 else
867 {
869 }
870 }
871<CopyLine,LexCopyLine>"\\"\r?/\n { // strip line continuation characters
873 }
874<CopyLine,LexCopyLine>\\. {
876 }
877<CopyLine,LexCopyLine>. {
879 }
880<CopyLine,LexCopyLine>\n {
882 BEGIN(Start);
883 yyextra->yyLineNr++;
884 yyextra->yyColNr=1;
885 }
886<FindDefineArgs>"(" {
887 yyextra->defArgsStr+='(';
888 yyextra->roundCount++;
889 }
890<FindDefineArgs>")" {
891 yyextra->defArgsStr+=')';
892 yyextra->roundCount--;
893 if (yyextra->roundCount==0)
894 {
896
897 if (yyextra->findDefArgContext==CopyLine)
898 {
900 BEGIN(yyextra->findDefArgContext);
901 }
902 else
903 {
905 yyextra->nospaces=
FALSE;
906 BEGIN(Start);
907 }
908 }
909 }
910
static void readIncludeFile(yyscan_t yyscanner, const QCString &inc)
911<FindDefineArgs>")"{B}*"(" {
912 yyextra->defArgsStr+=yytext;
913 }
914 */
915<FindDefineArgs>{CHARLIT} {
916 yyextra->defArgsStr+=yytext;
917 }
918<FindDefineArgs>{CCS}[*!]? {
919 yyextra->defArgsStr+=yytext;
920 BEGIN(ArgCopyCComment);
921 }
922<FindDefineArgs>{CPPC}[/!].*\n/{B}*{CPPC}[/!] { // replace multi line C++ style comment by C style comment
924 {
925 if (yytext[3]=='<')
926 {
927 yyextra->defArgsStr+=
QCString(
"/**< @brief ")+&yytext[4];
928 }
929 else
930 {
931 yyextra->defArgsStr+=
QCString(
"/** @brief ")+&yytext[3];
932 }
933 }
934 else
935 {
936 yyextra->defArgsStr+=
QCString(
"/**")+&yytext[3];
937 }
938 BEGIN(ArgCopyCppComment);
939 }
940<FindDefineArgs>{CPPC}[/!].*\n { // replace C++ single line style comment by C style comment
942 {
943 yyextra->defArgsStr+=
QCString(
"/**")+&yytext[3]+
" */";
944 }
945 else
946 {
947 if (yytext[3]=='<')
948 {
949 yyextra->defArgsStr+=
QCString(
"/**< @brief ")+&yytext[4]+
" */";
950 }
951 else
952 {
953 yyextra->defArgsStr+=
QCString(
"/** @brief ")+&yytext[3]+
" */";
954 }
955 }
956 }
957<FindDefineArgs>{CPPC}.*\n { // replace C++ single line style comment by C style comment
958 yyextra->defArgsStr+=
QCString(
"/*")+&yytext[2]+
" */";
959 }
960<FindDefineArgs>\" {
961 yyextra->defArgsStr+=*yytext;
962 BEGIN(ReadString);
963 }
964<FindDefineArgs>' {
966 yyextra->defArgsStr+=*yytext;
967 BEGIN(ReadString);
968 }
969<FindDefineArgs>\n {
970 yyextra->defArgsStr+=' ';
971 yyextra->yyLineNr++;
973 }
974<FindDefineArgs>"@" {
975 yyextra->defArgsStr+="@@";
976 }
977<FindDefineArgs>. {
978 yyextra->defArgsStr+=*yytext;
979 }
980<ArgCopyCComment>[^*\n]+ {
981 yyextra->defArgsStr+=yytext;
982 }
983<ArgCopyCComment>{CCE} {
984 yyextra->defArgsStr+=yytext;
985 BEGIN(FindDefineArgs);
986 }
987<ArgCopyCComment>\n {
988 yyextra->defArgsStr+=yytext;
989 yyextra->yyLineNr++;
990 }
991<ArgCopyCComment>. {
992 yyextra->defArgsStr+=yytext;
993 }
994<ArgCopyCppComment>^{B}*
995<ArgCopyCppComment>{CPPC}[/!].*\n/{B}*{CPPC}[/!] { // replace multi line C++ style comment by C style comment
996 const char *startContent = &yytext[3];
997 if (startContent[0]=='<') startContent++;
998 yyextra->defArgsStr+=startContent;
999 }
1000<ArgCopyCppComment>{CPPC}[/!].*\n { // replace C++ multie line style comment by C style comment
1001 const char *startContent = &yytext[3];
1002 if (startContent[0]=='<') startContent++;
1003 yyextra->defArgsStr+=
QCString(startContent)+
" */";
1004 BEGIN(FindDefineArgs);
1005 }
1006<ArgCopyCppComment>. { // unexpected character
1007 unput(*yytext);
1008 yyextra->defArgsStr+=" */";
1009 BEGIN(FindDefineArgs);
1010 }
1011<ReadString>"\"" {
1012 yyextra->defArgsStr+=*yytext;
1013 BEGIN(FindDefineArgs);
1014 }
1015<ReadString>"'" {
1017 yyextra->defArgsStr+=*yytext;
1018 BEGIN(FindDefineArgs);
1019 }
1020
1021<ReadString>{CPPC}|{CCS} {
1022 yyextra->defArgsStr+=yytext;
1023 }
1024<ReadString>\\/\r?\n { // line continuation
1025 }
1026<ReadString>\\. {
1027 yyextra->defArgsStr+=yytext;
1028 }
1029<ReadString>. {
1030 yyextra->defArgsStr+=*yytext;
1031 }
1032<Command>("include"|"import"){B}+/{ID} {
1033 yyextra->isImported = yytext[1]=='m';
1034 if (yyextra->macroExpansion)
1035 BEGIN(IncludeID);
1036 }
1037<Command>("include"|"import"){B}*[<"] {
1038 yyextra->isImported = yytext[1]=='m';
1039 char c[2];
1040 c[0]=yytext[yyleng-1];c[1]='\0';
1041 yyextra->incName=c;
1042 BEGIN(Include);
1043 }
1044<Command>("cmake")?"define"{B}+ {
1045 yyextra->potentialDefine +=
substitute(yytext,
"cmake",
" ");
1046
1047 yyextra->yyColNr+=(int)yyleng;
1048 BEGIN(DefName);
1049 }
QCString substitute(const QCString &s, const QCString &src, const QCString &dst)
substitute all occurrences of src in s by dst
1050<Command>"cmakedefine01"{B}+ {
1051 yyextra->potentialDefine +=
substitute(yytext,
"cmakedefine01",
" define ");
1052
1053 yyextra->yyColNr+=(int)yyleng;
1054 BEGIN(CmakeDefName01);
1055 }
1056<Command>"ifdef"/{B}*"(" {
1058 yyextra->guardExpr.clear();
1059 BEGIN(DefinedExpr2);
1060 }
static void incrLevel(yyscan_t yyscanner)
1061<Command>"ifdef"/{B}+ {
1062
1064 yyextra->guardExpr.clear();
1065 BEGIN(DefinedExpr1);
1066 }
1067<Command>"ifndef"/{B}*"(" {
1069 yyextra->guardExpr="! ";
1070 BEGIN(DefinedExpr2);
1071 }
1072<Command>"ifndef"/{B}+ {
1074 yyextra->guardExpr="! ";
1075 BEGIN(DefinedExpr1);
1076 }
1077<Command>"if"/[ \t(!] {
1079 yyextra->guardExpr.clear();
1080 BEGIN(Guard);
1081 }
1082<Command>("elif"|"else"{B}*"if")/[ \t(!] {
1084 {
1085 yyextra->guardExpr.clear();
1086 BEGIN(Guard);
1087 }
1088 else
1089 {
1090 yyextra->ifcount=0;
1091 BEGIN(SkipCPPBlock);
1092 }
1093 }
static bool otherCaseDone(yyscan_t yyscanner)
1094<Command>"else"/[^a-z_A-Z0-9\x80-\xFF] {
1096 {
1097 yyextra->ifcount=0;
1098 BEGIN(SkipCPPBlock);
1099 }
1100 else
1101 {
1103 }
1104 }
static void setCaseDone(yyscan_t yyscanner, bool value)
1105<Command>"undef"{B}+ {
1106 BEGIN(UndefName);
1107 }
1108<Command>("elif"|"else"{B}*"if")/[ \t(!] {
1110 {
1111 yyextra->guardExpr.clear();
1112 BEGIN(Guard);
1113 }
1114 }
1115<Command>"endif"/[^a-z_A-Z0-9\x80-\xFF] {
1116
1118 }
static void decrLevel(yyscan_t yyscanner)
1119<Command,IgnoreLine>\n {
1121 BEGIN(Start);
1122 yyextra->yyLineNr++;
1123 }
1124<Command>"pragma"{B}+"once" {
1125 yyextra->expectGuard =
FALSE;
1126 if (yyextra->pragmaSet.find(yyextra->fileName.str())!=yyextra->pragmaSet.end())
1127 {
1129 BEGIN(PragmaOnce);
1130 }
1131 else
1132 {
1133 yyextra->pragmaSet.insert(yyextra->fileName.data());
1134 }
1135 }
1136<PragmaOnce>. {}
1137<PragmaOnce>\n {}
1138<PragmaOnce><<EOF>> {
1139 yyextra->expectGuard =
FALSE;
1140 BEGIN(Start);
1141 }
1142<Command>{ID} { // unknown directive
1143 BEGIN(IgnoreLine);
1144 }
1145<IgnoreLine>\\[\r]?\n {
1147 yyextra->yyLineNr++;
1148 }
1149<IgnoreLine>.
1150<Command>. { yyextra->potentialDefine += yytext[0]=='\t' ? '\t' : ' ';
1151 yyextra->yyColNr+=(int)yyleng;
1152 }
1153<UndefName>{ID} {
1156
1158 )
1159 {
1160
1162 }
1163 BEGIN(Start);
1164 }
1165<Guard>\\[\r]?\n {
1167 yyextra->guardExpr+=' ';
1168 yyextra->yyLineNr++;
1169 }
1170<Guard>"defined"/{B}*"(" {
1171 BEGIN(DefinedExpr2);
1172 }
1173<Guard>"defined"/{B}+ {
1174 BEGIN(DefinedExpr1);
1175 }
1176<Guard>"true"/{B}|{B}*[\r]?\n { yyextra->guardExpr+="1L"; }
1177<Guard>"false"/{B}|{B}*[\r]?\n { yyextra->guardExpr+="0L"; }
1178<Guard>"not"/{B} { yyextra->guardExpr+='!'; }
1179<Guard>"not_eq"/{B} { yyextra->guardExpr+="!="; }
1180<Guard>"and"/{B} { yyextra->guardExpr+="&&"; }
1181<Guard>"or"/{B} { yyextra->guardExpr+="||"; }
1182<Guard>"bitand"/{B} { yyextra->guardExpr+="&"; }
1183<Guard>"bitor"/{B} { yyextra->guardExpr+="|"; }
1184<Guard>"xor"/{B} { yyextra->guardExpr+="^"; }
1185<Guard>"compl"/{B} { yyextra->guardExpr+="~"; }
1186<Guard>{ID} { yyextra->guardExpr+=yytext; }
1187<Guard>"@" { yyextra->guardExpr+="@@"; }
1188<Guard>. { yyextra->guardExpr+=*yytext; }
1189<Guard>\n {
1190 unput(*yytext);
1191
1192
1195 if (guard)
1196 {
1197 BEGIN(Start);
1198 }
1199 else
1200 {
1201 yyextra->ifcount=0;
1202 BEGIN(SkipCPPBlock);
1203 }
1204 }
static bool computeExpression(yyscan_t yyscanner, const QCString &expr)
1205<DefinedExpr1,DefinedExpr2>\\\n { yyextra->yyLineNr++; outputChar(yyscanner,'\n'); }
1206<DefinedExpr1>{ID} {
1207 if (
isDefined(yyscanner,yytext) || yyextra->guardName==yytext)
1208 yyextra->guardExpr+=" 1L ";
1209 else
1210 yyextra->guardExpr+=" 0L ";
1211 yyextra->lastGuardName=yytext;
1212 BEGIN(Guard);
1213 }
1214<DefinedExpr2>{ID} {
1215 if (
isDefined(yyscanner,yytext) || yyextra->guardName==yytext)
1216 yyextra->guardExpr+=" 1L ";
1217 else
1218 yyextra->guardExpr+=" 0L ";
1219 yyextra->lastGuardName=yytext;
1220 }
1221<DefinedExpr1,DefinedExpr2>\n { // should not happen, handle anyway
1222 yyextra->yyLineNr++;
1223 yyextra->ifcount=0;
1224 BEGIN(SkipCPPBlock);
1225 }
1226<DefinedExpr2>")" {
1227 BEGIN(Guard);
1228 }
1229<DefinedExpr1,DefinedExpr2>.
1230<SkipCPPBlock>^{B}*"#" { BEGIN(SkipCommand); }
1231<SkipCPPBlock>^{Bopt}/[^#] { BEGIN(SkipLine); }
1232<SkipCPPBlock>\n { yyextra->yyLineNr++; outputChar(yyscanner,'\n'); }
1233<SkipCPPBlock>.
1234<SkipCommand>"if"(("n")?("def"))?/[ \t(!] {
1236 yyextra->ifcount++;
1237
1238 }
1239<SkipCommand>"else" {
1240
1242 {
1244
1245 BEGIN(Start);
1246 }
1247 }
1248<SkipCommand>("elif"|"else"{B}*"if")/[ \t(!] {
1249 if (yyextra->ifcount==0)
1250 {
1252 {
1253 yyextra->guardExpr.clear();
1254 yyextra->lastGuardName.clear();
1255 BEGIN(Guard);
1256 }
1257 else
1258 {
1259 BEGIN(SkipCPPBlock);
1260 }
1261 }
1262 }
1263<SkipCommand>"endif" {
1264 yyextra->expectGuard =
FALSE;
1266 if (--yyextra->ifcount<0)
1267 {
1268
1269 BEGIN(Start);
1270 }
1271 }
1272<SkipCommand>\n {
1274 yyextra->yyLineNr++;
1275 BEGIN(SkipCPPBlock);
1276 }
1277<SkipCommand>{ID} { // unknown directive
1278 BEGIN(SkipLine);
1279 }
1280<SkipCommand>.
1281<SkipLine>[^'"/\n]+
1282<SkipLine>{CHARLIT} { }
1283<SkipLine>\" {
1284 BEGIN(SkipString);
1285 }
1286<SkipLine>.
1287<SkipString>{CPPC}/[^\n]* {
1288 }
1289<SkipLine,SkipCommand,SkipCPPBlock>{CPPC}[^\n]* {
1290 yyextra->lastCPPContext=YY_START;
1291 BEGIN(RemoveCPPComment);
1292 }
1293<SkipString>{CCS}/[^\n]* {
1294 }
1295<SkipLine,SkipCommand,SkipCPPBlock>{CCS}/[^\n]* {
1296 yyextra->lastCContext=YY_START;
1297 BEGIN(RemoveCComment);
1298 }
1299<SkipLine>\n {
1301 yyextra->yyLineNr++;
1302 BEGIN(SkipCPPBlock);
1303 }
1304<SkipString>[^"\\\n]+ { }
1305<SkipString>\\. { }
1306<SkipString>\" {
1307 BEGIN(SkipLine);
1308 }
1309<SkipString>. { }
1310<IncludeID>{ID}{Bopt}/"(" {
1311 yyextra->nospaces=
TRUE;
1312 yyextra->roundCount=0;
1313 yyextra->defArgsStr=yytext;
1314 yyextra->findDefArgContext = IncludeID;
1315 BEGIN(FindDefineArgs);
1316 }
1317<IncludeID>{ID} {
1318 yyextra->nospaces=
TRUE;
1320 BEGIN(Start);
1321 }
1322<Include>[^\">\n]+[\">] {
1323 yyextra->incName+=yytext;
1324 if (yyextra->isImported)
1325 {
1326 BEGIN(EndImport);
1327 }
1328 else
1329 {
1331 BEGIN(Start);
1332 }
1333 }
1334<EndImport>{ENDIMPORTopt}/\n {
1336 BEGIN(Start);
1337 }
1338<EndImport>\\[\r]?"\n" {
1340 yyextra->yyLineNr++;
1341 }
1342<EndImport>. {
1343 }
1344<DefName>{ID}/("\\\n")*"(" { // define with argument
1345
1346 yyextra->argMap.clear();
1347 yyextra->defArgs = 0;
1348 yyextra->defArgsStr.clear();
1349 yyextra->defText.clear();
1350 yyextra->defLitText.clear();
1351 yyextra->defName = yytext;
1352 yyextra->defVarArgs =
FALSE;
1353 yyextra->defExtraSpacing.clear();
1354 yyextra->defContinue = false;
1355 BEGIN(DefineArg);
1356 }
1357<DefName>{ID}{B}+"1"/[ \r\t\n] { // special case: define with 1 -> can be "guard"
1358
1359 yyextra->argMap.clear();
1360 yyextra->defArgs = -1;
1361 yyextra->defArgsStr.clear();
1363 yyextra->defVarArgs =
FALSE;
1364
1365
1366 if (yyextra->curlyCount>0 || yyextra->defName!=yyextra->lastGuardName || !yyextra->expectGuard)
1367 {
1368 QCString def = yyextra->potentialDefine +
1369 yyextra->defName ;
1371 outputSpaces(yyscanner,yytext+yyextra->defName.length());
1372 yyextra->quoteArg=
FALSE;
1373 yyextra->insideComment=
FALSE;
1374 yyextra->lastGuardName.clear();
1375 yyextra->defText="1";
1376 yyextra->defLitText="1";
1377 BEGIN(DefineText);
1378 }
1379 else
1380 {
1381
1382 yyextra->defText.clear();
1383 yyextra->defLitText.clear();
1384 BEGIN(Start);
1385 }
1386 yyextra->expectGuard=
FALSE;
1387 }
static void outputSpaces(yyscan_t yyscanner, char *s)
1388<DefName,CmakeDefName01>{ID}/{B}*"\n" { // empty define
1389 yyextra->argMap.clear();
1390 yyextra->defArgs = -1;
1391 yyextra->defName = yytext;
1392 yyextra->defArgsStr.clear();
1393 yyextra->defText.clear();
1394 yyextra->defLitText.clear();
1395 yyextra->defVarArgs =
FALSE;
1396
1397
1398 if (yyextra->curlyCount>0 || yyextra->defName!=yyextra->lastGuardName || !yyextra->expectGuard)
1399 {
1400 QCString def = yyextra->potentialDefine + yyextra->defName;
1402 yyextra->quoteArg=
FALSE;
1403 yyextra->insideComment=
FALSE;
1404 if (YY_START == CmakeDefName01) yyextra->defText = "0";
1405 else if (yyextra->insideCS) yyextra->defText="1";
1406 BEGIN(DefineText);
1407 }
1408 else
1409 {
1410
1411 yyextra->guardName = yytext;
1412 yyextra->lastGuardName.clear();
1413 BEGIN(Start);
1414 }
1415 yyextra->expectGuard=
FALSE;
1416 }
1417<DefName>{ID}/{B}* { // define with content
1418
1419 yyextra->argMap.clear();
1420 yyextra->defArgs = -1;
1421 yyextra->defArgsStr.clear();
1422 yyextra->defText.clear();
1423 yyextra->defLitText.clear();
1424 yyextra->defName = yytext;
1425 yyextra->defVarArgs =
FALSE;
1426 QCString def = yyextra->potentialDefine +
1427 yyextra->defName +
1428 yyextra->defArgsStr ;
1430 yyextra->quoteArg=
FALSE;
1431 yyextra->insideComment=
FALSE;
1432 BEGIN(DefineText);
1433 }
1434<DefineArg>"\\\n" {
1435 yyextra->defExtraSpacing+="\n";
1436 yyextra->defContinue = true;
1437 yyextra->yyLineNr++;
1438 }
1439<DefineArg>{B}* { yyextra->defExtraSpacing+=yytext; }
1440<DefineArg>","{B}* { yyextra->defArgsStr+=yytext; }
1441<DefineArg>"("{B}* { yyextra->defArgsStr+=yytext; }
1442<DefineArg>{B}*")"{B}* {
1444 yyextra->defArgsStr+=yytext;
1445 QCString def = yyextra->potentialDefine +
1446 yyextra->defName +
1447 yyextra->defArgsStr +
1448 yyextra->defExtraSpacing ;
1450 yyextra->quoteArg=
FALSE;
1451 yyextra->insideComment=
FALSE;
1452 BEGIN(DefineText);
1453 }
static void extraSpacing(yyscan_t yyscanner)
1454<DefineArg>"..." { // Variadic macro
1455 yyextra->defVarArgs =
TRUE;
1456 yyextra->defArgsStr+=yytext;
1457 yyextra->argMap.emplace(std::string("__VA_ARGS__"),yyextra->defArgs);
1458 yyextra->defArgs++;
1459 }
1460<DefineArg>{ID}{B}*("..."?) {
1461
1463 yyextra->defVarArgs = yytext[yyleng-1]=='.';
1464 if (yyextra->defVarArgs)
1465 {
1467 }
1469 yyextra->defArgsStr+=yytext;
1470 yyextra->argMap.emplace(
toStdString(argName),yyextra->defArgs);
1471 yyextra->defArgs++;
1473 }
1474
1475<DefineText>"/ **"|"/ *!" {
1476 yyextra->defText+=yytext;
1477 yyextra->defLitText+=yytext;
1478 yyextra->insideComment=
TRUE;
1479 }
1480<DefineText>"* /" {
1481 yyextra->defText+=yytext;
1482 yyextra->defLitText+=yytext;
1483 yyextra->insideComment=
FALSE;
1484 }
1485 */
1486<DefineText>{CCS}[!*]? {
1487 yyextra->defText+=yytext;
1488 yyextra->defLitText+=yytext;
1489 yyextra->lastCContext=YY_START;
1490 yyextra->commentCount=1;
1491 BEGIN(CopyCComment);
1492 }
1493<DefineText>{CPPC}[!/]? {
1495 yyextra->lastCPPContext=YY_START;
1496 yyextra->defLitText+=' ';
1497 BEGIN(SkipCPPComment);
1498 }
1499<SkipCComment>[/]?{CCE} {
1500 if (yytext[0]==
'/')
outputChar(yyscanner,
'/');
1502 if (--yyextra->commentCount<=0)
1503 {
1504 if (yyextra->lastCContext==Start)
1505
1506
1507 {
1508 YY_CURRENT_BUFFER->yy_at_bol=1;
1509 }
1510 BEGIN(yyextra->lastCContext);
1511 }
1512 }
1513<SkipCComment>{CPPC}("/")* {
1515 }
1516<SkipCComment>{CCS} {
1518
1519 }
1520<SkipCond>{CMD}{CMD} { }
1521<SkipCond>^({B}*"*"+)?{B}{0,3}"~~~"[~]* {
1523 if (!markdownSupport || !yyextra->isSpecialComment)
1524 {
1525 REJECT;
1526 }
1527 else
1528 {
1529 yyextra->fenceChar='~';
1531 BEGIN(SkipCondVerbatim);
1532 }
1533 }
static yy_size_t getFenceSize(char *txt, yy_size_t leng)
1534<SkipCond>^({B}*"*"+)?{B}{0,3}"```"[`]* {
1536 if (!markdownSupport || !yyextra->isSpecialComment)
1537 {
1538 REJECT;
1539 }
1540 else
1541 {
1542 yyextra->fenceChar='`';
1544 BEGIN(SkipCondVerbatim);
1545 }
1546 }
1547<SkipCComment>^({B}*"*"+)?{B}{0,3}"~~~"[~]* {
1549 if (!markdownSupport || !yyextra->isSpecialComment)
1550 {
1551 REJECT;
1552 }
1553 else
1554 {
1556 yyextra->fenceChar='~';
1558 BEGIN(SkipVerbatim);
1559 }
1560 }
1561<SkipCComment>^({B}*"*"+)?{B}{0,3}"```"[`]* {
1563 if (!markdownSupport || !yyextra->isSpecialComment)
1564 {
1565 REJECT;
1566 }
1567 else
1568 {
1570 yyextra->fenceChar='`';
1572 BEGIN(SkipVerbatim);
1573 }
1574 }
1575<SkipCComment>{CMD}{VERBATIM_LINE} |
1576<SkipCComment>{CMD}{LITERAL_BLOCK} { // escaped command
1579 }
1580<SkipCComment>{VERBATIM_LINE}.*/\n { // normal command
1582 }
1583<SkipCComment>{LITERAL_BLOCK} { // normal block command
1586 if (yyextra->isSpecialComment)
1587 {
1589 BEGIN(SkipVerbatim);
1590 }
1591 }
static void determineBlockName(yyscan_t yyscanner)
1592<SkipCond>{CMD}{CMD}"cond"[ \t]+ {}// escaped cond command
1593<SkipCond>{CMD}"cond"/\n |
1594<SkipCond>{CMD}"cond"[ \t]+ { // cond command in a skipped cond section, this section has to be skipped as well
1595
1597 }
static void startCondSection(yyscan_t yyscanner, const QCString §Id)
1598<SkipCComment>"{"[ \t]*"@code"/[ \t\n] {
1600 yyextra->javaBlock=1;
1601 BEGIN(JavaDocVerbatimCode);
1602 }
1603<SkipCComment>"{"[ \t]*"@literal"/[ \t\n] {
1605 yyextra->javaBlock=1;
1606 BEGIN(JavaDocVerbatimCode);
1607 }
1608<SkipCComment,SkipCPPComment>{CMD}{CMD}"cond"[ \t\n]+ { // escaped cond command
1610 }
1611<SkipCPPComment>{CMD}"cond"[ \t]+ { // conditional section
1612 yyextra->ccomment=
TRUE;
1613 yyextra->condCtx=YY_START;
1614 BEGIN(CondLineCpp);
1615 }
1616<SkipCComment>{CMD}"cond"[ \t]+ { // conditional section
1617 yyextra->ccomment=
FALSE;
1618 yyextra->condCtx=YY_START;
1619 BEGIN(CondLineC);
1620 }
1621<CondLineC,CondLineCpp>[!()&| \ta-z_A-Z0-9\x80-\xFF.\-]+ {
1623 if (yyextra->skip)
1624 {
1625 if (YY_START==CondLineC)
1626 {
1627
1629 yyextra->ccomment=
TRUE;
1630 }
1631 else
1632 {
1633 yyextra->ccomment=
FALSE;
1634 }
1635 BEGIN(SkipCond);
1636 }
1637 else
1638 {
1639 BEGIN(yyextra->condCtx);
1640 }
1641 }
1642<CondLineC,CondLineCpp>. { // non-guard character
1643 unput(*yytext);
1645 if (yyextra->skip)
1646 {
1647 if (YY_START==CondLineC)
1648 {
1649
1651 yyextra->ccomment=
TRUE;
1652 }
1653 else
1654 {
1655 yyextra->ccomment=
FALSE;
1656 }
1657 BEGIN(SkipCond);
1658 }
1659 else
1660 {
1661 BEGIN(yyextra->condCtx);
1662 }
1663 }
1664<SkipCComment,SkipCPPComment>{CMD}"cond"{WSopt}/\n { // no guard
1665 if (YY_START==SkipCComment)
1666 {
1667 yyextra->ccomment=
TRUE;
1668
1670 }
1671 else
1672 {
1673 yyextra->ccomment=
FALSE;
1674 }
1675 yyextra->condCtx=YY_START;
1677 BEGIN(SkipCond);
1678 }
1679<SkipCond>\n { yyextra->yyLineNr++; outputChar(yyscanner,'\n'); }
1680<SkipCond>{VERBATIM_LINE}.*/\n { }
1681<SkipCond>{LITERAL_BLOCK} {
1683 yyextra->yyLineNr+=numNLs;
1684 for (
int i = 0; i < numNLs; i++)
outputChar(yyscanner,
'\n');
1686 BEGIN(SkipCondVerbatim);
1687 }
1688
1689<SkipCond>. { }
1690<SkipCond>[^\/\!*\\@\n]+ { }
1691<SkipCond>{CPPC}[/!] { yyextra->ccomment=FALSE; }
1692<SkipCond>{CCS}[*!] { yyextra->ccomment=TRUE; }
1693<SkipCond,SkipCComment,SkipCPPComment>{CMD}{CMD}"endcond"/[^a-z_A-Z0-9\x80-\xFF] {
1694 if (!yyextra->skip)
1695 {
1697 }
1698 }
1699<SkipCond>{CMD}"endcond"/[^a-z_A-Z0-9\x80-\xFF] {
1700 bool oldSkip = yyextra->skip;
1702 if (oldSkip && !yyextra->skip)
1703 {
1704 if (yyextra->ccomment)
1705 {
1707 }
1708 BEGIN(yyextra->condCtx);
1709 }
1710 }
static void endCondSection(yyscan_t yyscanner)
1711<SkipCComment,SkipCPPComment>{CMD}"endcond"/[^a-z_A-Z0-9\x80-\xFF] {
1712 bool oldSkip = yyextra->skip;
1714 if (oldSkip && !yyextra->skip)
1715 {
1716 BEGIN(yyextra->condCtx);
1717 }
1718 }
1719<SkipCondVerbatim>{LITERAL_BLOCK_END} { /* end of verbatim block */
1720 if (yytext[1]=='f' && yyextra->blockName==&yytext[2])
1721 {
1722 BEGIN(SkipCond);
1723 }
1724 else if (&yytext[4]==yyextra->blockName)
1725 {
1726 BEGIN(SkipCond);
1727 }
1728 }
1729<SkipVerbatim>{LITERAL_BLOCK_END} { /* end of verbatim block */
1731 if (yytext[1]=='f' && yyextra->blockName==&yytext[2])
1732 {
1733 BEGIN(SkipCComment);
1734 }
1735 else if (&yytext[4]==yyextra->blockName)
1736 {
1737 BEGIN(SkipCComment);
1738 }
1739 }
1740<SkipCondVerbatim>^({B}*"*"+)?{B}{0,3}"~~~"[~]* {
1741 if (yyextra->fenceSize==
getFenceSize(yytext,yyleng) && yyextra->fenceChar==
'~')
1742 {
1743 BEGIN(SkipCond);
1744 }
1745 }
1746<SkipCondVerbatim>^({B}*"*"+)?{B}{0,3}"```"[`]* {
1747 if (yyextra->fenceSize==
getFenceSize(yytext,yyleng) && yyextra->fenceChar==
'`')
1748 {
1749 BEGIN(SkipCond);
1750 }
1751 }
1752<SkipVerbatim>^({B}*"*"+)?{B}{0,3}"~~~"[~]* {
1754 if (yyextra->fenceSize==
getFenceSize(yytext,yyleng) && yyextra->fenceChar==
'~')
1755 {
1756 BEGIN(SkipCComment);
1757 }
1758 }
1759<SkipVerbatim>^({B}*"*"+)?{B}{0,3}"```"[`]* {
1761 if (yyextra->fenceSize==
getFenceSize(yytext,yyleng) && yyextra->fenceChar==
'`')
1762 {
1763 BEGIN(SkipCComment);
1764 }
1765 }
1766<SkipCondVerbatim>{CCE}|{CCS} { }
1767<SkipVerbatim>{CCE}|{CCS} {
1769 }
1770<JavaDocVerbatimCode>"{" {
1771 if (yyextra->javaBlock==0)
1772 {
1773 REJECT;
1774 }
1775 else
1776 {
1777 yyextra->javaBlock++;
1779 }
1780 }
1781<JavaDocVerbatimCode>"}" {
1782 if (yyextra->javaBlock==0)
1783 {
1784 REJECT;
1785 }
1786 else
1787 {
1788 yyextra->javaBlock--;
1789 if (yyextra->javaBlock==0)
1790 {
1792 BEGIN(SkipCComment);
1793 }
1794 else
1795 {
1797 }
1798 }
1799 }
1800<JavaDocVerbatimCode>\n { /* new line in verbatim block */
1802 }
1803<JavaDocVerbatimCode>. { /* any other character */
1805 }
1806<SkipCondVerbatim>[^{*\\@\x06~`\n\/]+ { }
1807<SkipCComment,SkipVerbatim>[^{*\\@\x06~`\n\/]+ {
1809 }
1810<SkipCComment,SkipVerbatim,SkipCondVerbatim>\n {
1811 yyextra->yyLineNr++;
1813 }
1814<SkipCondVerbatim>. { }
1815<SkipCComment,SkipVerbatim>. {
1817 }
1818<CopyCComment>[^*a-z_A-Z\x80-\xFF\n]*[^*a-z_A-Z\x80-\xFF\\\n] {
1819 yyextra->defLitText+=yytext;
1820 yyextra->defText+=
escapeAt(yytext);
1821 }
static QCString escapeAt(const QCString &text)
1822<CopyCComment>\\[\r]?\n {
1823 yyextra->defLitText+=yytext;
1824 yyextra->defText+=" ";
1825 yyextra->yyLineNr++;
1826 yyextra->yyMLines++;
1827 }
1828<CopyCComment>{CCE} {
1829 yyextra->defLitText+=yytext;
1830 yyextra->defText+=yytext;
1831 BEGIN(yyextra->lastCContext);
1832 }
1833<CopyCComment>\n {
1834 yyextra->yyLineNr++;
1835 yyextra->defLitText+=yytext;
1836 yyextra->defText+=' ';
1837 }
1838<RemoveCComment>{CCE}{B}*"#" { // see bug 594021 for a usecase for this rule
1839 if (yyextra->lastCContext==SkipCPPBlock)
1840 {
1841 BEGIN(SkipCommand);
1842 }
1843 else
1844 {
1845 REJECT;
1846 }
1847 }
1848<RemoveCComment>{CCE} { BEGIN(yyextra->lastCContext); }
1849<RemoveCComment>{CPPC}
1850<RemoveCComment>{CCS}
1851<RemoveCComment>[^*\x06\n]+
1852<RemoveCComment>\n { yyextra->yyLineNr++; outputChar(yyscanner,'\n'); }
1853<RemoveCComment>.
1854<SkipCPPComment>[^\n\/\\@]+ {
1856 }
1857<SkipCPPComment,RemoveCPPComment>\n {
1858 unput(*yytext);
1859 BEGIN(yyextra->lastCPPContext);
1860 }
1861<SkipCPPComment>{CCS} {
1863 }
1864<SkipCPPComment>{CPPC} {
1866 }
1867<SkipCPPComment>[^\x06\@\\\n]+ {
1869 }
1870<SkipCPPComment>. {
1872 }
1873<RemoveCPPComment>{CCS}
1874<RemoveCPPComment>{CPPC}
1875<RemoveCPPComment>[^\x06\n]+
1876<RemoveCPPComment>.
1877<DefineText>"__VA_OPT__("{B}*"##" {
1878 warn(yyextra->fileName,yyextra->yyLineNr,
1879 "'##' may not appear at the beginning of a __VA_OPT__()",
1880 yyextra->defName,yyextra->defLitText.stripWhiteSpace());
1881 yyextra->defText+="__VA_OPT__(";
1882 yyextra->defLitText+="__VA_OPT__(";
1883 }
1884<DefineText>"#"/"__VA_OPT__" {
1885 yyextra->defText+=yytext;
1886 yyextra->defLitText+=yytext;
1887 }
1888<DefineText>"#"/{IDSTART} {
1890 yyextra->quoteArg=
TRUE;
1891 yyextra->idStart=true;
1892 yyextra->defLitText+=yytext;
1893 }
1894<DefineText,CopyCComment>{ID} {
1895 yyextra->defLitText+=yytext;
1896 if (YY_START == DefineText)
outputSpaces(yyscanner,yytext);
1897 if (yyextra->quoteArg)
1898 {
1899 yyextra->defText+="\"";
1900 }
1901 if (yyextra->defArgs>0)
1902 {
1903 auto it = yyextra->argMap.find(yytext);
1904 if (it!=yyextra->argMap.end())
1905 {
1906 int n = it->second;
1907 yyextra->defText+='@';
1909 }
1910 else
1911 {
1912 if (yyextra->idStart)
1913 {
1914 warn(yyextra->fileName,yyextra->yyLineNr,
1915 "'#' is not followed by a macro parameter '{}': '{}'",
1916 yyextra->defName,yyextra->defLitText.stripWhiteSpace());
1917 }
1918 yyextra->defText+=yytext;
1919 }
1920 }
1921 else
1922 {
1923 yyextra->defText+=yytext;
1924 }
1925 if (yyextra->quoteArg)
1926 {
1927 yyextra->defText+="\"";
1928 }
1929 yyextra->quoteArg=
FALSE;
1930 yyextra->idStart=false;
1931 }
1932<CopyCComment>. {
1933 yyextra->defLitText+=yytext;
1934 yyextra->defText+=yytext;
1935 }
1936<DefineText>\\[\r]?\n {
1937 yyextra->defLitText+=yytext;
1940 yyextra->defText += ' ';
1941 yyextra->yyLineNr++;
1942 yyextra->yyMLines++;
1943 }
1944<DefineText>\n {
1946 yyextra->defText = yyextra->defText.stripWhiteSpace();
1947 if (yyextra->defText.startsWith("##"))
1948 {
1949 warn(yyextra->fileName,yyextra->yyLineNr,
1950 "'##' cannot occur at the beginning of a macro definition '{}': '{}'",
1951 yyextra->defName,yyextra->defLitText.stripWhiteSpace());
1952 }
1953 else if (yyextra->defText.endsWith("##"))
1954 {
1955 warn(yyextra->fileName,yyextra->yyLineNr,
1956 "'##' cannot occur at the end of a macro definition '{}': '{}'",
1957 yyextra->defName,yyextra->defLitText.stripWhiteSpace());
1958 }
1959 else if (yyextra->defText.endsWith("#"))
1960 {
1961 warn(yyextra->fileName,yyextra->yyLineNr,
1962 "expected formal parameter after # in macro definition '{}': '{}'",
1963 yyextra->defName,yyextra->defLitText.stripWhiteSpace());
1964 }
1966 {
1968 yyextra->defLitText=yyextra->defLitText.left(yyextra->defLitText.length()-
comment.length()-1);
1969 }
1971 yyextra->defLitText+=yytext;
1973
1974 if (yyextra->includeStack.empty() || yyextra->curlyCount>0)
1975 {
1977 }
1978 def=
isDefined(yyscanner,yyextra->defName);
1979 if (def==0)
1980 {
1981
1983 }
1984 else if (def )
1985
1986 {
1987
1988
1990 {
1992 def->
name = yyextra->defName;
1994 def->
nargs = yyextra->defArgs;
1996 def->
lineNr = yyextra->yyLineNr-yyextra->yyMLines;
1998 }
1999 else
2000 {
2001 if (def->
fileName != yyextra->fileName && !yyextra->expandOnlyPredef)
addDefine(yyscanner);
2002
2003 }
2004 }
2005 yyextra->argMap.clear();
2006 yyextra->yyLineNr++;
2007 yyextra->yyColNr=1;
2008 yyextra->lastGuardName.clear();
2009 BEGIN(Start);
2010 }
static void addMacroDefinition(yyscan_t yyscanner)
static void addDefine(yyscan_t yyscanner)
static QCString extractTrailingComment(const QCString &s)
2011<DefineText>{B}* { outputString(yyscanner,yytext);
2012 yyextra->defText += ' ';
2013 yyextra->defLitText+=yytext;
2014 }
2015<DefineText>{B}*"##"{B}* { outputString(yyscanner,substitute(yytext,"##"," "));
2016 yyextra->defText += "##";
2017 yyextra->defLitText+=yytext;
2018 }
2019<DefineText>"@" { outputString(yyscanner,substitute(yytext,"@@"," "));
2020 yyextra->defText += "@@";
2021 yyextra->defLitText+=yytext;
2022 }
2023<DefineText>\" {
2025 yyextra->defText += *yytext;
2026 yyextra->defLitText+=yytext;
2027 if (!yyextra->insideComment)
2028 {
2029 BEGIN(SkipDoubleQuote);
2030 }
2031 }
2032<DefineText>{NUMBER} {
2034 yyextra->defText += yytext;
2035 yyextra->defLitText+=yytext;
2036 }
2037<DefineText>\' {
2039 yyextra->defText += *yytext;
2040 yyextra->defLitText+=yytext;
2041 if (!yyextra->insideComment)
2042 {
2043 BEGIN(SkipSingleQuote);
2044 }
2045 }
2046<SkipDoubleQuote>{CPPC}[/]? { outputSpaces(yyscanner,yytext);
2047 yyextra->defText += yytext;
2048 yyextra->defLitText+=yytext;
2049 }
2050<SkipDoubleQuote>{CCS}[*]? { outputSpaces(yyscanner,yytext);
2051 yyextra->defText += yytext;
2052 yyextra->defLitText+=yytext;
2053 }
2054<SkipDoubleQuote>\" {
2056 yyextra->defText += *yytext;
2057 yyextra->defLitText+=yytext;
2058 BEGIN(DefineText);
2059 }
2060<SkipSingleQuote,SkipDoubleQuote>\\. {
2062 yyextra->defText += yytext;
2063 yyextra->defLitText+=yytext;
2064 }
2065<SkipSingleQuote>\' {
2067 yyextra->defText += *yytext;
2068 yyextra->defLitText+=yytext;
2069 BEGIN(DefineText);
2070 }
2071<SkipDoubleQuote,SkipSingleQuote>. { outputSpace(yyscanner,yytext[0]);
2072 yyextra->defText += *yytext;
2073 yyextra->defLitText += *yytext;
2074 }
2075<DefineText>. { outputSpace(yyscanner,yytext[0]);
2076 yyextra->defText += *yytext;
2077 yyextra->defLitText += *yytext;
2078 }
2079<<EOF>> {
2080 TRACE(
"End of include file");
2081
2082 if (yyextra->includeStack.empty())
2083 {
2084 TRACE(
"Terminating scanner");
2086 }
2087 else
2088 {
2089 QCString toFileName = yyextra->fileName;
2090 const std::unique_ptr<FileState> &fs=yyextra->includeStack.back();
2091
2092 YY_BUFFER_STATE oldBuf = YY_CURRENT_BUFFER;
2093 yy_switch_to_buffer( fs->bufState, yyscanner );
2094 yy_delete_buffer( oldBuf, yyscanner );
2095 yyextra->yyLineNr = fs->lineNr;
2096
2097 yyextra->inputBuf = fs->oldFileBuf;
2098 yyextra->inputBufPos = fs->oldFileBufPos;
2099 yyextra->curlyCount = fs->curlyCount;
2101 TRACE(
"switching to {}",yyextra->fileName);
2102
2103
2104
2106 lineStr.sprintf(
"# %d \"%s\" 2",yyextra->yyLineNr,
qPrint(yyextra->fileName));
2108
2109 yyextra->includeStack.pop_back();
2110
2111 {
2113
2114
2115
2116
2118 {
2119
2122 }
2123 else
2124 {
2126 {
2128 }
2129 }
2130 }
2131
2132 for (const auto &kv : yyextra->localDefines)
2133 {
2134 auto pair = yyextra->contextDefines.insert(kv);
2135 if (!pair.second)
2136 {
2137 yyextra->contextDefines.erase(pair.first);
2138 yyextra->contextDefines.insert(kv);
2139 }
2140 }
2141 yyextra->localDefines.clear();
2142 }
2143 }
2144<*>{CCS}/{CCE} |
2145<*>{CCS}[*!]? {
2146 if (YY_START==SkipVerbatim || YY_START == SkipCondVerbatim || YY_START==SkipCond || YY_START==IDLquote || YY_START == PragmaOnce)
2147 {
2148 REJECT;
2149 }
2150 else
2151 {
2153 yyextra->lastCContext=YY_START;
2154 yyextra->commentCount=1;
2155 if (yyleng==3)
2156 {
2157 yyextra->isSpecialComment = true;
2158 yyextra->lastGuardName.clear();
2159 }
2160 else
2161 {
2162 yyextra->isSpecialComment = false;
2163 }
2164 BEGIN(SkipCComment);
2165 }
2166 }
2167<*>{CPPC}[/!]? {
2168 if (YY_START==SkipVerbatim || YY_START == SkipCondVerbatim || YY_START==SkipCond ||
getLanguageFromFileName(yyextra->fileName)==SrcLangExt::Fortran || YY_START==IDLquote || YY_START == PragmaOnce)
2169 {
2170 REJECT;
2171 }
2172 else if (YY_START==RulesRoundDouble)
2173 {
2174 REJECT;
2175 }
2176 else
2177 {
2179 yyextra->lastCPPContext=YY_START;
2180 if (yyleng==3)
2181 {
2182 yyextra->isSpecialComment = true;
2183 yyextra->lastGuardName.clear();
2184 }
2185 else
2186 {
2187 yyextra->isSpecialComment = false;
2188 }
2189 BEGIN(SkipCPPComment);
2190 }
2191 }
2192<*>\n {
2194 yyextra->yyLineNr++;
2195 }
2196<*>. {
2197 yyextra->expectGuard =
FALSE;
2199 }
2200
2201%%