461 {
463 }
static char resolveTrigraph(char c)
464<Start>^{B}*"#" {
465 yyextra->yyColNr+=(int)yyleng;
466 yyextra->yyMLines=0;
467 yyextra->potentialDefine=yytext;
468 BEGIN(Command);
469 }
470<Start>^("%top{"|"%{") {
473 BEGIN(LexCopyLine);
474 }
static void outputArray(yyscan_t yyscanner, const char *a, yy_size_t len)
475<Start>^{Bopt}"cpp_quote"{Bopt}"("{Bopt}\" {
476 if (yyextra->insideIDL)
477 {
478 BEGIN(IDLquote);
479 }
480 else
481 {
482 REJECT;
483 }
484 }
485<IDLquote>"\\\\" {
487 }
488<IDLquote>"\\\"" {
490 }
491<IDLquote>"\""{Bopt}")" {
492 BEGIN(Start);
493 }
494<IDLquote>\n {
496 yyextra->yyLineNr++;
497 }
498<IDLquote>. {
500 }
501<Start>^{Bopt}/[^#] {
503 BEGIN(CopyLine);
504 }
505<Start>^{B}*[a-z_A-Z\x80-\xFF][a-z_A-Z0-9\x80-\xFF]+{B}*"("[^\)\n]*")"/{BN}{1,10}*[:{] { // constructors?
506 int i;
507 for (i=(int)yyleng-1;i>=0;i--)
508 {
509 unput(yytext[i]);
510 }
511 BEGIN(CopyLine);
512 }
513<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
514<Start>^{B}*[_A-Z][_A-Z0-9]+{B}*"("[^\)\n]*")"{B}*\n | // function like macro
515<Start>^{B}*[_A-Z][_A-Z0-9]+{B}*"("[^\(\)\n]*"("[^\)\n]*")"[^\)\n]*")"/{B}*("//"|"/\*") | // function list macro with one (...) argument followed by comment
516<Start>^{B}*[_A-Z][_A-Z0-9]+{B}*"("[^\)\n]*")"/{B}*("//"|"/\*") { // function like macro followed by comment
519 int pos = name.find('(');
520 if (pos<0) pos=0;
521 name=name.left(pos).stripWhiteSpace();
#define Config_getBool(name)
522
524 if (skipFuncMacros && !yyextra->insideFtn &&
525 name!="Q_PROPERTY" &&
526 !(
527 (yyextra->includeStack.empty() || yyextra->curlyCount>0) &&
528 yyextra->macroExpansion &&
530
532 )
533 )
534 {
535
536 if (yytext[yyleng-1] == '\n')
537 {
539 yyextra->yyLineNr++;
540 }
541 }
542 else
543 {
544 int i;
545 for (i=(int)yyleng-1;i>=0;i--)
546 {
547 unput(yytext[i]);
548 }
549 BEGIN(CopyLine);
550 }
551 }
552<CopyLine,LexCopyLine>"extern"{BN}*"\""[^\"]+"\""{BN}*("{")? {
554 yyextra->yyLineNr+=text.
contains(
'\n');
556 }
557<CopyLine,LexCopyLine>{RAWBEGIN} {
560 BEGIN(CopyRawString);
561 }
QCString extractBeginRawStringDelimiter(const char *rawStart)
562<CopyLine,LexCopyLine>"{" { // count brackets inside the main file
563 if (yyextra->includeStack.empty())
564 {
565 yyextra->curlyCount++;
566 }
568 }
569<LexCopyLine>^"%}" {
571 }
572<CopyLine,LexCopyLine>"}" { // count brackets inside the main file
573 if (yyextra->includeStack.empty() && yyextra->curlyCount>0)
574 {
575 yyextra->curlyCount--;
576 }
578 }
579<CopyLine,LexCopyLine>"'"\\[0-7]{1,3}"'" {
581 }
582<CopyLine,LexCopyLine>"'"\\."'" {
584 }
585<CopyLine,LexCopyLine>"'"."'" {
587 }
588<CopyLine,LexCopyLine>[$]?@\" {
591 BEGIN( CopyStringCs );
592 }
593<CopyLine,LexCopyLine>\" {
596 {
597 BEGIN( CopyString );
598 }
599 else
600 {
601 BEGIN( CopyStringFtnDouble );
602 }
603 }
604<CopyLine,LexCopyLine>\' {
607 BEGIN( CopyStringFtn );
608 }
609<CopyString>[^\"\\\r\n]{1,1000} {
611 }
612<CopyStringCs>[^\"\r\n]{1,1000} {
614 }
615<CopyStringCs>\"\" {
617 }
618<CopyString>\\. {
620 }
621<CopyString,CopyStringCs>\" {
623 BEGIN( CopyLine );
624 }
625<CopyStringFtnDouble>[^\"\\\r\n]{1,1000} {
627 }
628<CopyStringFtnDouble>\\. {
630 }
631<CopyStringFtnDouble>\" {
633 BEGIN( CopyLine );
634 }
635<CopyStringFtn>[^\'\\\r\n]{1,1000} {
637 }
638<CopyStringFtn>\\. {
640 }
641<CopyStringFtn>\' {
643 BEGIN( CopyLine );
644 }
645<CopyRawString>{RAWEND} {
648 {
649 BEGIN( CopyLine );
650 }
651 }
QCString extractEndRawStringDelimiter(const char *rawEnd)
652<CopyRawString>[^)]{1,1000} {
654 }
655<CopyRawString>. {
657 }
658<CopyLine,LexCopyLine>{ID}/{BN}{0,80}"(" {
659 yyextra->expectGuard =
FALSE;
661
662
663
664
665
666
667
668
669 if ((yyextra->includeStack.empty() || yyextra->curlyCount>0) &&
670 yyextra->macroExpansion &&
673 )
674 {
675
676 yyextra->roundCount=0;
677 yyextra->defArgsStr=yytext;
679 {
684 }
685 else
686 {
687 yyextra->findDefArgContext = CopyLine;
688 BEGIN(FindDefineArgs);
689 }
690 }
691 else
692 {
694 }
695 }
static QCString expandMacro(yyscan_t yyscanner, const QCString &name)
696<CopyLine>{RulesDelim} {
698 yyextra->lexRulesPart = !yyextra->lexRulesPart;
700 }
701
702<CopyLine>{RulesSharp} {
703 if (!yyextra->lexRulesPart) REJECT;
704 if (yyextra->curlyCount) REJECT;
706 BEGIN(RulesPattern);
707 }
708<RulesPattern>{EscapeRulesChar} {
710 }
711<RulesPattern>{RulesCurly} {
713 }
714<RulesPattern>{StartDouble} {
716 yyextra->lastContext = YY_START;
717 BEGIN(RulesDouble);
718 }
719<RulesDouble,RulesRoundDouble>"\\\\" {
721 }
722<RulesDouble,RulesRoundDouble>"\\\"" {
724 }
725<RulesDouble>"\"" {
727 BEGIN( yyextra->lastContext ) ;
728 }
729<RulesRoundDouble>"\"" {
731 BEGIN(RulesRound) ;
732 }
733<RulesDouble,RulesRoundDouble>. {
735 }
736<RulesPattern>{StartSquare} {
738 yyextra->lastContext = YY_START;
739 BEGIN(RulesSquare);
740 }
741<RulesSquare,RulesRoundSquare>{CHARCE} {
743 }
744<RulesSquare,RulesRoundSquare>"\\[" |
745<RulesSquare,RulesRoundSquare>"\\]" {
747 }
748<RulesSquare>"]" {
750 BEGIN(RulesPattern);
751 }
752<RulesRoundSquare>"]" {
754 BEGIN(RulesRound) ;
755 }
756<RulesSquare,RulesRoundSquare>"\\\\" {
758 }
759<RulesSquare,RulesRoundSquare>. {
761 }
762<RulesPattern>{StartRoundQuest} {
764 yyextra->lastContext = YY_START;
765 BEGIN(RulesRoundQuest);
766 }
767<RulesRoundQuest>{nl} {
769 }
770<RulesRoundQuest>[^)] {
772 }
773<RulesRoundQuest>")" {
775 BEGIN(yyextra->lastContext);
776 }
777<RulesPattern>{StartRound} {
778 yyextra->roundCount++;
780 yyextra->lastContext = YY_START;
781 BEGIN(RulesRound);
782 }
783<RulesRound>{RulesCurly} {
785 }
786<RulesRound>{StartSquare} {
788 BEGIN(RulesRoundSquare);
789 }
790<RulesRound>{StartDouble} {
792 BEGIN(RulesRoundDouble);
793 }
794<RulesRound>{EscapeRulesChar} {
796 }
797<RulesRound>"(" {
798 yyextra->roundCount++;
800 }
801<RulesRound>")" {
802 yyextra->roundCount--;
804 if (!yyextra->roundCount) BEGIN( yyextra->lastContext ) ;
805 }
806<RulesRound>{nl} {
808 }
809<RulesRound>{B} {
811 }
812<RulesRound>. {
814 }
815<RulesPattern>{B} {
817 BEGIN(CopyLine);
818 }
819<RulesPattern>. {
821 }
822
823<CopyLine,LexCopyLine>{ID} {
825 if ((yyextra->includeStack.empty() || yyextra->curlyCount>0) &&
826 yyextra->macroExpansion &&
830 )
831 {
836 }
837 else
838 {
840 }
841 }
842<CopyLine,LexCopyLine>"\\"\r?/\n { // strip line continuation characters
844 }
845<CopyLine,LexCopyLine>\\. {
847 }
848<CopyLine,LexCopyLine>. {
850 }
851<CopyLine,LexCopyLine>\n {
853 BEGIN(Start);
854 yyextra->yyLineNr++;
855 yyextra->yyColNr=1;
856 }
857<FindDefineArgs>"(" {
858 yyextra->defArgsStr+='(';
859 yyextra->roundCount++;
860 }
861<FindDefineArgs>")" {
862 yyextra->defArgsStr+=')';
863 yyextra->roundCount--;
864 if (yyextra->roundCount==0)
865 {
867
868 if (yyextra->findDefArgContext==CopyLine)
869 {
871 BEGIN(yyextra->findDefArgContext);
872 }
873 else
874 {
876 yyextra->nospaces=
FALSE;
877 BEGIN(Start);
878 }
879 }
880 }
881
static void readIncludeFile(yyscan_t yyscanner, const QCString &inc)
882<FindDefineArgs>")"{B}*"(" {
883 yyextra->defArgsStr+=yytext;
884 }
885 */
886<FindDefineArgs>{CHARLIT} {
887 yyextra->defArgsStr+=yytext;
888 }
889<FindDefineArgs>{CCS}[*]? {
890 yyextra->defArgsStr+=yytext;
891 BEGIN(ArgCopyCComment);
892 }
893<FindDefineArgs>{CPPC}[/!].*\n/{B}*{CPPC}[/!] { // replace multi line C++ style comment by C style comment
894 yyextra->defArgsStr+=
QCString(
"/**")+&yytext[3];
895 BEGIN(ArgCopyCppComment);
896 }
897<FindDefineArgs>{CPPC}[/!].*\n { // replace C++ single line style comment by C style comment
898 yyextra->defArgsStr+=
QCString(
"/**")+&yytext[3]+
" */";
899 }
900<FindDefineArgs>\" {
901 yyextra->defArgsStr+=*yytext;
902 BEGIN(ReadString);
903 }
904<FindDefineArgs>' {
906 yyextra->defArgsStr+=*yytext;
907 BEGIN(ReadString);
908 }
909<FindDefineArgs>\n {
910 yyextra->defArgsStr+=' ';
911 yyextra->yyLineNr++;
913 }
914<FindDefineArgs>"@" {
915 yyextra->defArgsStr+="@@";
916 }
917<FindDefineArgs>. {
918 yyextra->defArgsStr+=*yytext;
919 }
920<ArgCopyCComment>[^*\n]+ {
921 yyextra->defArgsStr+=yytext;
922 }
923<ArgCopyCComment>{CCE} {
924 yyextra->defArgsStr+=yytext;
925 BEGIN(FindDefineArgs);
926 }
927<ArgCopyCComment>\n {
928 yyextra->defArgsStr+=' ';
929 yyextra->yyLineNr++;
931 }
932<ArgCopyCComment>. {
933 yyextra->defArgsStr+=yytext;
934 }
935<ArgCopyCppComment>^{B}*
936<ArgCopyCppComment>{CPPC}[/!].*\n/{B}*{CPPC}[/!] { // replace multi line C++ style comment by C style comment
937 const char *startContent = &yytext[3];
938 if (startContent[0]=='<') startContent++;
939 yyextra->defArgsStr+=startContent;
940 }
941<ArgCopyCppComment>{CPPC}[/!].*\n { // replace C++ multie line style comment by C style comment
942 const char *startContent = &yytext[3];
943 if (startContent[0]=='<') startContent++;
944 yyextra->defArgsStr+=
QCString(startContent)+
" */";
945 BEGIN(FindDefineArgs);
946 }
947<ArgCopyCppComment>. { // unexpected character
948 unput(*yytext);
949 yyextra->defArgsStr+=" */";
950 BEGIN(FindDefineArgs);
951 }
952<ReadString>"\"" {
953 yyextra->defArgsStr+=*yytext;
954 BEGIN(FindDefineArgs);
955 }
956<ReadString>"'" {
958 yyextra->defArgsStr+=*yytext;
959 BEGIN(FindDefineArgs);
960 }
961
962<ReadString>{CPPC}|{CCS} {
963 yyextra->defArgsStr+=yytext;
964 }
965<ReadString>\\/\r?\n { // line continuation
966 }
967<ReadString>\\. {
968 yyextra->defArgsStr+=yytext;
969 }
970<ReadString>. {
971 yyextra->defArgsStr+=*yytext;
972 }
973<Command>("include"|"import"){B}+/{ID} {
974 yyextra->isImported = yytext[1]=='m';
975 if (yyextra->macroExpansion)
976 BEGIN(IncludeID);
977 }
978<Command>("include"|"import"){B}*[<"] {
979 yyextra->isImported = yytext[1]=='m';
980 char c[2];
981 c[0]=yytext[yyleng-1];c[1]='\0';
982 yyextra->incName=c;
983 BEGIN(Include);
984 }
985<Command>("cmake")?"define"{B}+ {
986 yyextra->potentialDefine +=
substitute(yytext,
"cmake",
" ");
987
988 yyextra->yyColNr+=(int)yyleng;
989 BEGIN(DefName);
990 }
QCString substitute(const QCString &s, const QCString &src, const QCString &dst)
substitute all occurrences of src in s by dst
991<Command>"cmakedefine01"{B}+ {
992 yyextra->potentialDefine +=
substitute(yytext,
"cmakedefine01",
" define ");
993
994 yyextra->yyColNr+=(int)yyleng;
995 BEGIN(CmakeDefName01);
996 }
997<Command>"ifdef"/{B}*"(" {
999 yyextra->guardExpr.clear();
1000 BEGIN(DefinedExpr2);
1001 }
static void incrLevel(yyscan_t yyscanner)
1002<Command>"ifdef"/{B}+ {
1003
1005 yyextra->guardExpr.clear();
1006 BEGIN(DefinedExpr1);
1007 }
1008<Command>"ifndef"/{B}*"(" {
1010 yyextra->guardExpr="! ";
1011 BEGIN(DefinedExpr2);
1012 }
1013<Command>"ifndef"/{B}+ {
1015 yyextra->guardExpr="! ";
1016 BEGIN(DefinedExpr1);
1017 }
1018<Command>"if"/[ \t(!] {
1020 yyextra->guardExpr.clear();
1021 BEGIN(Guard);
1022 }
1023<Command>("elif"|"else"{B}*"if")/[ \t(!] {
1025 {
1026 yyextra->guardExpr.clear();
1027 BEGIN(Guard);
1028 }
1029 else
1030 {
1031 yyextra->ifcount=0;
1032 BEGIN(SkipCPPBlock);
1033 }
1034 }
static bool otherCaseDone(yyscan_t yyscanner)
1035<Command>"else"/[^a-z_A-Z0-9\x80-\xFF] {
1037 {
1038 yyextra->ifcount=0;
1039 BEGIN(SkipCPPBlock);
1040 }
1041 else
1042 {
1044 }
1045 }
static void setCaseDone(yyscan_t yyscanner, bool value)
1046<Command>"undef"{B}+ {
1047 BEGIN(UndefName);
1048 }
1049<Command>("elif"|"else"{B}*"if")/[ \t(!] {
1051 {
1052 yyextra->guardExpr.clear();
1053 BEGIN(Guard);
1054 }
1055 }
1056<Command>"endif"/[^a-z_A-Z0-9\x80-\xFF] {
1057
1059 }
static void decrLevel(yyscan_t yyscanner)
1060<Command,IgnoreLine>\n {
1062 BEGIN(Start);
1063 yyextra->yyLineNr++;
1064 }
1065<Command>"pragma"{B}+"once" {
1066 yyextra->expectGuard =
FALSE;
1067 if (yyextra->pragmaSet.find(yyextra->fileName.str())!=yyextra->pragmaSet.end())
1068 {
1070 BEGIN(PragmaOnce);
1071 }
1072 else
1073 {
1074 yyextra->pragmaSet.insert(yyextra->fileName.data());
1075 }
1076 }
1077<PragmaOnce>. {}
1078<PragmaOnce>\n {}
1079<PragmaOnce><<EOF>> {
1080 yyextra->expectGuard =
FALSE;
1081 BEGIN(Start);
1082 }
1083<Command>{ID} { // unknown directive
1084 BEGIN(IgnoreLine);
1085 }
1086<IgnoreLine>\\[\r]?\n {
1088 yyextra->yyLineNr++;
1089 }
1090<IgnoreLine>.
1091<Command>. { yyextra->potentialDefine += yytext[0]=='\t' ? '\t' : ' ';
1092 yyextra->yyColNr+=(int)yyleng;
1093 }
1094<UndefName>{ID} {
1097
1099 )
1100 {
1101
1103 }
1104 BEGIN(Start);
1105 }
1106<Guard>\\[\r]?\n {
1108 yyextra->guardExpr+=' ';
1109 yyextra->yyLineNr++;
1110 }
1111<Guard>"defined"/{B}*"(" {
1112 BEGIN(DefinedExpr2);
1113 }
1114<Guard>"defined"/{B}+ {
1115 BEGIN(DefinedExpr1);
1116 }
1117<Guard>"true"/{B}|{B}*[\r]?\n { yyextra->guardExpr+="1L"; }
1118<Guard>"false"/{B}|{B}*[\r]?\n { yyextra->guardExpr+="0L"; }
1119<Guard>"not"/{B} { yyextra->guardExpr+='!'; }
1120<Guard>"not_eq"/{B} { yyextra->guardExpr+="!="; }
1121<Guard>"and"/{B} { yyextra->guardExpr+="&&"; }
1122<Guard>"or"/{B} { yyextra->guardExpr+="||"; }
1123<Guard>"bitand"/{B} { yyextra->guardExpr+="&"; }
1124<Guard>"bitor"/{B} { yyextra->guardExpr+="|"; }
1125<Guard>"xor"/{B} { yyextra->guardExpr+="^"; }
1126<Guard>"compl"/{B} { yyextra->guardExpr+="~"; }
1127<Guard>{ID} { yyextra->guardExpr+=yytext; }
1128<Guard>"@" { yyextra->guardExpr+="@@"; }
1129<Guard>. { yyextra->guardExpr+=*yytext; }
1130<Guard>\n {
1131 unput(*yytext);
1132
1133
1136 if (guard)
1137 {
1138 BEGIN(Start);
1139 }
1140 else
1141 {
1142 yyextra->ifcount=0;
1143 BEGIN(SkipCPPBlock);
1144 }
1145 }
static bool computeExpression(yyscan_t yyscanner, const QCString &expr)
1146<DefinedExpr1,DefinedExpr2>\\\n { yyextra->yyLineNr++; outputChar(yyscanner,'\n'); }
1147<DefinedExpr1>{ID} {
1148 if (
isDefined(yyscanner,yytext) || yyextra->guardName==yytext)
1149 yyextra->guardExpr+=" 1L ";
1150 else
1151 yyextra->guardExpr+=" 0L ";
1152 yyextra->lastGuardName=yytext;
1153 BEGIN(Guard);
1154 }
1155<DefinedExpr2>{ID} {
1156 if (
isDefined(yyscanner,yytext) || yyextra->guardName==yytext)
1157 yyextra->guardExpr+=" 1L ";
1158 else
1159 yyextra->guardExpr+=" 0L ";
1160 yyextra->lastGuardName=yytext;
1161 }
1162<DefinedExpr1,DefinedExpr2>\n { // should not happen, handle anyway
1163 yyextra->yyLineNr++;
1164 yyextra->ifcount=0;
1165 BEGIN(SkipCPPBlock);
1166 }
1167<DefinedExpr2>")" {
1168 BEGIN(Guard);
1169 }
1170<DefinedExpr1,DefinedExpr2>.
1171<SkipCPPBlock>^{B}*"#" { BEGIN(SkipCommand); }
1172<SkipCPPBlock>^{Bopt}/[^#] { BEGIN(SkipLine); }
1173<SkipCPPBlock>\n { yyextra->yyLineNr++; outputChar(yyscanner,'\n'); }
1174<SkipCPPBlock>.
1175<SkipCommand>"if"(("n")?("def"))?/[ \t(!] {
1177 yyextra->ifcount++;
1178
1179 }
1180<SkipCommand>"else" {
1181
1183 {
1185
1186 BEGIN(Start);
1187 }
1188 }
1189<SkipCommand>("elif"|"else"{B}*"if")/[ \t(!] {
1190 if (yyextra->ifcount==0)
1191 {
1193 {
1194 yyextra->guardExpr.clear();
1195 yyextra->lastGuardName.clear();
1196 BEGIN(Guard);
1197 }
1198 else
1199 {
1200 BEGIN(SkipCPPBlock);
1201 }
1202 }
1203 }
1204<SkipCommand>"endif" {
1205 yyextra->expectGuard =
FALSE;
1207 if (--yyextra->ifcount<0)
1208 {
1209
1210 BEGIN(Start);
1211 }
1212 }
1213<SkipCommand>\n {
1215 yyextra->yyLineNr++;
1216 BEGIN(SkipCPPBlock);
1217 }
1218<SkipCommand>{ID} { // unknown directive
1219 BEGIN(SkipLine);
1220 }
1221<SkipCommand>.
1222<SkipLine>[^'"/\n]+
1223<SkipLine>{CHARLIT} { }
1224<SkipLine>\" {
1225 BEGIN(SkipString);
1226 }
1227<SkipLine>.
1228<SkipString>{CPPC}/[^\n]* {
1229 }
1230<SkipLine,SkipCommand,SkipCPPBlock>{CPPC}[^\n]* {
1231 yyextra->lastCPPContext=YY_START;
1232 BEGIN(RemoveCPPComment);
1233 }
1234<SkipString>{CCS}/[^\n]* {
1235 }
1236<SkipLine,SkipCommand,SkipCPPBlock>{CCS}/[^\n]* {
1237 yyextra->lastCContext=YY_START;
1238 BEGIN(RemoveCComment);
1239 }
1240<SkipLine>\n {
1242 yyextra->yyLineNr++;
1243 BEGIN(SkipCPPBlock);
1244 }
1245<SkipString>[^"\\\n]+ { }
1246<SkipString>\\. { }
1247<SkipString>\" {
1248 BEGIN(SkipLine);
1249 }
1250<SkipString>. { }
1251<IncludeID>{ID}{Bopt}/"(" {
1252 yyextra->nospaces=
TRUE;
1253 yyextra->roundCount=0;
1254 yyextra->defArgsStr=yytext;
1255 yyextra->findDefArgContext = IncludeID;
1256 BEGIN(FindDefineArgs);
1257 }
1258<IncludeID>{ID} {
1259 yyextra->nospaces=
TRUE;
1261 BEGIN(Start);
1262 }
1263<Include>[^\">\n]+[\">] {
1264 yyextra->incName+=yytext;
1265 if (yyextra->isImported)
1266 {
1267 BEGIN(EndImport);
1268 }
1269 else
1270 {
1272 BEGIN(Start);
1273 }
1274 }
1275<EndImport>{ENDIMPORTopt}/\n {
1277 BEGIN(Start);
1278 }
1279<EndImport>\\[\r]?"\n" {
1281 yyextra->yyLineNr++;
1282 }
1283<EndImport>. {
1284 }
1285<DefName>{ID}/("\\\n")*"(" { // define with argument
1286
1287 yyextra->argMap.clear();
1288 yyextra->defArgs = 0;
1289 yyextra->defArgsStr.clear();
1290 yyextra->defText.clear();
1291 yyextra->defLitText.clear();
1292 yyextra->defName = yytext;
1293 yyextra->defVarArgs =
FALSE;
1294 yyextra->defExtraSpacing.clear();
1295 yyextra->defContinue = false;
1296 BEGIN(DefineArg);
1297 }
1298<DefName>{ID}{B}+"1"/[ \r\t\n] { // special case: define with 1 -> can be "guard"
1299
1300 yyextra->argMap.clear();
1301 yyextra->defArgs = -1;
1302 yyextra->defArgsStr.clear();
1304 yyextra->defVarArgs =
FALSE;
1305
1306
1307 if (yyextra->curlyCount>0 || yyextra->defName!=yyextra->lastGuardName || !yyextra->expectGuard)
1308 {
1309 QCString def = yyextra->potentialDefine +
1310 yyextra->defName ;
1312 outputSpaces(yyscanner,yytext+yyextra->defName.length());
1313 yyextra->quoteArg=
FALSE;
1314 yyextra->insideComment=
FALSE;
1315 yyextra->lastGuardName.clear();
1316 yyextra->defText="1";
1317 yyextra->defLitText="1";
1318 BEGIN(DefineText);
1319 }
1320 else
1321 {
1322
1323 yyextra->defText.clear();
1324 yyextra->defLitText.clear();
1325 BEGIN(Start);
1326 }
1327 yyextra->expectGuard=
FALSE;
1328 }
static void outputSpaces(yyscan_t yyscanner, char *s)
1329<DefName,CmakeDefName01>{ID}/{B}*"\n" { // empty define
1330 yyextra->argMap.clear();
1331 yyextra->defArgs = -1;
1332 yyextra->defName = yytext;
1333 yyextra->defArgsStr.clear();
1334 yyextra->defText.clear();
1335 yyextra->defLitText.clear();
1336 yyextra->defVarArgs =
FALSE;
1337
1338
1339 if (yyextra->curlyCount>0 || yyextra->defName!=yyextra->lastGuardName || !yyextra->expectGuard)
1340 {
1341 QCString def = yyextra->potentialDefine + yyextra->defName;
1343 yyextra->quoteArg=
FALSE;
1344 yyextra->insideComment=
FALSE;
1345 if (YY_START == CmakeDefName01) yyextra->defText = "0";
1346 else if (yyextra->insideCS) yyextra->defText="1";
1347 BEGIN(DefineText);
1348 }
1349 else
1350 {
1351
1352 yyextra->guardName = yytext;
1353 yyextra->lastGuardName.clear();
1354 BEGIN(Start);
1355 }
1356 yyextra->expectGuard=
FALSE;
1357 }
1358<DefName>{ID}/{B}* { // define with content
1359
1360 yyextra->argMap.clear();
1361 yyextra->defArgs = -1;
1362 yyextra->defArgsStr.clear();
1363 yyextra->defText.clear();
1364 yyextra->defLitText.clear();
1365 yyextra->defName = yytext;
1366 yyextra->defVarArgs =
FALSE;
1367 QCString def = yyextra->potentialDefine +
1368 yyextra->defName +
1369 yyextra->defArgsStr ;
1371 yyextra->quoteArg=
FALSE;
1372 yyextra->insideComment=
FALSE;
1373 BEGIN(DefineText);
1374 }
1375<DefineArg>"\\\n" {
1376 yyextra->defExtraSpacing+="\n";
1377 yyextra->defContinue = true;
1378 yyextra->yyLineNr++;
1379 }
1380<DefineArg>{B}* { yyextra->defExtraSpacing+=yytext; }
1381<DefineArg>","{B}* { yyextra->defArgsStr+=yytext; }
1382<DefineArg>"("{B}* { yyextra->defArgsStr+=yytext; }
1383<DefineArg>{B}*")"{B}* {
1385 yyextra->defArgsStr+=yytext;
1386 QCString def = yyextra->potentialDefine +
1387 yyextra->defName +
1388 yyextra->defArgsStr +
1389 yyextra->defExtraSpacing ;
1391 yyextra->quoteArg=
FALSE;
1392 yyextra->insideComment=
FALSE;
1393 BEGIN(DefineText);
1394 }
static void extraSpacing(yyscan_t yyscanner)
1395<DefineArg>"..." { // Variadic macro
1396 yyextra->defVarArgs =
TRUE;
1397 yyextra->defArgsStr+=yytext;
1398 yyextra->argMap.emplace(std::string("__VA_ARGS__"),yyextra->defArgs);
1399 yyextra->defArgs++;
1400 }
1401<DefineArg>{ID}{B}*("..."?) {
1402
1404 yyextra->defVarArgs = yytext[yyleng-1]=='.';
1405 if (yyextra->defVarArgs)
1406 {
1408 }
1410 yyextra->defArgsStr+=yytext;
1411 yyextra->argMap.emplace(
toStdString(argName),yyextra->defArgs);
1412 yyextra->defArgs++;
1414 }
1415
1416<DefineText>"/ **"|"/ *!" {
1417 yyextra->defText+=yytext;
1418 yyextra->defLitText+=yytext;
1419 yyextra->insideComment=
TRUE;
1420 }
1421<DefineText>"* /" {
1422 yyextra->defText+=yytext;
1423 yyextra->defLitText+=yytext;
1424 yyextra->insideComment=
FALSE;
1425 }
1426 */
1427<DefineText>{CCS}[!*]? {
1428 yyextra->defText+=yytext;
1429 yyextra->defLitText+=yytext;
1430 yyextra->lastCContext=YY_START;
1431 yyextra->commentCount=1;
1432 BEGIN(CopyCComment);
1433 }
1434<DefineText>{CPPC}[!/]? {
1436 yyextra->lastCPPContext=YY_START;
1437 yyextra->defLitText+=' ';
1438 BEGIN(SkipCPPComment);
1439 }
1440<SkipCComment>[/]?{CCE} {
1441 if (yytext[0]==
'/')
outputChar(yyscanner,
'/');
1443 if (--yyextra->commentCount<=0)
1444 {
1445 if (yyextra->lastCContext==Start)
1446
1447
1448 {
1449 YY_CURRENT_BUFFER->yy_at_bol=1;
1450 }
1451 BEGIN(yyextra->lastCContext);
1452 }
1453 }
1454<SkipCComment>{CPPC}("/")* {
1456 }
1457<SkipCComment>{CCS} {
1459
1460 }
1461<SkipCond>{CMD}{CMD} { }
1462<SkipCond>^({B}*"*"+)?{B}{0,3}"~~~"[~]* {
1464 if (!markdownSupport || !yyextra->isSpecialComment)
1465 {
1466 REJECT;
1467 }
1468 else
1469 {
1470 yyextra->fenceChar='~';
1472 BEGIN(SkipCondVerbatim);
1473 }
1474 }
static yy_size_t getFenceSize(char *txt, yy_size_t leng)
1475<SkipCond>^({B}*"*"+)?{B}{0,3}"```"[`]* {
1477 if (!markdownSupport || !yyextra->isSpecialComment)
1478 {
1479 REJECT;
1480 }
1481 else
1482 {
1483 yyextra->fenceChar='`';
1485 BEGIN(SkipCondVerbatim);
1486 }
1487 }
1488<SkipCComment>^({B}*"*"+)?{B}{0,3}"~~~"[~]* {
1490 if (!markdownSupport || !yyextra->isSpecialComment)
1491 {
1492 REJECT;
1493 }
1494 else
1495 {
1497 yyextra->fenceChar='~';
1499 BEGIN(SkipVerbatim);
1500 }
1501 }
1502<SkipCComment>^({B}*"*"+)?{B}{0,3}"```"[`]* {
1504 if (!markdownSupport || !yyextra->isSpecialComment)
1505 {
1506 REJECT;
1507 }
1508 else
1509 {
1511 yyextra->fenceChar='`';
1513 BEGIN(SkipVerbatim);
1514 }
1515 }
1516<SkipCComment>{CMD}{VERBATIM_LINE} |
1517<SkipCComment>{CMD}{LITERAL_BLOCK} { // escaped command
1520 }
1521<SkipCComment>{VERBATIM_LINE}.*/\n { // normal command
1523 }
1524<SkipCComment>{LITERAL_BLOCK} { // normal block command
1528 BEGIN(SkipVerbatim);
1529 }
static void determineBlockName(yyscan_t yyscanner)
1530<SkipCond>{CMD}{CMD}"cond"[ \t]+ {}// escaped cond command
1531<SkipCond>{CMD}"cond"/\n |
1532<SkipCond>{CMD}"cond"[ \t]+ { // cond command in a skipped cond section, this section has to be skipped as well
1533
1535 }
static void startCondSection(yyscan_t yyscanner, const QCString §Id)
1536<SkipCComment>"{"[ \t]*"@code"/[ \t\n] {
1538 yyextra->javaBlock=1;
1539 BEGIN(JavaDocVerbatimCode);
1540 }
1541<SkipCComment>"{"[ \t]*"@literal"/[ \t\n] {
1543 yyextra->javaBlock=1;
1544 BEGIN(JavaDocVerbatimCode);
1545 }
1546<SkipCComment,SkipCPPComment>{CMD}{CMD}"cond"[ \t\n]+ { // escaped cond command
1548 }
1549<SkipCPPComment>{CMD}"cond"[ \t]+ { // conditional section
1550 yyextra->ccomment=
TRUE;
1551 yyextra->condCtx=YY_START;
1552 BEGIN(CondLineCpp);
1553 }
1554<SkipCComment>{CMD}"cond"[ \t]+ { // conditional section
1555 yyextra->ccomment=
FALSE;
1556 yyextra->condCtx=YY_START;
1557 BEGIN(CondLineC);
1558 }
1559<CondLineC,CondLineCpp>[!()&| \ta-z_A-Z0-9\x80-\xFF.\-]+ {
1561 if (yyextra->skip)
1562 {
1563 if (YY_START==CondLineC)
1564 {
1565
1567 yyextra->ccomment=
TRUE;
1568 }
1569 else
1570 {
1571 yyextra->ccomment=
FALSE;
1572 }
1573 BEGIN(SkipCond);
1574 }
1575 else
1576 {
1577 BEGIN(yyextra->condCtx);
1578 }
1579 }
1580<CondLineC,CondLineCpp>. { // non-guard character
1581 unput(*yytext);
1583 if (yyextra->skip)
1584 {
1585 if (YY_START==CondLineC)
1586 {
1587
1589 yyextra->ccomment=
TRUE;
1590 }
1591 else
1592 {
1593 yyextra->ccomment=
FALSE;
1594 }
1595 BEGIN(SkipCond);
1596 }
1597 else
1598 {
1599 BEGIN(yyextra->condCtx);
1600 }
1601 }
1602<SkipCComment,SkipCPPComment>{CMD}"cond"{WSopt}/\n { // no guard
1603 if (YY_START==SkipCComment)
1604 {
1605 yyextra->ccomment=
TRUE;
1606
1608 }
1609 else
1610 {
1611 yyextra->ccomment=
FALSE;
1612 }
1613 yyextra->condCtx=YY_START;
1615 BEGIN(SkipCond);
1616 }
1617<SkipCond>\n { yyextra->yyLineNr++; outputChar(yyscanner,'\n'); }
1618<SkipCond>{VERBATIM_LINE}.*/\n { }
1619<SkipCond>{LITERAL_BLOCK} {
1621 yyextra->yyLineNr+=numNLs;
1622 for (
int i = 0; i < numNLs; i++)
outputChar(yyscanner,
'\n');
1624 BEGIN(SkipCondVerbatim);
1625 }
1626
1627<SkipCond>. { }
1628<SkipCond>[^\/\!*\\@\n]+ { }
1629<SkipCond>{CPPC}[/!] { yyextra->ccomment=FALSE; }
1630<SkipCond>{CCS}[*!] { yyextra->ccomment=TRUE; }
1631<SkipCond,SkipCComment,SkipCPPComment>{CMD}{CMD}"endcond"/[^a-z_A-Z0-9\x80-\xFF] {
1632 if (!yyextra->skip)
1633 {
1635 }
1636 }
1637<SkipCond>{CMD}"endcond"/[^a-z_A-Z0-9\x80-\xFF] {
1638 bool oldSkip = yyextra->skip;
1640 if (oldSkip && !yyextra->skip)
1641 {
1642 if (yyextra->ccomment)
1643 {
1645 }
1646 BEGIN(yyextra->condCtx);
1647 }
1648 }
static void endCondSection(yyscan_t yyscanner)
1649<SkipCComment,SkipCPPComment>{CMD}"endcond"/[^a-z_A-Z0-9\x80-\xFF] {
1650 bool oldSkip = yyextra->skip;
1652 if (oldSkip && !yyextra->skip)
1653 {
1654 BEGIN(yyextra->condCtx);
1655 }
1656 }
1657<SkipCondVerbatim>{LITERAL_BLOCK_END} { /* end of verbatim block */
1658 if (yytext[1]=='f' && yyextra->blockName==&yytext[2])
1659 {
1660 BEGIN(SkipCond);
1661 }
1662 else if (&yytext[4]==yyextra->blockName)
1663 {
1664 BEGIN(SkipCond);
1665 }
1666 }
1667<SkipVerbatim>{LITERAL_BLOCK_END} { /* end of verbatim block */
1669 if (yytext[1]=='f' && yyextra->blockName==&yytext[2])
1670 {
1671 BEGIN(SkipCComment);
1672 }
1673 else if (&yytext[4]==yyextra->blockName)
1674 {
1675 BEGIN(SkipCComment);
1676 }
1677 }
1678<SkipCondVerbatim>^({B}*"*"+)?{B}{0,3}"~~~"[~]* {
1679 if (yyextra->fenceSize==
getFenceSize(yytext,yyleng) && yyextra->fenceChar==
'~')
1680 {
1681 BEGIN(SkipCond);
1682 }
1683 }
1684<SkipCondVerbatim>^({B}*"*"+)?{B}{0,3}"```"[`]* {
1685 if (yyextra->fenceSize==
getFenceSize(yytext,yyleng) && yyextra->fenceChar==
'`')
1686 {
1687 BEGIN(SkipCond);
1688 }
1689 }
1690<SkipVerbatim>^({B}*"*"+)?{B}{0,3}"~~~"[~]* {
1692 if (yyextra->fenceSize==
getFenceSize(yytext,yyleng) && yyextra->fenceChar==
'~')
1693 {
1694 BEGIN(SkipCComment);
1695 }
1696 }
1697<SkipVerbatim>^({B}*"*"+)?{B}{0,3}"```"[`]* {
1699 if (yyextra->fenceSize==
getFenceSize(yytext,yyleng) && yyextra->fenceChar==
'`')
1700 {
1701 BEGIN(SkipCComment);
1702 }
1703 }
1704<SkipCondVerbatim>{CCE}|{CCS} { }
1705<SkipVerbatim>{CCE}|{CCS} {
1707 }
1708<JavaDocVerbatimCode>"{" {
1709 if (yyextra->javaBlock==0)
1710 {
1711 REJECT;
1712 }
1713 else
1714 {
1715 yyextra->javaBlock++;
1717 }
1718 }
1719<JavaDocVerbatimCode>"}" {
1720 if (yyextra->javaBlock==0)
1721 {
1722 REJECT;
1723 }
1724 else
1725 {
1726 yyextra->javaBlock--;
1727 if (yyextra->javaBlock==0)
1728 {
1730 BEGIN(SkipCComment);
1731 }
1732 else
1733 {
1735 }
1736 }
1737 }
1738<JavaDocVerbatimCode>\n { /* new line in verbatim block */
1740 }
1741<JavaDocVerbatimCode>. { /* any other character */
1743 }
1744<SkipCondVerbatim>[^{*\\@\x06~`\n\/]+ { }
1745<SkipCComment,SkipVerbatim>[^{*\\@\x06~`\n\/]+ {
1747 }
1748<SkipCComment,SkipVerbatim,SkipCondVerbatim>\n {
1749 yyextra->yyLineNr++;
1751 }
1752<SkipCondVerbatim>. { }
1753<SkipCComment,SkipVerbatim>. {
1755 }
1756<CopyCComment>[^*a-z_A-Z\x80-\xFF\n]*[^*a-z_A-Z\x80-\xFF\\\n] {
1757 yyextra->defLitText+=yytext;
1758 yyextra->defText+=
escapeAt(yytext);
1759 }
static QCString escapeAt(const QCString &text)
1760<CopyCComment>\\[\r]?\n {
1761 yyextra->defLitText+=yytext;
1762 yyextra->defText+=" ";
1763 yyextra->yyLineNr++;
1764 yyextra->yyMLines++;
1765 }
1766<CopyCComment>{CCE} {
1767 yyextra->defLitText+=yytext;
1768 yyextra->defText+=yytext;
1769 BEGIN(yyextra->lastCContext);
1770 }
1771<CopyCComment>\n {
1772 yyextra->yyLineNr++;
1773 yyextra->defLitText+=yytext;
1774 yyextra->defText+=' ';
1775 }
1776<RemoveCComment>{CCE}{B}*"#" { // see bug 594021 for a usecase for this rule
1777 if (yyextra->lastCContext==SkipCPPBlock)
1778 {
1779 BEGIN(SkipCommand);
1780 }
1781 else
1782 {
1783 REJECT;
1784 }
1785 }
1786<RemoveCComment>{CCE} { BEGIN(yyextra->lastCContext); }
1787<RemoveCComment>{CPPC}
1788<RemoveCComment>{CCS}
1789<RemoveCComment>[^*\x06\n]+
1790<RemoveCComment>\n { yyextra->yyLineNr++; outputChar(yyscanner,'\n'); }
1791<RemoveCComment>.
1792<SkipCPPComment>[^\n\/\\@]+ {
1794 }
1795<SkipCPPComment,RemoveCPPComment>\n {
1796 unput(*yytext);
1797 BEGIN(yyextra->lastCPPContext);
1798 }
1799<SkipCPPComment>{CCS} {
1801 }
1802<SkipCPPComment>{CPPC} {
1804 }
1805<SkipCPPComment>[^\x06\@\\\n]+ {
1807 }
1808<SkipCPPComment>. {
1810 }
1811<RemoveCPPComment>{CCS}
1812<RemoveCPPComment>{CPPC}
1813<RemoveCPPComment>[^\x06\n]+
1814<RemoveCPPComment>.
1815<DefineText>"#"/{IDSTART} {
1817 yyextra->quoteArg=
TRUE;
1818 yyextra->idStart=true;
1819 yyextra->defLitText+=yytext;
1820 }
1821<DefineText,CopyCComment>{ID} {
1822 yyextra->defLitText+=yytext;
1823 if (YY_START == DefineText)
outputSpaces(yyscanner,yytext);
1824 if (yyextra->quoteArg)
1825 {
1826 yyextra->defText+="\"";
1827 }
1828 if (yyextra->defArgs>0)
1829 {
1830 auto it = yyextra->argMap.find(yytext);
1831 if (it!=yyextra->argMap.end())
1832 {
1833 int n = it->second;
1834 yyextra->defText+='@';
1836 }
1837 else
1838 {
1839 if (yyextra->idStart)
1840 {
1841 warn(yyextra->fileName,yyextra->yyLineNr,
1842 "'#' is not followed by a macro parameter '{}': '{}'",
1843 yyextra->defName,yyextra->defLitText.stripWhiteSpace());
1844 }
1845 yyextra->defText+=yytext;
1846 }
1847 }
1848 else
1849 {
1850 yyextra->defText+=yytext;
1851 }
1852 if (yyextra->quoteArg)
1853 {
1854 yyextra->defText+="\"";
1855 }
1856 yyextra->quoteArg=
FALSE;
1857 yyextra->idStart=false;
1858 }
1859<CopyCComment>. {
1860 yyextra->defLitText+=yytext;
1861 yyextra->defText+=yytext;
1862 }
1863<DefineText>\\[\r]?\n {
1864 yyextra->defLitText+=yytext;
1867 yyextra->defText += ' ';
1868 yyextra->yyLineNr++;
1869 yyextra->yyMLines++;
1870 }
1871<DefineText>\n {
1873 yyextra->defText = yyextra->defText.stripWhiteSpace();
1874 if (yyextra->defText.startsWith("##"))
1875 {
1876 warn(yyextra->fileName,yyextra->yyLineNr,
1877 "'##' cannot occur at the beginning of a macro definition '{}': '{}'",
1878 yyextra->defName,yyextra->defLitText.stripWhiteSpace());
1879 }
1880 else if (yyextra->defText.endsWith("##"))
1881 {
1882 warn(yyextra->fileName,yyextra->yyLineNr,
1883 "'##' cannot occur at the end of a macro definition '{}': '{}'",
1884 yyextra->defName,yyextra->defLitText.stripWhiteSpace());
1885 }
1886 else if (yyextra->defText.endsWith("#"))
1887 {
1888 warn(yyextra->fileName,yyextra->yyLineNr,
1889 "expected formal parameter after # in macro definition '{}': '{}'",
1890 yyextra->defName,yyextra->defLitText.stripWhiteSpace());
1891 }
1893 {
1895 yyextra->defLitText=yyextra->defLitText.left(yyextra->defLitText.length()-
comment.length()-1);
1896 }
1898 yyextra->defLitText+=yytext;
1900
1901 if (yyextra->includeStack.empty() || yyextra->curlyCount>0)
1902 {
1904 }
1905 def=
isDefined(yyscanner,yyextra->defName);
1906 if (def==0)
1907 {
1908
1910 }
1911 else if (def )
1912
1913 {
1914
1915
1917 {
1919 def->
name = yyextra->defName;
1921 def->
nargs = yyextra->defArgs;
1923 def->
lineNr = yyextra->yyLineNr-yyextra->yyMLines;
1925 }
1926 else
1927 {
1928 if (def->
fileName != yyextra->fileName && !yyextra->expandOnlyPredef)
addDefine(yyscanner);
1929
1930 }
1931 }
1932 yyextra->argMap.clear();
1933 yyextra->yyLineNr++;
1934 yyextra->yyColNr=1;
1935 yyextra->lastGuardName.clear();
1936 BEGIN(Start);
1937 }
static void addMacroDefinition(yyscan_t yyscanner)
static void addDefine(yyscan_t yyscanner)
static QCString extractTrailingComment(const QCString &s)
1938<DefineText>{B}* { outputString(yyscanner,yytext);
1939 yyextra->defText += ' ';
1940 yyextra->defLitText+=yytext;
1941 }
1942<DefineText>{B}*"##"{B}* { outputString(yyscanner,substitute(yytext,"##"," "));
1943 yyextra->defText += "##";
1944 yyextra->defLitText+=yytext;
1945 }
1946<DefineText>"@" { outputString(yyscanner,substitute(yytext,"@@"," "));
1947 yyextra->defText += "@@";
1948 yyextra->defLitText+=yytext;
1949 }
1950<DefineText>\" {
1952 yyextra->defText += *yytext;
1953 yyextra->defLitText+=yytext;
1954 if (!yyextra->insideComment)
1955 {
1956 BEGIN(SkipDoubleQuote);
1957 }
1958 }
1959<DefineText>\' {
1961 yyextra->defText += *yytext;
1962 yyextra->defLitText+=yytext;
1963 if (!yyextra->insideComment)
1964 {
1965 BEGIN(SkipSingleQuote);
1966 }
1967 }
1968<SkipDoubleQuote>{CPPC}[/]? { outputSpaces(yyscanner,yytext);
1969 yyextra->defText += yytext;
1970 yyextra->defLitText+=yytext;
1971 }
1972<SkipDoubleQuote>{CCS}[*]? { outputSpaces(yyscanner,yytext);
1973 yyextra->defText += yytext;
1974 yyextra->defLitText+=yytext;
1975 }
1976<SkipDoubleQuote>\" {
1978 yyextra->defText += *yytext;
1979 yyextra->defLitText+=yytext;
1980 BEGIN(DefineText);
1981 }
1982<SkipSingleQuote,SkipDoubleQuote>\\. {
1984 yyextra->defText += yytext;
1985 yyextra->defLitText+=yytext;
1986 }
1987<SkipSingleQuote>\' {
1989 yyextra->defText += *yytext;
1990 yyextra->defLitText+=yytext;
1991 BEGIN(DefineText);
1992 }
1993<SkipDoubleQuote,SkipSingleQuote>. { outputSpace(yyscanner,yytext[0]);
1994 yyextra->defText += *yytext;
1995 yyextra->defLitText += *yytext;
1996 }
1997<DefineText>. { outputSpace(yyscanner,yytext[0]);
1998 yyextra->defText += *yytext;
1999 yyextra->defLitText += *yytext;
2000 }
2001<<EOF>> {
2002 TRACE(
"End of include file");
2003
2004 if (yyextra->includeStack.empty())
2005 {
2006 TRACE(
"Terminating scanner");
2008 }
2009 else
2010 {
2011 QCString toFileName = yyextra->fileName;
2012 const std::unique_ptr<FileState> &fs=yyextra->includeStack.back();
2013
2014 YY_BUFFER_STATE oldBuf = YY_CURRENT_BUFFER;
2015 yy_switch_to_buffer( fs->bufState, yyscanner );
2016 yy_delete_buffer( oldBuf, yyscanner );
2017 yyextra->yyLineNr = fs->lineNr;
2018
2019 yyextra->inputBuf = fs->oldFileBuf;
2020 yyextra->inputBufPos = fs->oldFileBufPos;
2021 yyextra->curlyCount = fs->curlyCount;
2023 TRACE(
"switching to {}",yyextra->fileName);
2024
2025
2026
2028 lineStr.sprintf(
"# %d \"%s\" 2",yyextra->yyLineNr,
qPrint(yyextra->fileName));
2030
2031 yyextra->includeStack.pop_back();
2032
2033 {
2035
2036
2037
2038
2040 {
2041
2044 }
2045 else
2046 {
2048 {
2050 }
2051 }
2052 }
2053
2054 for (const auto &kv : yyextra->localDefines)
2055 {
2056 auto pair = yyextra->contextDefines.insert(kv);
2057 if (!pair.second)
2058 {
2059 yyextra->contextDefines.erase(pair.first);
2060 yyextra->contextDefines.insert(kv);
2061 }
2062 }
2063 yyextra->localDefines.clear();
2064 }
2065 }
2066<*>{CCS}/{CCE} |
2067<*>{CCS}[*!]? {
2068 if (YY_START==SkipVerbatim || YY_START == SkipCondVerbatim || YY_START==SkipCond || YY_START==IDLquote || YY_START == PragmaOnce)
2069 {
2070 REJECT;
2071 }
2072 else
2073 {
2075 yyextra->lastCContext=YY_START;
2076 yyextra->commentCount=1;
2077 if (yyleng==3)
2078 {
2079 yyextra->isSpecialComment = true;
2080 yyextra->lastGuardName.clear();
2081 }
2082 else
2083 {
2084 yyextra->isSpecialComment = false;
2085 }
2086 BEGIN(SkipCComment);
2087 }
2088 }
2089<*>{CPPC}[/!]? {
2090 if (YY_START==SkipVerbatim || YY_START == SkipCondVerbatim || YY_START==SkipCond ||
getLanguageFromFileName(yyextra->fileName)==SrcLangExt::Fortran || YY_START==IDLquote || YY_START == PragmaOnce)
2091 {
2092 REJECT;
2093 }
2094 else if (YY_START==RulesRoundDouble)
2095 {
2096 REJECT;
2097 }
2098 else
2099 {
2101 yyextra->lastCPPContext=YY_START;
2102 if (yyleng==3)
2103 {
2104 yyextra->isSpecialComment = true;
2105 yyextra->lastGuardName.clear();
2106 }
2107 else
2108 {
2109 yyextra->isSpecialComment = false;
2110 }
2111 BEGIN(SkipCPPComment);
2112 }
2113 }
2114<*>\n {
2116 yyextra->yyLineNr++;
2117 }
2118<*>. {
2119 yyextra->expectGuard =
FALSE;
2121 }
2122
2123%%