459 {
461 }
static char resolveTrigraph(char c)
462<Start>^{B}*"#" {
463 yyextra->yyColNr+=(int)yyleng;
464 yyextra->yyMLines=0;
465 yyextra->potentialDefine=yytext;
466 BEGIN(Command);
467 }
468<Start>^("%top{"|"%{") {
471 BEGIN(LexCopyLine);
472 }
static void outputArray(yyscan_t yyscanner, const char *a, yy_size_t len)
473<Start>^{Bopt}"cpp_quote"{Bopt}"("{Bopt}\" {
474 if (yyextra->insideIDL)
475 {
476 BEGIN(IDLquote);
477 }
478 else
479 {
480 REJECT;
481 }
482 }
483<IDLquote>"\\\\" {
485 }
486<IDLquote>"\\\"" {
488 }
489<IDLquote>"\""{Bopt}")" {
490 BEGIN(Start);
491 }
492<IDLquote>\n {
494 yyextra->yyLineNr++;
495 }
496<IDLquote>. {
498 }
499<Start>^{Bopt}/[^#] {
501 BEGIN(CopyLine);
502 }
503<Start>^{B}*[a-z_A-Z\x80-\xFF][a-z_A-Z0-9\x80-\xFF]+{B}*"("[^\)\n]*")"/{BN}{1,10}*[:{] { // constructors?
504 int i;
505 for (i=(int)yyleng-1;i>=0;i--)
506 {
507 unput(yytext[i]);
508 }
509 BEGIN(CopyLine);
510 }
511<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
512<Start>^{B}*[_A-Z][_A-Z0-9]+{B}*"("[^\)\n]*")"{B}*\n | // function like macro
513<Start>^{B}*[_A-Z][_A-Z0-9]+{B}*"("[^\(\)\n]*"("[^\)\n]*")"[^\)\n]*")"/{B}*("//"|"/\*") | // function list macro with one (...) argument followed by comment
514<Start>^{B}*[_A-Z][_A-Z0-9]+{B}*"("[^\)\n]*")"/{B}*("//"|"/\*") { // function like macro followed by comment
517 int pos = name.find('(');
518 if (pos<0) pos=0;
519 name=name.left(pos).stripWhiteSpace();
#define Config_getBool(name)
520
522 if (skipFuncMacros && !yyextra->insideFtn &&
523 name!="Q_PROPERTY" &&
524 !(
525 (yyextra->includeStack.empty() || yyextra->curlyCount>0) &&
526 yyextra->macroExpansion &&
528
530 )
531 )
532 {
533
534 if (yytext[yyleng-1] == '\n')
535 {
537 yyextra->yyLineNr++;
538 }
539 }
540 else
541 {
542 int i;
543 for (i=(int)yyleng-1;i>=0;i--)
544 {
545 unput(yytext[i]);
546 }
547 BEGIN(CopyLine);
548 }
549 }
550<CopyLine,LexCopyLine>"extern"{BN}*"\""[^\"]+"\""{BN}*("{")? {
552 yyextra->yyLineNr+=text.
contains(
'\n');
554 }
555<CopyLine,LexCopyLine>{RAWBEGIN} {
556 yyextra->delimiter = yytext+2;
557 yyextra->delimiter=yyextra->delimiter.left(yyextra->delimiter.length()-1);
559 BEGIN(CopyRawString);
560 }
561<CopyLine,LexCopyLine>"{" { // count brackets inside the main file
562 if (yyextra->includeStack.empty())
563 {
564 yyextra->curlyCount++;
565 }
567 }
568<LexCopyLine>^"%}" {
570 }
571<CopyLine,LexCopyLine>"}" { // count brackets inside the main file
572 if (yyextra->includeStack.empty() && yyextra->curlyCount>0)
573 {
574 yyextra->curlyCount--;
575 }
577 }
578<CopyLine,LexCopyLine>"'"\\[0-7]{1,3}"'" {
580 }
581<CopyLine,LexCopyLine>"'"\\."'" {
583 }
584<CopyLine,LexCopyLine>"'"."'" {
586 }
587<CopyLine,LexCopyLine>[$]?@\" {
590 BEGIN( CopyStringCs );
591 }
592<CopyLine,LexCopyLine>\" {
595 {
596 BEGIN( CopyString );
597 }
598 else
599 {
600 BEGIN( CopyStringFtnDouble );
601 }
602 }
603<CopyLine,LexCopyLine>\' {
606 BEGIN( CopyStringFtn );
607 }
608<CopyString>[^\"\\\r\n]+ {
610 }
611<CopyStringCs>[^\"\r\n]+ {
613 }
614<CopyStringCs>\"\" {
616 }
617<CopyString>\\. {
619 }
620<CopyString,CopyStringCs>\" {
622 BEGIN( CopyLine );
623 }
624<CopyStringFtnDouble>[^\"\\\r\n]+ {
626 }
627<CopyStringFtnDouble>\\. {
629 }
630<CopyStringFtnDouble>\" {
632 BEGIN( CopyLine );
633 }
634<CopyStringFtn>[^\'\\\r\n]+ {
636 }
637<CopyStringFtn>\\. {
639 }
640<CopyStringFtn>\' {
642 BEGIN( CopyLine );
643 }
644<CopyRawString>{RAWEND} {
647 delimiter=delimiter.
left(delimiter.
length()-1);
648 if (delimiter==yyextra->delimiter)
649 {
650 BEGIN( CopyLine );
651 }
652 }
653<CopyRawString>[^)]+ {
655 }
656<CopyRawString>. {
658 }
659<CopyLine,LexCopyLine>{ID}/{BN}{0,80}"(" {
660 yyextra->expectGuard =
FALSE;
662
663
664
665
666
667
668
669
670 if ((yyextra->includeStack.empty() || yyextra->curlyCount>0) &&
671 yyextra->macroExpansion &&
674 )
675 {
676
677 yyextra->roundCount=0;
678 yyextra->defArgsStr=yytext;
680 {
685 }
686 else
687 {
688 yyextra->findDefArgContext = CopyLine;
689 BEGIN(FindDefineArgs);
690 }
691 }
692 else
693 {
695 }
696 }
static QCString expandMacro(yyscan_t yyscanner, const QCString &name)
697<CopyLine>{RulesDelim} {
699 yyextra->lexRulesPart = !yyextra->lexRulesPart;
701 }
702
703<CopyLine>{RulesSharp} {
704 if (!yyextra->lexRulesPart) REJECT;
705 if (yyextra->curlyCount) REJECT;
707 BEGIN(RulesPattern);
708 }
709<RulesPattern>{EscapeRulesChar} {
711 }
712<RulesPattern>{RulesCurly} {
714 }
715<RulesPattern>{StartDouble} {
717 yyextra->lastContext = YY_START;
718 BEGIN(RulesDouble);
719 }
720<RulesDouble,RulesRoundDouble>"\\\\" {
722 }
723<RulesDouble,RulesRoundDouble>"\\\"" {
725 }
726<RulesDouble>"\"" {
728 BEGIN( yyextra->lastContext ) ;
729 }
730<RulesRoundDouble>"\"" {
732 BEGIN(RulesRound) ;
733 }
734<RulesDouble,RulesRoundDouble>. {
736 }
737<RulesPattern>{StartSquare} {
739 yyextra->lastContext = YY_START;
740 BEGIN(RulesSquare);
741 }
742<RulesSquare,RulesRoundSquare>{CHARCE} {
744 }
745<RulesSquare,RulesRoundSquare>"\\[" |
746<RulesSquare,RulesRoundSquare>"\\]" {
748 }
749<RulesSquare>"]" {
751 BEGIN(RulesPattern);
752 }
753<RulesRoundSquare>"]" {
755 BEGIN(RulesRound) ;
756 }
757<RulesSquare,RulesRoundSquare>"\\\\" {
759 }
760<RulesSquare,RulesRoundSquare>. {
762 }
763<RulesPattern>{StartRoundQuest} {
765 yyextra->lastContext = YY_START;
766 BEGIN(RulesRoundQuest);
767 }
768<RulesRoundQuest>{nl} {
770 }
771<RulesRoundQuest>[^)] {
773 }
774<RulesRoundQuest>")" {
776 BEGIN(yyextra->lastContext);
777 }
778<RulesPattern>{StartRound} {
779 yyextra->roundCount++;
781 yyextra->lastContext = YY_START;
782 BEGIN(RulesRound);
783 }
784<RulesRound>{RulesCurly} {
786 }
787<RulesRound>{StartSquare} {
789 BEGIN(RulesRoundSquare);
790 }
791<RulesRound>{StartDouble} {
793 BEGIN(RulesRoundDouble);
794 }
795<RulesRound>{EscapeRulesChar} {
797 }
798<RulesRound>"(" {
799 yyextra->roundCount++;
801 }
802<RulesRound>")" {
803 yyextra->roundCount--;
805 if (!yyextra->roundCount) BEGIN( yyextra->lastContext ) ;
806 }
807<RulesRound>{nl} {
809 }
810<RulesRound>{B} {
812 }
813<RulesRound>. {
815 }
816<RulesPattern>{B} {
818 BEGIN(CopyLine);
819 }
820<RulesPattern>. {
822 }
823
824<CopyLine,LexCopyLine>{ID} {
826 if ((yyextra->includeStack.empty() || yyextra->curlyCount>0) &&
827 yyextra->macroExpansion &&
831 )
832 {
837 }
838 else
839 {
841 }
842 }
843<CopyLine,LexCopyLine>"\\"\r?/\n { // strip line continuation characters
845 }
846<CopyLine,LexCopyLine>\\. {
848 }
849<CopyLine,LexCopyLine>. {
851 }
852<CopyLine,LexCopyLine>\n {
854 BEGIN(Start);
855 yyextra->yyLineNr++;
856 yyextra->yyColNr=1;
857 }
858<FindDefineArgs>"(" {
859 yyextra->defArgsStr+='(';
860 yyextra->roundCount++;
861 }
862<FindDefineArgs>")" {
863 yyextra->defArgsStr+=')';
864 yyextra->roundCount--;
865 if (yyextra->roundCount==0)
866 {
868
869 if (yyextra->findDefArgContext==CopyLine)
870 {
872 BEGIN(yyextra->findDefArgContext);
873 }
874 else
875 {
877 yyextra->nospaces=
FALSE;
878 BEGIN(Start);
879 }
880 }
881 }
882
static void readIncludeFile(yyscan_t yyscanner, const QCString &inc)
883<FindDefineArgs>")"{B}*"(" {
884 yyextra->defArgsStr+=yytext;
885 }
886 */
887<FindDefineArgs>{CHARLIT} {
888 yyextra->defArgsStr+=yytext;
889 }
890<FindDefineArgs>{CCS}[*]? {
891 yyextra->defArgsStr+=yytext;
892 BEGIN(ArgCopyCComment);
893 }
894<FindDefineArgs>{CPPC}[/!].*\n/{B}*{CPPC}[/!] { // replace multi line C++ style comment by C style comment
895 yyextra->defArgsStr+=
QCString(
"/**")+&yytext[3];
896 BEGIN(ArgCopyCppComment);
897 }
898<FindDefineArgs>{CPPC}[/!].*\n { // replace C++ single line style comment by C style comment
899 yyextra->defArgsStr+=
QCString(
"/**")+&yytext[3]+
" */";
900 }
901<FindDefineArgs>\" {
902 yyextra->defArgsStr+=*yytext;
903 BEGIN(ReadString);
904 }
905<FindDefineArgs>' {
907 yyextra->defArgsStr+=*yytext;
908 BEGIN(ReadString);
909 }
910<FindDefineArgs>\n {
911 yyextra->defArgsStr+=' ';
912 yyextra->yyLineNr++;
914 }
915<FindDefineArgs>"@" {
916 yyextra->defArgsStr+="@@";
917 }
918<FindDefineArgs>. {
919 yyextra->defArgsStr+=*yytext;
920 }
921<ArgCopyCComment>[^*\n]+ {
922 yyextra->defArgsStr+=yytext;
923 }
924<ArgCopyCComment>{CCE} {
925 yyextra->defArgsStr+=yytext;
926 BEGIN(FindDefineArgs);
927 }
928<ArgCopyCComment>\n {
929 yyextra->defArgsStr+=' ';
930 yyextra->yyLineNr++;
932 }
933<ArgCopyCComment>. {
934 yyextra->defArgsStr+=yytext;
935 }
936<ArgCopyCppComment>^{B}*
937<ArgCopyCppComment>{CPPC}[/!].*\n/{B}*{CPPC}[/!] { // replace multi line C++ style comment by C style comment
938 const char *startContent = &yytext[3];
939 if (startContent[0]=='<') startContent++;
940 yyextra->defArgsStr+=startContent;
941 }
942<ArgCopyCppComment>{CPPC}[/!].*\n { // replace C++ multie line style comment by C style comment
943 const char *startContent = &yytext[3];
944 if (startContent[0]=='<') startContent++;
945 yyextra->defArgsStr+=
QCString(startContent)+
" */";
946 BEGIN(FindDefineArgs);
947 }
948<ArgCopyCppComment>. { // unexpected character
949 unput(*yytext);
950 yyextra->defArgsStr+=" */";
951 BEGIN(FindDefineArgs);
952 }
953<ReadString>"\"" {
954 yyextra->defArgsStr+=*yytext;
955 BEGIN(FindDefineArgs);
956 }
957<ReadString>"'" {
959 yyextra->defArgsStr+=*yytext;
960 BEGIN(FindDefineArgs);
961 }
962
963<ReadString>{CPPC}|{CCS} {
964 yyextra->defArgsStr+=yytext;
965 }
966<ReadString>\\/\r?\n { // line continuation
967 }
968<ReadString>\\. {
969 yyextra->defArgsStr+=yytext;
970 }
971<ReadString>. {
972 yyextra->defArgsStr+=*yytext;
973 }
974<Command>("include"|"import"){B}+/{ID} {
975 yyextra->isImported = yytext[1]=='m';
976 if (yyextra->macroExpansion)
977 BEGIN(IncludeID);
978 }
979<Command>("include"|"import"){B}*[<"] {
980 yyextra->isImported = yytext[1]=='m';
981 char c[2];
982 c[0]=yytext[yyleng-1];c[1]='\0';
983 yyextra->incName=c;
984 BEGIN(Include);
985 }
986<Command>("cmake")?"define"{B}+ {
987 yyextra->potentialDefine +=
substitute(yytext,
"cmake",
" ");
988
989 yyextra->yyColNr+=(int)yyleng;
990 BEGIN(DefName);
991 }
QCString substitute(const QCString &s, const QCString &src, const QCString &dst)
substitute all occurrences of src in s by dst
992<Command>"cmakedefine01"{B}+ {
993 yyextra->potentialDefine +=
substitute(yytext,
"cmakedefine01",
" define ");
994
995 yyextra->yyColNr+=(int)yyleng;
996 BEGIN(CmakeDefName01);
997 }
998<Command>"ifdef"/{B}*"(" {
1000 yyextra->guardExpr.clear();
1001 BEGIN(DefinedExpr2);
1002 }
static void incrLevel(yyscan_t yyscanner)
1003<Command>"ifdef"/{B}+ {
1004
1006 yyextra->guardExpr.clear();
1007 BEGIN(DefinedExpr1);
1008 }
1009<Command>"ifndef"/{B}*"(" {
1011 yyextra->guardExpr="! ";
1012 BEGIN(DefinedExpr2);
1013 }
1014<Command>"ifndef"/{B}+ {
1016 yyextra->guardExpr="! ";
1017 BEGIN(DefinedExpr1);
1018 }
1019<Command>"if"/[ \t(!] {
1021 yyextra->guardExpr.clear();
1022 BEGIN(Guard);
1023 }
1024<Command>("elif"|"else"{B}*"if")/[ \t(!] {
1026 {
1027 yyextra->guardExpr.clear();
1028 BEGIN(Guard);
1029 }
1030 else
1031 {
1032 yyextra->ifcount=0;
1033 BEGIN(SkipCPPBlock);
1034 }
1035 }
static bool otherCaseDone(yyscan_t yyscanner)
1036<Command>"else"/[^a-z_A-Z0-9\x80-\xFF] {
1038 {
1039 yyextra->ifcount=0;
1040 BEGIN(SkipCPPBlock);
1041 }
1042 else
1043 {
1045 }
1046 }
static void setCaseDone(yyscan_t yyscanner, bool value)
1047<Command>"undef"{B}+ {
1048 BEGIN(UndefName);
1049 }
1050<Command>("elif"|"else"{B}*"if")/[ \t(!] {
1052 {
1053 yyextra->guardExpr.clear();
1054 BEGIN(Guard);
1055 }
1056 }
1057<Command>"endif"/[^a-z_A-Z0-9\x80-\xFF] {
1058
1060 }
static void decrLevel(yyscan_t yyscanner)
1061<Command,IgnoreLine>\n {
1063 BEGIN(Start);
1064 yyextra->yyLineNr++;
1065 }
1066<Command>"pragma"{B}+"once" {
1067 yyextra->expectGuard =
FALSE;
1068 if (yyextra->pragmaSet.find(yyextra->fileName.str())!=yyextra->pragmaSet.end())
1069 {
1071 BEGIN(PragmaOnce);
1072 }
1073 else
1074 {
1075 yyextra->pragmaSet.insert(yyextra->fileName.data());
1076 }
1077 }
1078<PragmaOnce>. {}
1079<PragmaOnce>\n {}
1080<PragmaOnce><<EOF>> {
1081 yyextra->expectGuard =
FALSE;
1082 BEGIN(Start);
1083 }
1084<Command>{ID} { // unknown directive
1085 BEGIN(IgnoreLine);
1086 }
1087<IgnoreLine>\\[\r]?\n {
1089 yyextra->yyLineNr++;
1090 }
1091<IgnoreLine>.
1092<Command>. { yyextra->potentialDefine += yytext[0]=='\t' ? '\t' : ' ';
1093 yyextra->yyColNr+=(int)yyleng;
1094 }
1095<UndefName>{ID} {
1098
1100 )
1101 {
1102
1104 }
1105 BEGIN(Start);
1106 }
1107<Guard>\\[\r]?\n {
1109 yyextra->guardExpr+=' ';
1110 yyextra->yyLineNr++;
1111 }
1112<Guard>"defined"/{B}*"(" {
1113 BEGIN(DefinedExpr2);
1114 }
1115<Guard>"defined"/{B}+ {
1116 BEGIN(DefinedExpr1);
1117 }
1118<Guard>"true"/{B}|{B}*[\r]?\n { yyextra->guardExpr+="1L"; }
1119<Guard>"false"/{B}|{B}*[\r]?\n { yyextra->guardExpr+="0L"; }
1120<Guard>"not"/{B} { yyextra->guardExpr+='!'; }
1121<Guard>"not_eq"/{B} { yyextra->guardExpr+="!="; }
1122<Guard>"and"/{B} { yyextra->guardExpr+="&&"; }
1123<Guard>"or"/{B} { yyextra->guardExpr+="||"; }
1124<Guard>"bitand"/{B} { yyextra->guardExpr+="&"; }
1125<Guard>"bitor"/{B} { yyextra->guardExpr+="|"; }
1126<Guard>"xor"/{B} { yyextra->guardExpr+="^"; }
1127<Guard>"compl"/{B} { yyextra->guardExpr+="~"; }
1128<Guard>{ID} { yyextra->guardExpr+=yytext; }
1129<Guard>"@" { yyextra->guardExpr+="@@"; }
1130<Guard>. { yyextra->guardExpr+=*yytext; }
1131<Guard>\n {
1132 unput(*yytext);
1133
1134
1137 if (guard)
1138 {
1139 BEGIN(Start);
1140 }
1141 else
1142 {
1143 yyextra->ifcount=0;
1144 BEGIN(SkipCPPBlock);
1145 }
1146 }
static bool computeExpression(yyscan_t yyscanner, const QCString &expr)
1147<DefinedExpr1,DefinedExpr2>\\\n { yyextra->yyLineNr++; outputChar(yyscanner,'\n'); }
1148<DefinedExpr1>{ID} {
1149 if (
isDefined(yyscanner,yytext) || yyextra->guardName==yytext)
1150 yyextra->guardExpr+=" 1L ";
1151 else
1152 yyextra->guardExpr+=" 0L ";
1153 yyextra->lastGuardName=yytext;
1154 BEGIN(Guard);
1155 }
1156<DefinedExpr2>{ID} {
1157 if (
isDefined(yyscanner,yytext) || yyextra->guardName==yytext)
1158 yyextra->guardExpr+=" 1L ";
1159 else
1160 yyextra->guardExpr+=" 0L ";
1161 yyextra->lastGuardName=yytext;
1162 }
1163<DefinedExpr1,DefinedExpr2>\n { // should not happen, handle anyway
1164 yyextra->yyLineNr++;
1165 yyextra->ifcount=0;
1166 BEGIN(SkipCPPBlock);
1167 }
1168<DefinedExpr2>")" {
1169 BEGIN(Guard);
1170 }
1171<DefinedExpr1,DefinedExpr2>.
1172<SkipCPPBlock>^{B}*"#" { BEGIN(SkipCommand); }
1173<SkipCPPBlock>^{Bopt}/[^#] { BEGIN(SkipLine); }
1174<SkipCPPBlock>\n { yyextra->yyLineNr++; outputChar(yyscanner,'\n'); }
1175<SkipCPPBlock>.
1176<SkipCommand>"if"(("n")?("def"))?/[ \t(!] {
1178 yyextra->ifcount++;
1179
1180 }
1181<SkipCommand>"else" {
1182
1184 {
1186
1187 BEGIN(Start);
1188 }
1189 }
1190<SkipCommand>("elif"|"else"{B}*"if")/[ \t(!] {
1191 if (yyextra->ifcount==0)
1192 {
1194 {
1195 yyextra->guardExpr.clear();
1196 yyextra->lastGuardName.clear();
1197 BEGIN(Guard);
1198 }
1199 else
1200 {
1201 BEGIN(SkipCPPBlock);
1202 }
1203 }
1204 }
1205<SkipCommand>"endif" {
1206 yyextra->expectGuard =
FALSE;
1208 if (--yyextra->ifcount<0)
1209 {
1210
1211 BEGIN(Start);
1212 }
1213 }
1214<SkipCommand>\n {
1216 yyextra->yyLineNr++;
1217 BEGIN(SkipCPPBlock);
1218 }
1219<SkipCommand>{ID} { // unknown directive
1220 BEGIN(SkipLine);
1221 }
1222<SkipCommand>.
1223<SkipLine>[^'"/\n]+
1224<SkipLine>{CHARLIT} { }
1225<SkipLine>\" {
1226 BEGIN(SkipString);
1227 }
1228<SkipLine>.
1229<SkipString>{CPPC}/[^\n]* {
1230 }
1231<SkipLine,SkipCommand,SkipCPPBlock>{CPPC}[^\n]* {
1232 yyextra->lastCPPContext=YY_START;
1233 BEGIN(RemoveCPPComment);
1234 }
1235<SkipString>{CCS}/[^\n]* {
1236 }
1237<SkipLine,SkipCommand,SkipCPPBlock>{CCS}/[^\n]* {
1238 yyextra->lastCContext=YY_START;
1239 BEGIN(RemoveCComment);
1240 }
1241<SkipLine>\n {
1243 yyextra->yyLineNr++;
1244 BEGIN(SkipCPPBlock);
1245 }
1246<SkipString>[^"\\\n]+ { }
1247<SkipString>\\. { }
1248<SkipString>\" {
1249 BEGIN(SkipLine);
1250 }
1251<SkipString>. { }
1252<IncludeID>{ID}{Bopt}/"(" {
1253 yyextra->nospaces=
TRUE;
1254 yyextra->roundCount=0;
1255 yyextra->defArgsStr=yytext;
1256 yyextra->findDefArgContext = IncludeID;
1257 BEGIN(FindDefineArgs);
1258 }
1259<IncludeID>{ID} {
1260 yyextra->nospaces=
TRUE;
1262 BEGIN(Start);
1263 }
1264<Include>[^\">\n]+[\">] {
1265 yyextra->incName+=yytext;
1266 if (yyextra->isImported)
1267 {
1268 BEGIN(EndImport);
1269 }
1270 else
1271 {
1273 BEGIN(Start);
1274 }
1275 }
1276<EndImport>{ENDIMPORTopt}/\n {
1278 BEGIN(Start);
1279 }
1280<EndImport>\\[\r]?"\n" {
1282 yyextra->yyLineNr++;
1283 }
1284<EndImport>. {
1285 }
1286<DefName>{ID}/("\\\n")*"(" { // define with argument
1287
1288 yyextra->argMap.clear();
1289 yyextra->defArgs = 0;
1290 yyextra->defArgsStr.clear();
1291 yyextra->defText.clear();
1292 yyextra->defLitText.clear();
1293 yyextra->defName = yytext;
1294 yyextra->defVarArgs =
FALSE;
1295 yyextra->defExtraSpacing.clear();
1296 yyextra->defContinue = false;
1297 BEGIN(DefineArg);
1298 }
1299<DefName>{ID}{B}+"1"/[ \r\t\n] { // special case: define with 1 -> can be "guard"
1300
1301 yyextra->argMap.clear();
1302 yyextra->defArgs = -1;
1303 yyextra->defArgsStr.clear();
1305 yyextra->defVarArgs =
FALSE;
1306
1307
1308 if (yyextra->curlyCount>0 || yyextra->defName!=yyextra->lastGuardName || !yyextra->expectGuard)
1309 {
1310 QCString def = yyextra->potentialDefine +
1311 yyextra->defName ;
1313 outputSpaces(yyscanner,yytext+yyextra->defName.length());
1314 yyextra->quoteArg=
FALSE;
1315 yyextra->insideComment=
FALSE;
1316 yyextra->lastGuardName.clear();
1317 yyextra->defText="1";
1318 yyextra->defLitText="1";
1319 BEGIN(DefineText);
1320 }
1321 else
1322 {
1323
1324 yyextra->defText.clear();
1325 yyextra->defLitText.clear();
1326 BEGIN(Start);
1327 }
1328 yyextra->expectGuard=
FALSE;
1329 }
static void outputSpaces(yyscan_t yyscanner, char *s)
1330<DefName,CmakeDefName01>{ID}/{B}*"\n" { // empty define
1331 yyextra->argMap.clear();
1332 yyextra->defArgs = -1;
1333 yyextra->defName = yytext;
1334 yyextra->defArgsStr.clear();
1335 yyextra->defText.clear();
1336 yyextra->defLitText.clear();
1337 yyextra->defVarArgs =
FALSE;
1338
1339
1340 if (yyextra->curlyCount>0 || yyextra->defName!=yyextra->lastGuardName || !yyextra->expectGuard)
1341 {
1342 QCString def = yyextra->potentialDefine + yyextra->defName;
1344 yyextra->quoteArg=
FALSE;
1345 yyextra->insideComment=
FALSE;
1346 if (YY_START == CmakeDefName01) yyextra->defText = "0";
1347 else if (yyextra->insideCS) yyextra->defText="1";
1348 BEGIN(DefineText);
1349 }
1350 else
1351 {
1352
1353 yyextra->guardName = yytext;
1354 yyextra->lastGuardName.clear();
1355 BEGIN(Start);
1356 }
1357 yyextra->expectGuard=
FALSE;
1358 }
1359<DefName>{ID}/{B}* { // define with content
1360
1361 yyextra->argMap.clear();
1362 yyextra->defArgs = -1;
1363 yyextra->defArgsStr.clear();
1364 yyextra->defText.clear();
1365 yyextra->defLitText.clear();
1366 yyextra->defName = yytext;
1367 yyextra->defVarArgs =
FALSE;
1368 QCString def = yyextra->potentialDefine +
1369 yyextra->defName +
1370 yyextra->defArgsStr ;
1372 yyextra->quoteArg=
FALSE;
1373 yyextra->insideComment=
FALSE;
1374 BEGIN(DefineText);
1375 }
1376<DefineArg>"\\\n" {
1377 yyextra->defExtraSpacing+="\n";
1378 yyextra->defContinue = true;
1379 yyextra->yyLineNr++;
1380 }
1381<DefineArg>{B}* { yyextra->defExtraSpacing+=yytext; }
1382<DefineArg>","{B}* { yyextra->defArgsStr+=yytext; }
1383<DefineArg>"("{B}* { yyextra->defArgsStr+=yytext; }
1384<DefineArg>{B}*")"{B}* {
1386 yyextra->defArgsStr+=yytext;
1387 QCString def = yyextra->potentialDefine +
1388 yyextra->defName +
1389 yyextra->defArgsStr +
1390 yyextra->defExtraSpacing ;
1392 yyextra->quoteArg=
FALSE;
1393 yyextra->insideComment=
FALSE;
1394 BEGIN(DefineText);
1395 }
static void extraSpacing(yyscan_t yyscanner)
1396<DefineArg>"..." { // Variadic macro
1397 yyextra->defVarArgs =
TRUE;
1398 yyextra->defArgsStr+=yytext;
1399 yyextra->argMap.emplace(std::string("__VA_ARGS__"),yyextra->defArgs);
1400 yyextra->defArgs++;
1401 }
1402<DefineArg>{ID}{B}*("..."?) {
1403
1405 yyextra->defVarArgs = yytext[yyleng-1]=='.';
1406 if (yyextra->defVarArgs)
1407 {
1409 }
1411 yyextra->defArgsStr+=yytext;
1412 yyextra->argMap.emplace(
toStdString(argName),yyextra->defArgs);
1413 yyextra->defArgs++;
1415 }
1416
1417<DefineText>"/ **"|"/ *!" {
1418 yyextra->defText+=yytext;
1419 yyextra->defLitText+=yytext;
1420 yyextra->insideComment=
TRUE;
1421 }
1422<DefineText>"* /" {
1423 yyextra->defText+=yytext;
1424 yyextra->defLitText+=yytext;
1425 yyextra->insideComment=
FALSE;
1426 }
1427 */
1428<DefineText>{CCS}[!*]? {
1429 yyextra->defText+=yytext;
1430 yyextra->defLitText+=yytext;
1431 yyextra->lastCContext=YY_START;
1432 yyextra->commentCount=1;
1433 BEGIN(CopyCComment);
1434 }
1435<DefineText>{CPPC}[!/]? {
1437 yyextra->lastCPPContext=YY_START;
1438 yyextra->defLitText+=' ';
1439 BEGIN(SkipCPPComment);
1440 }
1441<SkipCComment>[/]?{CCE} {
1442 if (yytext[0]==
'/')
outputChar(yyscanner,
'/');
1444 if (--yyextra->commentCount<=0)
1445 {
1446 if (yyextra->lastCContext==Start)
1447
1448
1449 {
1450 YY_CURRENT_BUFFER->yy_at_bol=1;
1451 }
1452 BEGIN(yyextra->lastCContext);
1453 }
1454 }
1455<SkipCComment>{CPPC}("/")* {
1457 }
1458<SkipCComment>{CCS} {
1460
1461 }
1462<SkipCond>[\\@][\\@] { }
1463<SkipCond>^({B}*"*"+)?{B}{0,3}"~~~"[~]* {
1465 if (!markdownSupport || !yyextra->isSpecialComment)
1466 {
1467 REJECT;
1468 }
1469 else
1470 {
1471 yyextra->fenceChar='~';
1473 BEGIN(SkipCondVerbatim);
1474 }
1475 }
static yy_size_t getFenceSize(char *txt, yy_size_t leng)
1476<SkipCond>^({B}*"*"+)?{B}{0,3}"```"[`]* {
1478 if (!markdownSupport || !yyextra->isSpecialComment)
1479 {
1480 REJECT;
1481 }
1482 else
1483 {
1484 yyextra->fenceChar='`';
1486 BEGIN(SkipCondVerbatim);
1487 }
1488 }
1489<SkipCComment>^({B}*"*"+)?{B}{0,3}"~~~"[~]* {
1491 if (!markdownSupport || !yyextra->isSpecialComment)
1492 {
1493 REJECT;
1494 }
1495 else
1496 {
1498 yyextra->fenceChar='~';
1500 BEGIN(SkipVerbatim);
1501 }
1502 }
1503<SkipCComment>^({B}*"*"+)?{B}{0,3}"```"[`]* {
1505 if (!markdownSupport || !yyextra->isSpecialComment)
1506 {
1507 REJECT;
1508 }
1509 else
1510 {
1512 yyextra->fenceChar='`';
1514 BEGIN(SkipVerbatim);
1515 }
1516 }
1517<SkipCComment>[\\@]{VERBATIM_LINE} |
1518<SkipCComment>[\\@]{LITERAL_BLOCK} { // escaped command
1521 }
1522<SkipCComment>{VERBATIM_LINE}.*/\n { // normal command
1524 }
1525<SkipCComment>{LITERAL_BLOCK} { // normal block command
1529 BEGIN(SkipVerbatim);
1530 }
static void determineBlockName(yyscan_t yyscanner)
1531<SkipCond>[\\@][\\@]"cond"[ \t]+ {}// escaped cond command
1532<SkipCond>[\\@]"cond"/\n |
1533<SkipCond>[\\@]"cond"[ \t]+ { // cond command in a skipped cond section, this section has to be skipped as well
1534
1536 }
static void startCondSection(yyscan_t yyscanner, const QCString §Id)
1537<SkipCComment>"{"[ \t]*"@code"/[ \t\n] {
1539 yyextra->javaBlock=1;
1540 BEGIN(JavaDocVerbatimCode);
1541 }
1542<SkipCComment>"{"[ \t]*"@literal"/[ \t\n] {
1544 yyextra->javaBlock=1;
1545 BEGIN(JavaDocVerbatimCode);
1546 }
1547<SkipCComment,SkipCPPComment>[\\@][\\@]"cond"[ \t\n]+ { // escaped cond command
1549 }
1550<SkipCPPComment>[\\@]"cond"[ \t]+ { // conditional section
1551 yyextra->ccomment=
TRUE;
1552 yyextra->condCtx=YY_START;
1553 BEGIN(CondLineCpp);
1554 }
1555<SkipCComment>[\\@]"cond"[ \t]+ { // conditional section
1556 yyextra->ccomment=
FALSE;
1557 yyextra->condCtx=YY_START;
1558 BEGIN(CondLineC);
1559 }
1560<CondLineC,CondLineCpp>[!()&| \ta-z_A-Z0-9\x80-\xFF.\-]+ {
1562 if (yyextra->skip)
1563 {
1564 if (YY_START==CondLineC)
1565 {
1566
1568 yyextra->ccomment=
TRUE;
1569 }
1570 else
1571 {
1572 yyextra->ccomment=
FALSE;
1573 }
1574 BEGIN(SkipCond);
1575 }
1576 else
1577 {
1578 BEGIN(yyextra->condCtx);
1579 }
1580 }
1581<CondLineC,CondLineCpp>. { // non-guard character
1582 unput(*yytext);
1584 if (yyextra->skip)
1585 {
1586 if (YY_START==CondLineC)
1587 {
1588
1590 yyextra->ccomment=
TRUE;
1591 }
1592 else
1593 {
1594 yyextra->ccomment=
FALSE;
1595 }
1596 BEGIN(SkipCond);
1597 }
1598 else
1599 {
1600 BEGIN(yyextra->condCtx);
1601 }
1602 }
1603<SkipCComment,SkipCPPComment>[\\@]"cond"{WSopt}/\n { // no guard
1604 if (YY_START==SkipCComment)
1605 {
1606 yyextra->ccomment=
TRUE;
1607
1609 }
1610 else
1611 {
1612 yyextra->ccomment=
FALSE;
1613 }
1614 yyextra->condCtx=YY_START;
1616 BEGIN(SkipCond);
1617 }
1618<SkipCond>\n { yyextra->yyLineNr++; outputChar(yyscanner,'\n'); }
1619<SkipCond>{VERBATIM_LINE}.*/\n { }
1620<SkipCond>{LITERAL_BLOCK} {
1622 yyextra->yyLineNr+=numNLs;
1623 for (
int i = 0; i < numNLs; i++)
outputChar(yyscanner,
'\n');
1625 BEGIN(SkipCondVerbatim);
1626 }
1627
1628<SkipCond>. { }
1629<SkipCond>[^\/\!*\\@\n]+ { }
1630<SkipCond>{CPPC}[/!] { yyextra->ccomment=FALSE; }
1631<SkipCond>{CCS}[*!] { yyextra->ccomment=TRUE; }
1632<SkipCond,SkipCComment,SkipCPPComment>[\\@][\\@]"endcond"/[^a-z_A-Z0-9\x80-\xFF] {
1633 if (!yyextra->skip)
1634 {
1636 }
1637 }
1638<SkipCond>[\\@]"endcond"/[^a-z_A-Z0-9\x80-\xFF] {
1639 bool oldSkip = yyextra->skip;
1641 if (oldSkip && !yyextra->skip)
1642 {
1643 if (yyextra->ccomment)
1644 {
1646 }
1647 BEGIN(yyextra->condCtx);
1648 }
1649 }
static void endCondSection(yyscan_t yyscanner)
1650<SkipCComment,SkipCPPComment>[\\@]"endcond"/[^a-z_A-Z0-9\x80-\xFF] {
1651 bool oldSkip = yyextra->skip;
1653 if (oldSkip && !yyextra->skip)
1654 {
1655 BEGIN(yyextra->condCtx);
1656 }
1657 }
1658<SkipCondVerbatim>{LITERAL_BLOCK_END} { /* end of verbatim block */
1659 if (yytext[1]=='f' && yyextra->blockName==&yytext[2])
1660 {
1661 BEGIN(SkipCond);
1662 }
1663 else if (&yytext[4]==yyextra->blockName)
1664 {
1665 BEGIN(SkipCond);
1666 }
1667 }
1668<SkipVerbatim>{LITERAL_BLOCK_END} { /* end of verbatim block */
1670 if (yytext[1]=='f' && yyextra->blockName==&yytext[2])
1671 {
1672 BEGIN(SkipCComment);
1673 }
1674 else if (&yytext[4]==yyextra->blockName)
1675 {
1676 BEGIN(SkipCComment);
1677 }
1678 }
1679<SkipCondVerbatim>^({B}*"*"+)?{B}{0,3}"~~~"[~]* {
1680 if (yyextra->fenceSize==
getFenceSize(yytext,yyleng) && yyextra->fenceChar==
'~')
1681 {
1682 BEGIN(SkipCond);
1683 }
1684 }
1685<SkipCondVerbatim>^({B}*"*"+)?{B}{0,3}"```"[`]* {
1686 if (yyextra->fenceSize==
getFenceSize(yytext,yyleng) && yyextra->fenceChar==
'`')
1687 {
1688 BEGIN(SkipCond);
1689 }
1690 }
1691<SkipVerbatim>^({B}*"*"+)?{B}{0,3}"~~~"[~]* {
1693 if (yyextra->fenceSize==
getFenceSize(yytext,yyleng) && yyextra->fenceChar==
'~')
1694 {
1695 BEGIN(SkipCComment);
1696 }
1697 }
1698<SkipVerbatim>^({B}*"*"+)?{B}{0,3}"```"[`]* {
1700 if (yyextra->fenceSize==
getFenceSize(yytext,yyleng) && yyextra->fenceChar==
'`')
1701 {
1702 BEGIN(SkipCComment);
1703 }
1704 }
1705<SkipCondVerbatim>{CCE}|{CCS} { }
1706<SkipVerbatim>{CCE}|{CCS} {
1708 }
1709<JavaDocVerbatimCode>"{" {
1710 if (yyextra->javaBlock==0)
1711 {
1712 REJECT;
1713 }
1714 else
1715 {
1716 yyextra->javaBlock++;
1718 }
1719 }
1720<JavaDocVerbatimCode>"}" {
1721 if (yyextra->javaBlock==0)
1722 {
1723 REJECT;
1724 }
1725 else
1726 {
1727 yyextra->javaBlock--;
1728 if (yyextra->javaBlock==0)
1729 {
1731 BEGIN(SkipCComment);
1732 }
1733 else
1734 {
1736 }
1737 }
1738 }
1739<JavaDocVerbatimCode>\n { /* new line in verbatim block */
1741 }
1742<JavaDocVerbatimCode>. { /* any other character */
1744 }
1745<SkipCondVerbatim>[^{*\\@\x06~`\n\/]+ { }
1746<SkipCComment,SkipVerbatim>[^{*\\@\x06~`\n\/]+ {
1748 }
1749<SkipCComment,SkipVerbatim,SkipCondVerbatim>\n {
1750 yyextra->yyLineNr++;
1752 }
1753<SkipCondVerbatim>. { }
1754<SkipCComment,SkipVerbatim>. {
1756 }
1757<CopyCComment>[^*a-z_A-Z\x80-\xFF\n]*[^*a-z_A-Z\x80-\xFF\\\n] {
1758 yyextra->defLitText+=yytext;
1759 yyextra->defText+=
escapeAt(yytext);
1760 }
static QCString escapeAt(const QCString &text)
1761<CopyCComment>\\[\r]?\n {
1762 yyextra->defLitText+=yytext;
1763 yyextra->defText+=" ";
1764 yyextra->yyLineNr++;
1765 yyextra->yyMLines++;
1766 }
1767<CopyCComment>{CCE} {
1768 yyextra->defLitText+=yytext;
1769 yyextra->defText+=yytext;
1770 BEGIN(yyextra->lastCContext);
1771 }
1772<CopyCComment>\n {
1773 yyextra->yyLineNr++;
1774 yyextra->defLitText+=yytext;
1775 yyextra->defText+=' ';
1776 }
1777<RemoveCComment>{CCE}{B}*"#" { // see bug 594021 for a usecase for this rule
1778 if (yyextra->lastCContext==SkipCPPBlock)
1779 {
1780 BEGIN(SkipCommand);
1781 }
1782 else
1783 {
1784 REJECT;
1785 }
1786 }
1787<RemoveCComment>{CCE} { BEGIN(yyextra->lastCContext); }
1788<RemoveCComment>{CPPC}
1789<RemoveCComment>{CCS}
1790<RemoveCComment>[^*\x06\n]+
1791<RemoveCComment>\n { yyextra->yyLineNr++; outputChar(yyscanner,'\n'); }
1792<RemoveCComment>.
1793<SkipCPPComment>[^\n\/\\@]+ {
1795 }
1796<SkipCPPComment,RemoveCPPComment>\n {
1797 unput(*yytext);
1798 BEGIN(yyextra->lastCPPContext);
1799 }
1800<SkipCPPComment>{CCS} {
1802 }
1803<SkipCPPComment>{CPPC} {
1805 }
1806<SkipCPPComment>[^\x06\@\\\n]+ {
1808 }
1809<SkipCPPComment>. {
1811 }
1812<RemoveCPPComment>{CCS}
1813<RemoveCPPComment>{CPPC}
1814<RemoveCPPComment>[^\x06\n]+
1815<RemoveCPPComment>.
1816<DefineText>"#"/{IDSTART} {
1818 yyextra->quoteArg=
TRUE;
1819 yyextra->idStart=true;
1820 yyextra->defLitText+=yytext;
1821 }
1822<DefineText,CopyCComment>{ID} {
1823 yyextra->defLitText+=yytext;
1824 if (YY_START == DefineText)
outputSpaces(yyscanner,yytext);
1825 if (yyextra->quoteArg)
1826 {
1827 yyextra->defText+="\"";
1828 }
1829 if (yyextra->defArgs>0)
1830 {
1831 auto it = yyextra->argMap.find(yytext);
1832 if (it!=yyextra->argMap.end())
1833 {
1834 int n = it->second;
1835 yyextra->defText+='@';
1837 }
1838 else
1839 {
1840 if (yyextra->idStart)
1841 {
1842 warn(yyextra->fileName,yyextra->yyLineNr,
1843 "'#' is not followed by a macro parameter '%s': '%s'",
1844 qPrint(yyextra->defName),
qPrint(yyextra->defLitText.stripWhiteSpace()));
1845 }
1846 yyextra->defText+=yytext;
1847 }
1848 }
1849 else
1850 {
1851 yyextra->defText+=yytext;
1852 }
1853 if (yyextra->quoteArg)
1854 {
1855 yyextra->defText+="\"";
1856 }
1857 yyextra->quoteArg=
FALSE;
1858 yyextra->idStart=false;
1859 }
1860<CopyCComment>. {
1861 yyextra->defLitText+=yytext;
1862 yyextra->defText+=yytext;
1863 }
1864<DefineText>\\[\r]?\n {
1865 yyextra->defLitText+=yytext;
1868 yyextra->defText += ' ';
1869 yyextra->yyLineNr++;
1870 yyextra->yyMLines++;
1871 }
1872<DefineText>\n {
1874 yyextra->defText = yyextra->defText.stripWhiteSpace();
1875 if (yyextra->defText.startsWith("##"))
1876 {
1877 warn(yyextra->fileName,yyextra->yyLineNr,
1878 "'##' cannot occur at the beginning of a macro definition '%s': '%s'",
1879 qPrint(yyextra->defName),
qPrint(yyextra->defLitText.stripWhiteSpace()));
1880 }
1881 else if (yyextra->defText.endsWith("##"))
1882 {
1883 warn(yyextra->fileName,yyextra->yyLineNr,
1884 "'##' cannot occur at the end of a macro definition '%s': '%s'",
1885 qPrint(yyextra->defName),
qPrint(yyextra->defLitText.stripWhiteSpace()));
1886 }
1887 else if (yyextra->defText.endsWith("#"))
1888 {
1889 warn(yyextra->fileName,yyextra->yyLineNr,
1890 "expected formal parameter after # in macro definition '%s': '%s'",
1891 qPrint(yyextra->defName),
qPrint(yyextra->defLitText.stripWhiteSpace()));
1892 }
1894 {
1896 yyextra->defLitText=yyextra->defLitText.left(yyextra->defLitText.length()-
comment.length()-1);
1897 }
1899 yyextra->defLitText+=yytext;
1901
1902 if (yyextra->includeStack.empty() || yyextra->curlyCount>0)
1903 {
1905 }
1906 def=
isDefined(yyscanner,yyextra->defName);
1907 if (def==0)
1908 {
1909
1911 }
1912 else if (def )
1913
1914 {
1915
1916
1918 {
1920 def->
name = yyextra->defName;
1922 def->
nargs = yyextra->defArgs;
1924 def->
lineNr = yyextra->yyLineNr-yyextra->yyMLines;
1926 }
1927 else
1928 {
1930
1931 }
1932 }
1933 yyextra->argMap.clear();
1934 yyextra->yyLineNr++;
1935 yyextra->yyColNr=1;
1936 yyextra->lastGuardName.clear();
1937 BEGIN(Start);
1938 }
static void addMacroDefinition(yyscan_t yyscanner)
static void addDefine(yyscan_t yyscanner)
static QCString extractTrailingComment(const QCString &s)
1939<DefineText>{B}* { outputString(yyscanner,yytext);
1940 yyextra->defText += ' ';
1941 yyextra->defLitText+=yytext;
1942 }
1943<DefineText>{B}*"##"{B}* { outputString(yyscanner,substitute(yytext,"##"," "));
1944 yyextra->defText += "##";
1945 yyextra->defLitText+=yytext;
1946 }
1947<DefineText>"@" { outputString(yyscanner,substitute(yytext,"@@"," "));
1948 yyextra->defText += "@@";
1949 yyextra->defLitText+=yytext;
1950 }
1951<DefineText>\" {
1953 yyextra->defText += *yytext;
1954 yyextra->defLitText+=yytext;
1955 if (!yyextra->insideComment)
1956 {
1957 BEGIN(SkipDoubleQuote);
1958 }
1959 }
1960<DefineText>\' {
1962 yyextra->defText += *yytext;
1963 yyextra->defLitText+=yytext;
1964 if (!yyextra->insideComment)
1965 {
1966 BEGIN(SkipSingleQuote);
1967 }
1968 }
1969<SkipDoubleQuote>{CPPC}[/]? { outputSpaces(yyscanner,yytext);
1970 yyextra->defText += yytext;
1971 yyextra->defLitText+=yytext;
1972 }
1973<SkipDoubleQuote>{CCS}[*]? { outputSpaces(yyscanner,yytext);
1974 yyextra->defText += yytext;
1975 yyextra->defLitText+=yytext;
1976 }
1977<SkipDoubleQuote>\" {
1979 yyextra->defText += *yytext;
1980 yyextra->defLitText+=yytext;
1981 BEGIN(DefineText);
1982 }
1983<SkipSingleQuote,SkipDoubleQuote>\\. {
1985 yyextra->defText += yytext;
1986 yyextra->defLitText+=yytext;
1987 }
1988<SkipSingleQuote>\' {
1990 yyextra->defText += *yytext;
1991 yyextra->defLitText+=yytext;
1992 BEGIN(DefineText);
1993 }
1994<SkipDoubleQuote,SkipSingleQuote>. { outputSpace(yyscanner,yytext[0]);
1995 yyextra->defText += *yytext;
1996 yyextra->defLitText += *yytext;
1997 }
1998<DefineText>. { outputSpace(yyscanner,yytext[0]);
1999 yyextra->defText += *yytext;
2000 yyextra->defLitText += *yytext;
2001 }
2002<<EOF>> {
2003 TRACE(
"End of include file");
2004
2005 if (yyextra->includeStack.empty())
2006 {
2007 TRACE(
"Terminating scanner");
2009 }
2010 else
2011 {
2012 QCString toFileName = yyextra->fileName;
2013 const std::unique_ptr<FileState> &fs=yyextra->includeStack.back();
2014
2015 YY_BUFFER_STATE oldBuf = YY_CURRENT_BUFFER;
2016 yy_switch_to_buffer( fs->bufState, yyscanner );
2017 yy_delete_buffer( oldBuf, yyscanner );
2018 yyextra->yyLineNr = fs->lineNr;
2019
2020 yyextra->inputBuf = fs->oldFileBuf;
2021 yyextra->inputBufPos = fs->oldFileBufPos;
2022 yyextra->curlyCount = fs->curlyCount;
2024 TRACE(
"switching to {}",yyextra->fileName);
2025
2026
2027
2029 lineStr.sprintf(
"# %d \"%s\" 2",yyextra->yyLineNr,
qPrint(yyextra->fileName));
2031
2032 yyextra->includeStack.pop_back();
2033
2034 {
2036
2037
2038
2039
2041 {
2042
2045 }
2046 else
2047 {
2049 {
2051 }
2052 }
2053 }
2054
2055 for (const auto &kv : yyextra->localDefines)
2056 {
2057 auto pair = yyextra->contextDefines.insert(kv);
2058 if (!pair.second)
2059 {
2060 yyextra->contextDefines.erase(pair.first);
2061 yyextra->contextDefines.insert(kv);
2062 }
2063 }
2064 yyextra->localDefines.clear();
2065 }
2066 }
2067<*>{CCS}/{CCE} |
2068<*>{CCS}[*!]? {
2069 if (YY_START==SkipVerbatim || YY_START == SkipCondVerbatim || YY_START==SkipCond || YY_START==IDLquote || YY_START == PragmaOnce)
2070 {
2071 REJECT;
2072 }
2073 else
2074 {
2076 yyextra->lastCContext=YY_START;
2077 yyextra->commentCount=1;
2078 if (yyleng==3)
2079 {
2080 yyextra->isSpecialComment = true;
2081 yyextra->lastGuardName.clear();
2082 }
2083 else
2084 {
2085 yyextra->isSpecialComment = false;
2086 }
2087 BEGIN(SkipCComment);
2088 }
2089 }
2090<*>{CPPC}[/!]? {
2092 {
2093 REJECT;
2094 }
2095 else if (YY_START==RulesRoundDouble)
2096 {
2097 REJECT;
2098 }
2099 else
2100 {
2102 yyextra->lastCPPContext=YY_START;
2103 if (yyleng==3)
2104 {
2105 yyextra->isSpecialComment = true;
2106 yyextra->lastGuardName.clear();
2107 }
2108 else
2109 {
2110 yyextra->isSpecialComment = false;
2111 }
2112 BEGIN(SkipCPPComment);
2113 }
2114 }
2115<*>\n {
2117 yyextra->yyLineNr++;
2118 }
2119<*>. {
2120 yyextra->expectGuard =
FALSE;
2122 }
2123
2124%%