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} {
558 yyextra->delimiter = yytext+2;
559 yyextra->delimiter=yyextra->delimiter.left(yyextra->delimiter.length()-1);
561 BEGIN(CopyRawString);
562 }
563<CopyLine,LexCopyLine>"{" { // count brackets inside the main file
564 if (yyextra->includeStack.empty())
565 {
566 yyextra->curlyCount++;
567 }
569 }
570<LexCopyLine>^"%}" {
572 }
573<CopyLine,LexCopyLine>"}" { // count brackets inside the main file
574 if (yyextra->includeStack.empty() && yyextra->curlyCount>0)
575 {
576 yyextra->curlyCount--;
577 }
579 }
580<CopyLine,LexCopyLine>"'"\\[0-7]{1,3}"'" {
582 }
583<CopyLine,LexCopyLine>"'"\\."'" {
585 }
586<CopyLine,LexCopyLine>"'"."'" {
588 }
589<CopyLine,LexCopyLine>[$]?@\" {
592 BEGIN( CopyStringCs );
593 }
594<CopyLine,LexCopyLine>\" {
597 {
598 BEGIN( CopyString );
599 }
600 else
601 {
602 BEGIN( CopyStringFtnDouble );
603 }
604 }
605<CopyLine,LexCopyLine>\' {
608 BEGIN( CopyStringFtn );
609 }
610<CopyString>[^\"\\\r\n]+ {
612 }
613<CopyStringCs>[^\"\r\n]+ {
615 }
616<CopyStringCs>\"\" {
618 }
619<CopyString>\\. {
621 }
622<CopyString,CopyStringCs>\" {
624 BEGIN( CopyLine );
625 }
626<CopyStringFtnDouble>[^\"\\\r\n]+ {
628 }
629<CopyStringFtnDouble>\\. {
631 }
632<CopyStringFtnDouble>\" {
634 BEGIN( CopyLine );
635 }
636<CopyStringFtn>[^\'\\\r\n]+ {
638 }
639<CopyStringFtn>\\. {
641 }
642<CopyStringFtn>\' {
644 BEGIN( CopyLine );
645 }
646<CopyRawString>{RAWEND} {
649 delimiter=delimiter.
left(delimiter.
length()-1);
650 if (delimiter==yyextra->delimiter)
651 {
652 BEGIN( CopyLine );
653 }
654 }
655<CopyRawString>[^)]+ {
657 }
658<CopyRawString>. {
660 }
661<CopyLine,LexCopyLine>{ID}/{BN}{0,80}"(" {
662 yyextra->expectGuard =
FALSE;
664
665
666
667
668
669
670
671
672 if ((yyextra->includeStack.empty() || yyextra->curlyCount>0) &&
673 yyextra->macroExpansion &&
676 )
677 {
678
679 yyextra->roundCount=0;
680 yyextra->defArgsStr=yytext;
682 {
687 }
688 else
689 {
690 yyextra->findDefArgContext = CopyLine;
691 BEGIN(FindDefineArgs);
692 }
693 }
694 else
695 {
697 }
698 }
static QCString expandMacro(yyscan_t yyscanner, const QCString &name)
699<CopyLine>{RulesDelim} {
701 yyextra->lexRulesPart = !yyextra->lexRulesPart;
703 }
704
705<CopyLine>{RulesSharp} {
706 if (!yyextra->lexRulesPart) REJECT;
707 if (yyextra->curlyCount) REJECT;
709 BEGIN(RulesPattern);
710 }
711<RulesPattern>{EscapeRulesChar} {
713 }
714<RulesPattern>{RulesCurly} {
716 }
717<RulesPattern>{StartDouble} {
719 yyextra->lastContext = YY_START;
720 BEGIN(RulesDouble);
721 }
722<RulesDouble,RulesRoundDouble>"\\\\" {
724 }
725<RulesDouble,RulesRoundDouble>"\\\"" {
727 }
728<RulesDouble>"\"" {
730 BEGIN( yyextra->lastContext ) ;
731 }
732<RulesRoundDouble>"\"" {
734 BEGIN(RulesRound) ;
735 }
736<RulesDouble,RulesRoundDouble>. {
738 }
739<RulesPattern>{StartSquare} {
741 yyextra->lastContext = YY_START;
742 BEGIN(RulesSquare);
743 }
744<RulesSquare,RulesRoundSquare>{CHARCE} {
746 }
747<RulesSquare,RulesRoundSquare>"\\[" |
748<RulesSquare,RulesRoundSquare>"\\]" {
750 }
751<RulesSquare>"]" {
753 BEGIN(RulesPattern);
754 }
755<RulesRoundSquare>"]" {
757 BEGIN(RulesRound) ;
758 }
759<RulesSquare,RulesRoundSquare>"\\\\" {
761 }
762<RulesSquare,RulesRoundSquare>. {
764 }
765<RulesPattern>{StartRoundQuest} {
767 yyextra->lastContext = YY_START;
768 BEGIN(RulesRoundQuest);
769 }
770<RulesRoundQuest>{nl} {
772 }
773<RulesRoundQuest>[^)] {
775 }
776<RulesRoundQuest>")" {
778 BEGIN(yyextra->lastContext);
779 }
780<RulesPattern>{StartRound} {
781 yyextra->roundCount++;
783 yyextra->lastContext = YY_START;
784 BEGIN(RulesRound);
785 }
786<RulesRound>{RulesCurly} {
788 }
789<RulesRound>{StartSquare} {
791 BEGIN(RulesRoundSquare);
792 }
793<RulesRound>{StartDouble} {
795 BEGIN(RulesRoundDouble);
796 }
797<RulesRound>{EscapeRulesChar} {
799 }
800<RulesRound>"(" {
801 yyextra->roundCount++;
803 }
804<RulesRound>")" {
805 yyextra->roundCount--;
807 if (!yyextra->roundCount) BEGIN( yyextra->lastContext ) ;
808 }
809<RulesRound>{nl} {
811 }
812<RulesRound>{B} {
814 }
815<RulesRound>. {
817 }
818<RulesPattern>{B} {
820 BEGIN(CopyLine);
821 }
822<RulesPattern>. {
824 }
825
826<CopyLine,LexCopyLine>{ID} {
828 if ((yyextra->includeStack.empty() || yyextra->curlyCount>0) &&
829 yyextra->macroExpansion &&
833 )
834 {
839 }
840 else
841 {
843 }
844 }
845<CopyLine,LexCopyLine>"\\"\r?/\n { // strip line continuation characters
847 }
848<CopyLine,LexCopyLine>\\. {
850 }
851<CopyLine,LexCopyLine>. {
853 }
854<CopyLine,LexCopyLine>\n {
856 BEGIN(Start);
857 yyextra->yyLineNr++;
858 yyextra->yyColNr=1;
859 }
860<FindDefineArgs>"(" {
861 yyextra->defArgsStr+='(';
862 yyextra->roundCount++;
863 }
864<FindDefineArgs>")" {
865 yyextra->defArgsStr+=')';
866 yyextra->roundCount--;
867 if (yyextra->roundCount==0)
868 {
870
871 if (yyextra->findDefArgContext==CopyLine)
872 {
874 BEGIN(yyextra->findDefArgContext);
875 }
876 else
877 {
879 yyextra->nospaces=
FALSE;
880 BEGIN(Start);
881 }
882 }
883 }
884
static void readIncludeFile(yyscan_t yyscanner, const QCString &inc)
885<FindDefineArgs>")"{B}*"(" {
886 yyextra->defArgsStr+=yytext;
887 }
888 */
889<FindDefineArgs>{CHARLIT} {
890 yyextra->defArgsStr+=yytext;
891 }
892<FindDefineArgs>{CCS}[*]? {
893 yyextra->defArgsStr+=yytext;
894 BEGIN(ArgCopyCComment);
895 }
896<FindDefineArgs>{CPPC}[/!].*\n/{B}*{CPPC}[/!] { // replace multi line C++ style comment by C style comment
897 yyextra->defArgsStr+=
QCString(
"/**")+&yytext[3];
898 BEGIN(ArgCopyCppComment);
899 }
900<FindDefineArgs>{CPPC}[/!].*\n { // replace C++ single line style comment by C style comment
901 yyextra->defArgsStr+=
QCString(
"/**")+&yytext[3]+
" */";
902 }
903<FindDefineArgs>\" {
904 yyextra->defArgsStr+=*yytext;
905 BEGIN(ReadString);
906 }
907<FindDefineArgs>' {
909 yyextra->defArgsStr+=*yytext;
910 BEGIN(ReadString);
911 }
912<FindDefineArgs>\n {
913 yyextra->defArgsStr+=' ';
914 yyextra->yyLineNr++;
916 }
917<FindDefineArgs>"@" {
918 yyextra->defArgsStr+="@@";
919 }
920<FindDefineArgs>. {
921 yyextra->defArgsStr+=*yytext;
922 }
923<ArgCopyCComment>[^*\n]+ {
924 yyextra->defArgsStr+=yytext;
925 }
926<ArgCopyCComment>{CCE} {
927 yyextra->defArgsStr+=yytext;
928 BEGIN(FindDefineArgs);
929 }
930<ArgCopyCComment>\n {
931 yyextra->defArgsStr+=' ';
932 yyextra->yyLineNr++;
934 }
935<ArgCopyCComment>. {
936 yyextra->defArgsStr+=yytext;
937 }
938<ArgCopyCppComment>^{B}*
939<ArgCopyCppComment>{CPPC}[/!].*\n/{B}*{CPPC}[/!] { // replace multi line C++ style comment by C style comment
940 const char *startContent = &yytext[3];
941 if (startContent[0]=='<') startContent++;
942 yyextra->defArgsStr+=startContent;
943 }
944<ArgCopyCppComment>{CPPC}[/!].*\n { // replace C++ multie line style comment by C style comment
945 const char *startContent = &yytext[3];
946 if (startContent[0]=='<') startContent++;
947 yyextra->defArgsStr+=
QCString(startContent)+
" */";
948 BEGIN(FindDefineArgs);
949 }
950<ArgCopyCppComment>. { // unexpected character
951 unput(*yytext);
952 yyextra->defArgsStr+=" */";
953 BEGIN(FindDefineArgs);
954 }
955<ReadString>"\"" {
956 yyextra->defArgsStr+=*yytext;
957 BEGIN(FindDefineArgs);
958 }
959<ReadString>"'" {
961 yyextra->defArgsStr+=*yytext;
962 BEGIN(FindDefineArgs);
963 }
964
965<ReadString>{CPPC}|{CCS} {
966 yyextra->defArgsStr+=yytext;
967 }
968<ReadString>\\/\r?\n { // line continuation
969 }
970<ReadString>\\. {
971 yyextra->defArgsStr+=yytext;
972 }
973<ReadString>. {
974 yyextra->defArgsStr+=*yytext;
975 }
976<Command>("include"|"import"){B}+/{ID} {
977 yyextra->isImported = yytext[1]=='m';
978 if (yyextra->macroExpansion)
979 BEGIN(IncludeID);
980 }
981<Command>("include"|"import"){B}*[<"] {
982 yyextra->isImported = yytext[1]=='m';
983 char c[2];
984 c[0]=yytext[yyleng-1];c[1]='\0';
985 yyextra->incName=c;
986 BEGIN(Include);
987 }
988<Command>("cmake")?"define"{B}+ {
989 yyextra->potentialDefine +=
substitute(yytext,
"cmake",
" ");
990
991 yyextra->yyColNr+=(int)yyleng;
992 BEGIN(DefName);
993 }
QCString substitute(const QCString &s, const QCString &src, const QCString &dst)
substitute all occurrences of src in s by dst
994<Command>"cmakedefine01"{B}+ {
995 yyextra->potentialDefine +=
substitute(yytext,
"cmakedefine01",
" define ");
996
997 yyextra->yyColNr+=(int)yyleng;
998 BEGIN(CmakeDefName01);
999 }
1000<Command>"ifdef"/{B}*"(" {
1002 yyextra->guardExpr.clear();
1003 BEGIN(DefinedExpr2);
1004 }
static void incrLevel(yyscan_t yyscanner)
1005<Command>"ifdef"/{B}+ {
1006
1008 yyextra->guardExpr.clear();
1009 BEGIN(DefinedExpr1);
1010 }
1011<Command>"ifndef"/{B}*"(" {
1013 yyextra->guardExpr="! ";
1014 BEGIN(DefinedExpr2);
1015 }
1016<Command>"ifndef"/{B}+ {
1018 yyextra->guardExpr="! ";
1019 BEGIN(DefinedExpr1);
1020 }
1021<Command>"if"/[ \t(!] {
1023 yyextra->guardExpr.clear();
1024 BEGIN(Guard);
1025 }
1026<Command>("elif"|"else"{B}*"if")/[ \t(!] {
1028 {
1029 yyextra->guardExpr.clear();
1030 BEGIN(Guard);
1031 }
1032 else
1033 {
1034 yyextra->ifcount=0;
1035 BEGIN(SkipCPPBlock);
1036 }
1037 }
static bool otherCaseDone(yyscan_t yyscanner)
1038<Command>"else"/[^a-z_A-Z0-9\x80-\xFF] {
1040 {
1041 yyextra->ifcount=0;
1042 BEGIN(SkipCPPBlock);
1043 }
1044 else
1045 {
1047 }
1048 }
static void setCaseDone(yyscan_t yyscanner, bool value)
1049<Command>"undef"{B}+ {
1050 BEGIN(UndefName);
1051 }
1052<Command>("elif"|"else"{B}*"if")/[ \t(!] {
1054 {
1055 yyextra->guardExpr.clear();
1056 BEGIN(Guard);
1057 }
1058 }
1059<Command>"endif"/[^a-z_A-Z0-9\x80-\xFF] {
1060
1062 }
static void decrLevel(yyscan_t yyscanner)
1063<Command,IgnoreLine>\n {
1065 BEGIN(Start);
1066 yyextra->yyLineNr++;
1067 }
1068<Command>"pragma"{B}+"once" {
1069 yyextra->expectGuard =
FALSE;
1070 if (yyextra->pragmaSet.find(yyextra->fileName.str())!=yyextra->pragmaSet.end())
1071 {
1073 BEGIN(PragmaOnce);
1074 }
1075 else
1076 {
1077 yyextra->pragmaSet.insert(yyextra->fileName.data());
1078 }
1079 }
1080<PragmaOnce>. {}
1081<PragmaOnce>\n {}
1082<PragmaOnce><<EOF>> {
1083 yyextra->expectGuard =
FALSE;
1084 BEGIN(Start);
1085 }
1086<Command>{ID} { // unknown directive
1087 BEGIN(IgnoreLine);
1088 }
1089<IgnoreLine>\\[\r]?\n {
1091 yyextra->yyLineNr++;
1092 }
1093<IgnoreLine>.
1094<Command>. { yyextra->potentialDefine += yytext[0]=='\t' ? '\t' : ' ';
1095 yyextra->yyColNr+=(int)yyleng;
1096 }
1097<UndefName>{ID} {
1100
1102 )
1103 {
1104
1106 }
1107 BEGIN(Start);
1108 }
1109<Guard>\\[\r]?\n {
1111 yyextra->guardExpr+=' ';
1112 yyextra->yyLineNr++;
1113 }
1114<Guard>"defined"/{B}*"(" {
1115 BEGIN(DefinedExpr2);
1116 }
1117<Guard>"defined"/{B}+ {
1118 BEGIN(DefinedExpr1);
1119 }
1120<Guard>"true"/{B}|{B}*[\r]?\n { yyextra->guardExpr+="1L"; }
1121<Guard>"false"/{B}|{B}*[\r]?\n { yyextra->guardExpr+="0L"; }
1122<Guard>"not"/{B} { yyextra->guardExpr+='!'; }
1123<Guard>"not_eq"/{B} { yyextra->guardExpr+="!="; }
1124<Guard>"and"/{B} { yyextra->guardExpr+="&&"; }
1125<Guard>"or"/{B} { yyextra->guardExpr+="||"; }
1126<Guard>"bitand"/{B} { yyextra->guardExpr+="&"; }
1127<Guard>"bitor"/{B} { yyextra->guardExpr+="|"; }
1128<Guard>"xor"/{B} { yyextra->guardExpr+="^"; }
1129<Guard>"compl"/{B} { yyextra->guardExpr+="~"; }
1130<Guard>{ID} { yyextra->guardExpr+=yytext; }
1131<Guard>"@" { yyextra->guardExpr+="@@"; }
1132<Guard>. { yyextra->guardExpr+=*yytext; }
1133<Guard>\n {
1134 unput(*yytext);
1135
1136
1139 if (guard)
1140 {
1141 BEGIN(Start);
1142 }
1143 else
1144 {
1145 yyextra->ifcount=0;
1146 BEGIN(SkipCPPBlock);
1147 }
1148 }
static bool computeExpression(yyscan_t yyscanner, const QCString &expr)
1149<DefinedExpr1,DefinedExpr2>\\\n { yyextra->yyLineNr++; outputChar(yyscanner,'\n'); }
1150<DefinedExpr1>{ID} {
1151 if (
isDefined(yyscanner,yytext) || yyextra->guardName==yytext)
1152 yyextra->guardExpr+=" 1L ";
1153 else
1154 yyextra->guardExpr+=" 0L ";
1155 yyextra->lastGuardName=yytext;
1156 BEGIN(Guard);
1157 }
1158<DefinedExpr2>{ID} {
1159 if (
isDefined(yyscanner,yytext) || yyextra->guardName==yytext)
1160 yyextra->guardExpr+=" 1L ";
1161 else
1162 yyextra->guardExpr+=" 0L ";
1163 yyextra->lastGuardName=yytext;
1164 }
1165<DefinedExpr1,DefinedExpr2>\n { // should not happen, handle anyway
1166 yyextra->yyLineNr++;
1167 yyextra->ifcount=0;
1168 BEGIN(SkipCPPBlock);
1169 }
1170<DefinedExpr2>")" {
1171 BEGIN(Guard);
1172 }
1173<DefinedExpr1,DefinedExpr2>.
1174<SkipCPPBlock>^{B}*"#" { BEGIN(SkipCommand); }
1175<SkipCPPBlock>^{Bopt}/[^#] { BEGIN(SkipLine); }
1176<SkipCPPBlock>\n { yyextra->yyLineNr++; outputChar(yyscanner,'\n'); }
1177<SkipCPPBlock>.
1178<SkipCommand>"if"(("n")?("def"))?/[ \t(!] {
1180 yyextra->ifcount++;
1181
1182 }
1183<SkipCommand>"else" {
1184
1186 {
1188
1189 BEGIN(Start);
1190 }
1191 }
1192<SkipCommand>("elif"|"else"{B}*"if")/[ \t(!] {
1193 if (yyextra->ifcount==0)
1194 {
1196 {
1197 yyextra->guardExpr.clear();
1198 yyextra->lastGuardName.clear();
1199 BEGIN(Guard);
1200 }
1201 else
1202 {
1203 BEGIN(SkipCPPBlock);
1204 }
1205 }
1206 }
1207<SkipCommand>"endif" {
1208 yyextra->expectGuard =
FALSE;
1210 if (--yyextra->ifcount<0)
1211 {
1212
1213 BEGIN(Start);
1214 }
1215 }
1216<SkipCommand>\n {
1218 yyextra->yyLineNr++;
1219 BEGIN(SkipCPPBlock);
1220 }
1221<SkipCommand>{ID} { // unknown directive
1222 BEGIN(SkipLine);
1223 }
1224<SkipCommand>.
1225<SkipLine>[^'"/\n]+
1226<SkipLine>{CHARLIT} { }
1227<SkipLine>\" {
1228 BEGIN(SkipString);
1229 }
1230<SkipLine>.
1231<SkipString>{CPPC}/[^\n]* {
1232 }
1233<SkipLine,SkipCommand,SkipCPPBlock>{CPPC}[^\n]* {
1234 yyextra->lastCPPContext=YY_START;
1235 BEGIN(RemoveCPPComment);
1236 }
1237<SkipString>{CCS}/[^\n]* {
1238 }
1239<SkipLine,SkipCommand,SkipCPPBlock>{CCS}/[^\n]* {
1240 yyextra->lastCContext=YY_START;
1241 BEGIN(RemoveCComment);
1242 }
1243<SkipLine>\n {
1245 yyextra->yyLineNr++;
1246 BEGIN(SkipCPPBlock);
1247 }
1248<SkipString>[^"\\\n]+ { }
1249<SkipString>\\. { }
1250<SkipString>\" {
1251 BEGIN(SkipLine);
1252 }
1253<SkipString>. { }
1254<IncludeID>{ID}{Bopt}/"(" {
1255 yyextra->nospaces=
TRUE;
1256 yyextra->roundCount=0;
1257 yyextra->defArgsStr=yytext;
1258 yyextra->findDefArgContext = IncludeID;
1259 BEGIN(FindDefineArgs);
1260 }
1261<IncludeID>{ID} {
1262 yyextra->nospaces=
TRUE;
1264 BEGIN(Start);
1265 }
1266<Include>[^\">\n]+[\">] {
1267 yyextra->incName+=yytext;
1268 if (yyextra->isImported)
1269 {
1270 BEGIN(EndImport);
1271 }
1272 else
1273 {
1275 BEGIN(Start);
1276 }
1277 }
1278<EndImport>{ENDIMPORTopt}/\n {
1280 BEGIN(Start);
1281 }
1282<EndImport>\\[\r]?"\n" {
1284 yyextra->yyLineNr++;
1285 }
1286<EndImport>. {
1287 }
1288<DefName>{ID}/("\\\n")*"(" { // define with argument
1289
1290 yyextra->argMap.clear();
1291 yyextra->defArgs = 0;
1292 yyextra->defArgsStr.clear();
1293 yyextra->defText.clear();
1294 yyextra->defLitText.clear();
1295 yyextra->defName = yytext;
1296 yyextra->defVarArgs =
FALSE;
1297 yyextra->defExtraSpacing.clear();
1298 yyextra->defContinue = false;
1299 BEGIN(DefineArg);
1300 }
1301<DefName>{ID}{B}+"1"/[ \r\t\n] { // special case: define with 1 -> can be "guard"
1302
1303 yyextra->argMap.clear();
1304 yyextra->defArgs = -1;
1305 yyextra->defArgsStr.clear();
1307 yyextra->defVarArgs =
FALSE;
1308
1309
1310 if (yyextra->curlyCount>0 || yyextra->defName!=yyextra->lastGuardName || !yyextra->expectGuard)
1311 {
1312 QCString def = yyextra->potentialDefine +
1313 yyextra->defName ;
1315 outputSpaces(yyscanner,yytext+yyextra->defName.length());
1316 yyextra->quoteArg=
FALSE;
1317 yyextra->insideComment=
FALSE;
1318 yyextra->lastGuardName.clear();
1319 yyextra->defText="1";
1320 yyextra->defLitText="1";
1321 BEGIN(DefineText);
1322 }
1323 else
1324 {
1325
1326 yyextra->defText.clear();
1327 yyextra->defLitText.clear();
1328 BEGIN(Start);
1329 }
1330 yyextra->expectGuard=
FALSE;
1331 }
static void outputSpaces(yyscan_t yyscanner, char *s)
1332<DefName,CmakeDefName01>{ID}/{B}*"\n" { // empty define
1333 yyextra->argMap.clear();
1334 yyextra->defArgs = -1;
1335 yyextra->defName = yytext;
1336 yyextra->defArgsStr.clear();
1337 yyextra->defText.clear();
1338 yyextra->defLitText.clear();
1339 yyextra->defVarArgs =
FALSE;
1340
1341
1342 if (yyextra->curlyCount>0 || yyextra->defName!=yyextra->lastGuardName || !yyextra->expectGuard)
1343 {
1344 QCString def = yyextra->potentialDefine + yyextra->defName;
1346 yyextra->quoteArg=
FALSE;
1347 yyextra->insideComment=
FALSE;
1348 if (YY_START == CmakeDefName01) yyextra->defText = "0";
1349 else if (yyextra->insideCS) yyextra->defText="1";
1350 BEGIN(DefineText);
1351 }
1352 else
1353 {
1354
1355 yyextra->guardName = yytext;
1356 yyextra->lastGuardName.clear();
1357 BEGIN(Start);
1358 }
1359 yyextra->expectGuard=
FALSE;
1360 }
1361<DefName>{ID}/{B}* { // define with content
1362
1363 yyextra->argMap.clear();
1364 yyextra->defArgs = -1;
1365 yyextra->defArgsStr.clear();
1366 yyextra->defText.clear();
1367 yyextra->defLitText.clear();
1368 yyextra->defName = yytext;
1369 yyextra->defVarArgs =
FALSE;
1370 QCString def = yyextra->potentialDefine +
1371 yyextra->defName +
1372 yyextra->defArgsStr ;
1374 yyextra->quoteArg=
FALSE;
1375 yyextra->insideComment=
FALSE;
1376 BEGIN(DefineText);
1377 }
1378<DefineArg>"\\\n" {
1379 yyextra->defExtraSpacing+="\n";
1380 yyextra->defContinue = true;
1381 yyextra->yyLineNr++;
1382 }
1383<DefineArg>{B}* { yyextra->defExtraSpacing+=yytext; }
1384<DefineArg>","{B}* { yyextra->defArgsStr+=yytext; }
1385<DefineArg>"("{B}* { yyextra->defArgsStr+=yytext; }
1386<DefineArg>{B}*")"{B}* {
1388 yyextra->defArgsStr+=yytext;
1389 QCString def = yyextra->potentialDefine +
1390 yyextra->defName +
1391 yyextra->defArgsStr +
1392 yyextra->defExtraSpacing ;
1394 yyextra->quoteArg=
FALSE;
1395 yyextra->insideComment=
FALSE;
1396 BEGIN(DefineText);
1397 }
static void extraSpacing(yyscan_t yyscanner)
1398<DefineArg>"..." { // Variadic macro
1399 yyextra->defVarArgs =
TRUE;
1400 yyextra->defArgsStr+=yytext;
1401 yyextra->argMap.emplace(std::string("__VA_ARGS__"),yyextra->defArgs);
1402 yyextra->defArgs++;
1403 }
1404<DefineArg>{ID}{B}*("..."?) {
1405
1407 yyextra->defVarArgs = yytext[yyleng-1]=='.';
1408 if (yyextra->defVarArgs)
1409 {
1411 }
1413 yyextra->defArgsStr+=yytext;
1414 yyextra->argMap.emplace(
toStdString(argName),yyextra->defArgs);
1415 yyextra->defArgs++;
1417 }
1418
1419<DefineText>"/ **"|"/ *!" {
1420 yyextra->defText+=yytext;
1421 yyextra->defLitText+=yytext;
1422 yyextra->insideComment=
TRUE;
1423 }
1424<DefineText>"* /" {
1425 yyextra->defText+=yytext;
1426 yyextra->defLitText+=yytext;
1427 yyextra->insideComment=
FALSE;
1428 }
1429 */
1430<DefineText>{CCS}[!*]? {
1431 yyextra->defText+=yytext;
1432 yyextra->defLitText+=yytext;
1433 yyextra->lastCContext=YY_START;
1434 yyextra->commentCount=1;
1435 BEGIN(CopyCComment);
1436 }
1437<DefineText>{CPPC}[!/]? {
1439 yyextra->lastCPPContext=YY_START;
1440 yyextra->defLitText+=' ';
1441 BEGIN(SkipCPPComment);
1442 }
1443<SkipCComment>[/]?{CCE} {
1444 if (yytext[0]==
'/')
outputChar(yyscanner,
'/');
1446 if (--yyextra->commentCount<=0)
1447 {
1448 if (yyextra->lastCContext==Start)
1449
1450
1451 {
1452 YY_CURRENT_BUFFER->yy_at_bol=1;
1453 }
1454 BEGIN(yyextra->lastCContext);
1455 }
1456 }
1457<SkipCComment>{CPPC}("/")* {
1459 }
1460<SkipCComment>{CCS} {
1462
1463 }
1464<SkipCond>{CMD}{CMD} { }
1465<SkipCond>^({B}*"*"+)?{B}{0,3}"~~~"[~]* {
1467 if (!markdownSupport || !yyextra->isSpecialComment)
1468 {
1469 REJECT;
1470 }
1471 else
1472 {
1473 yyextra->fenceChar='~';
1475 BEGIN(SkipCondVerbatim);
1476 }
1477 }
static yy_size_t getFenceSize(char *txt, yy_size_t leng)
1478<SkipCond>^({B}*"*"+)?{B}{0,3}"```"[`]* {
1480 if (!markdownSupport || !yyextra->isSpecialComment)
1481 {
1482 REJECT;
1483 }
1484 else
1485 {
1486 yyextra->fenceChar='`';
1488 BEGIN(SkipCondVerbatim);
1489 }
1490 }
1491<SkipCComment>^({B}*"*"+)?{B}{0,3}"~~~"[~]* {
1493 if (!markdownSupport || !yyextra->isSpecialComment)
1494 {
1495 REJECT;
1496 }
1497 else
1498 {
1500 yyextra->fenceChar='~';
1502 BEGIN(SkipVerbatim);
1503 }
1504 }
1505<SkipCComment>^({B}*"*"+)?{B}{0,3}"```"[`]* {
1507 if (!markdownSupport || !yyextra->isSpecialComment)
1508 {
1509 REJECT;
1510 }
1511 else
1512 {
1514 yyextra->fenceChar='`';
1516 BEGIN(SkipVerbatim);
1517 }
1518 }
1519<SkipCComment>{CMD}{VERBATIM_LINE} |
1520<SkipCComment>{CMD}{LITERAL_BLOCK} { // escaped command
1523 }
1524<SkipCComment>{VERBATIM_LINE}.*/\n { // normal command
1526 }
1527<SkipCComment>{LITERAL_BLOCK} { // normal block command
1531 BEGIN(SkipVerbatim);
1532 }
static void determineBlockName(yyscan_t yyscanner)
1533<SkipCond>{CMD}{CMD}"cond"[ \t]+ {}// escaped cond command
1534<SkipCond>{CMD}"cond"/\n |
1535<SkipCond>{CMD}"cond"[ \t]+ { // cond command in a skipped cond section, this section has to be skipped as well
1536
1538 }
static void startCondSection(yyscan_t yyscanner, const QCString §Id)
1539<SkipCComment>"{"[ \t]*"@code"/[ \t\n] {
1541 yyextra->javaBlock=1;
1542 BEGIN(JavaDocVerbatimCode);
1543 }
1544<SkipCComment>"{"[ \t]*"@literal"/[ \t\n] {
1546 yyextra->javaBlock=1;
1547 BEGIN(JavaDocVerbatimCode);
1548 }
1549<SkipCComment,SkipCPPComment>{CMD}{CMD}"cond"[ \t\n]+ { // escaped cond command
1551 }
1552<SkipCPPComment>{CMD}"cond"[ \t]+ { // conditional section
1553 yyextra->ccomment=
TRUE;
1554 yyextra->condCtx=YY_START;
1555 BEGIN(CondLineCpp);
1556 }
1557<SkipCComment>{CMD}"cond"[ \t]+ { // conditional section
1558 yyextra->ccomment=
FALSE;
1559 yyextra->condCtx=YY_START;
1560 BEGIN(CondLineC);
1561 }
1562<CondLineC,CondLineCpp>[!()&| \ta-z_A-Z0-9\x80-\xFF.\-]+ {
1564 if (yyextra->skip)
1565 {
1566 if (YY_START==CondLineC)
1567 {
1568
1570 yyextra->ccomment=
TRUE;
1571 }
1572 else
1573 {
1574 yyextra->ccomment=
FALSE;
1575 }
1576 BEGIN(SkipCond);
1577 }
1578 else
1579 {
1580 BEGIN(yyextra->condCtx);
1581 }
1582 }
1583<CondLineC,CondLineCpp>. { // non-guard character
1584 unput(*yytext);
1586 if (yyextra->skip)
1587 {
1588 if (YY_START==CondLineC)
1589 {
1590
1592 yyextra->ccomment=
TRUE;
1593 }
1594 else
1595 {
1596 yyextra->ccomment=
FALSE;
1597 }
1598 BEGIN(SkipCond);
1599 }
1600 else
1601 {
1602 BEGIN(yyextra->condCtx);
1603 }
1604 }
1605<SkipCComment,SkipCPPComment>{CMD}"cond"{WSopt}/\n { // no guard
1606 if (YY_START==SkipCComment)
1607 {
1608 yyextra->ccomment=
TRUE;
1609
1611 }
1612 else
1613 {
1614 yyextra->ccomment=
FALSE;
1615 }
1616 yyextra->condCtx=YY_START;
1618 BEGIN(SkipCond);
1619 }
1620<SkipCond>\n { yyextra->yyLineNr++; outputChar(yyscanner,'\n'); }
1621<SkipCond>{VERBATIM_LINE}.*/\n { }
1622<SkipCond>{LITERAL_BLOCK} {
1624 yyextra->yyLineNr+=numNLs;
1625 for (
int i = 0; i < numNLs; i++)
outputChar(yyscanner,
'\n');
1627 BEGIN(SkipCondVerbatim);
1628 }
1629
1630<SkipCond>. { }
1631<SkipCond>[^\/\!*\\@\n]+ { }
1632<SkipCond>{CPPC}[/!] { yyextra->ccomment=FALSE; }
1633<SkipCond>{CCS}[*!] { yyextra->ccomment=TRUE; }
1634<SkipCond,SkipCComment,SkipCPPComment>{CMD}{CMD}"endcond"/[^a-z_A-Z0-9\x80-\xFF] {
1635 if (!yyextra->skip)
1636 {
1638 }
1639 }
1640<SkipCond>{CMD}"endcond"/[^a-z_A-Z0-9\x80-\xFF] {
1641 bool oldSkip = yyextra->skip;
1643 if (oldSkip && !yyextra->skip)
1644 {
1645 if (yyextra->ccomment)
1646 {
1648 }
1649 BEGIN(yyextra->condCtx);
1650 }
1651 }
static void endCondSection(yyscan_t yyscanner)
1652<SkipCComment,SkipCPPComment>{CMD}"endcond"/[^a-z_A-Z0-9\x80-\xFF] {
1653 bool oldSkip = yyextra->skip;
1655 if (oldSkip && !yyextra->skip)
1656 {
1657 BEGIN(yyextra->condCtx);
1658 }
1659 }
1660<SkipCondVerbatim>{LITERAL_BLOCK_END} { /* end of verbatim block */
1661 if (yytext[1]=='f' && yyextra->blockName==&yytext[2])
1662 {
1663 BEGIN(SkipCond);
1664 }
1665 else if (&yytext[4]==yyextra->blockName)
1666 {
1667 BEGIN(SkipCond);
1668 }
1669 }
1670<SkipVerbatim>{LITERAL_BLOCK_END} { /* end of verbatim block */
1672 if (yytext[1]=='f' && yyextra->blockName==&yytext[2])
1673 {
1674 BEGIN(SkipCComment);
1675 }
1676 else if (&yytext[4]==yyextra->blockName)
1677 {
1678 BEGIN(SkipCComment);
1679 }
1680 }
1681<SkipCondVerbatim>^({B}*"*"+)?{B}{0,3}"~~~"[~]* {
1682 if (yyextra->fenceSize==
getFenceSize(yytext,yyleng) && yyextra->fenceChar==
'~')
1683 {
1684 BEGIN(SkipCond);
1685 }
1686 }
1687<SkipCondVerbatim>^({B}*"*"+)?{B}{0,3}"```"[`]* {
1688 if (yyextra->fenceSize==
getFenceSize(yytext,yyleng) && yyextra->fenceChar==
'`')
1689 {
1690 BEGIN(SkipCond);
1691 }
1692 }
1693<SkipVerbatim>^({B}*"*"+)?{B}{0,3}"~~~"[~]* {
1695 if (yyextra->fenceSize==
getFenceSize(yytext,yyleng) && yyextra->fenceChar==
'~')
1696 {
1697 BEGIN(SkipCComment);
1698 }
1699 }
1700<SkipVerbatim>^({B}*"*"+)?{B}{0,3}"```"[`]* {
1702 if (yyextra->fenceSize==
getFenceSize(yytext,yyleng) && yyextra->fenceChar==
'`')
1703 {
1704 BEGIN(SkipCComment);
1705 }
1706 }
1707<SkipCondVerbatim>{CCE}|{CCS} { }
1708<SkipVerbatim>{CCE}|{CCS} {
1710 }
1711<JavaDocVerbatimCode>"{" {
1712 if (yyextra->javaBlock==0)
1713 {
1714 REJECT;
1715 }
1716 else
1717 {
1718 yyextra->javaBlock++;
1720 }
1721 }
1722<JavaDocVerbatimCode>"}" {
1723 if (yyextra->javaBlock==0)
1724 {
1725 REJECT;
1726 }
1727 else
1728 {
1729 yyextra->javaBlock--;
1730 if (yyextra->javaBlock==0)
1731 {
1733 BEGIN(SkipCComment);
1734 }
1735 else
1736 {
1738 }
1739 }
1740 }
1741<JavaDocVerbatimCode>\n { /* new line in verbatim block */
1743 }
1744<JavaDocVerbatimCode>. { /* any other character */
1746 }
1747<SkipCondVerbatim>[^{*\\@\x06~`\n\/]+ { }
1748<SkipCComment,SkipVerbatim>[^{*\\@\x06~`\n\/]+ {
1750 }
1751<SkipCComment,SkipVerbatim,SkipCondVerbatim>\n {
1752 yyextra->yyLineNr++;
1754 }
1755<SkipCondVerbatim>. { }
1756<SkipCComment,SkipVerbatim>. {
1758 }
1759<CopyCComment>[^*a-z_A-Z\x80-\xFF\n]*[^*a-z_A-Z\x80-\xFF\\\n] {
1760 yyextra->defLitText+=yytext;
1761 yyextra->defText+=
escapeAt(yytext);
1762 }
static QCString escapeAt(const QCString &text)
1763<CopyCComment>\\[\r]?\n {
1764 yyextra->defLitText+=yytext;
1765 yyextra->defText+=" ";
1766 yyextra->yyLineNr++;
1767 yyextra->yyMLines++;
1768 }
1769<CopyCComment>{CCE} {
1770 yyextra->defLitText+=yytext;
1771 yyextra->defText+=yytext;
1772 BEGIN(yyextra->lastCContext);
1773 }
1774<CopyCComment>\n {
1775 yyextra->yyLineNr++;
1776 yyextra->defLitText+=yytext;
1777 yyextra->defText+=' ';
1778 }
1779<RemoveCComment>{CCE}{B}*"#" { // see bug 594021 for a usecase for this rule
1780 if (yyextra->lastCContext==SkipCPPBlock)
1781 {
1782 BEGIN(SkipCommand);
1783 }
1784 else
1785 {
1786 REJECT;
1787 }
1788 }
1789<RemoveCComment>{CCE} { BEGIN(yyextra->lastCContext); }
1790<RemoveCComment>{CPPC}
1791<RemoveCComment>{CCS}
1792<RemoveCComment>[^*\x06\n]+
1793<RemoveCComment>\n { yyextra->yyLineNr++; outputChar(yyscanner,'\n'); }
1794<RemoveCComment>.
1795<SkipCPPComment>[^\n\/\\@]+ {
1797 }
1798<SkipCPPComment,RemoveCPPComment>\n {
1799 unput(*yytext);
1800 BEGIN(yyextra->lastCPPContext);
1801 }
1802<SkipCPPComment>{CCS} {
1804 }
1805<SkipCPPComment>{CPPC} {
1807 }
1808<SkipCPPComment>[^\x06\@\\\n]+ {
1810 }
1811<SkipCPPComment>. {
1813 }
1814<RemoveCPPComment>{CCS}
1815<RemoveCPPComment>{CPPC}
1816<RemoveCPPComment>[^\x06\n]+
1817<RemoveCPPComment>.
1818<DefineText>"#"/{IDSTART} {
1820 yyextra->quoteArg=
TRUE;
1821 yyextra->idStart=true;
1822 yyextra->defLitText+=yytext;
1823 }
1824<DefineText,CopyCComment>{ID} {
1825 yyextra->defLitText+=yytext;
1826 if (YY_START == DefineText)
outputSpaces(yyscanner,yytext);
1827 if (yyextra->quoteArg)
1828 {
1829 yyextra->defText+="\"";
1830 }
1831 if (yyextra->defArgs>0)
1832 {
1833 auto it = yyextra->argMap.find(yytext);
1834 if (it!=yyextra->argMap.end())
1835 {
1836 int n = it->second;
1837 yyextra->defText+='@';
1839 }
1840 else
1841 {
1842 if (yyextra->idStart)
1843 {
1844 warn(yyextra->fileName,yyextra->yyLineNr,
1845 "'#' is not followed by a macro parameter '{}': '{}'",
1846 yyextra->defName,yyextra->defLitText.stripWhiteSpace());
1847 }
1848 yyextra->defText+=yytext;
1849 }
1850 }
1851 else
1852 {
1853 yyextra->defText+=yytext;
1854 }
1855 if (yyextra->quoteArg)
1856 {
1857 yyextra->defText+="\"";
1858 }
1859 yyextra->quoteArg=
FALSE;
1860 yyextra->idStart=false;
1861 }
1862<CopyCComment>. {
1863 yyextra->defLitText+=yytext;
1864 yyextra->defText+=yytext;
1865 }
1866<DefineText>\\[\r]?\n {
1867 yyextra->defLitText+=yytext;
1870 yyextra->defText += ' ';
1871 yyextra->yyLineNr++;
1872 yyextra->yyMLines++;
1873 }
1874<DefineText>\n {
1876 yyextra->defText = yyextra->defText.stripWhiteSpace();
1877 if (yyextra->defText.startsWith("##"))
1878 {
1879 warn(yyextra->fileName,yyextra->yyLineNr,
1880 "'##' cannot occur at the beginning of a macro definition '{}': '{}'",
1881 yyextra->defName,yyextra->defLitText.stripWhiteSpace());
1882 }
1883 else if (yyextra->defText.endsWith("##"))
1884 {
1885 warn(yyextra->fileName,yyextra->yyLineNr,
1886 "'##' cannot occur at the end of a macro definition '{}': '{}'",
1887 yyextra->defName,yyextra->defLitText.stripWhiteSpace());
1888 }
1889 else if (yyextra->defText.endsWith("#"))
1890 {
1891 warn(yyextra->fileName,yyextra->yyLineNr,
1892 "expected formal parameter after # in macro definition '{}': '{}'",
1893 yyextra->defName,yyextra->defLitText.stripWhiteSpace());
1894 }
1896 {
1898 yyextra->defLitText=yyextra->defLitText.left(yyextra->defLitText.length()-
comment.length()-1);
1899 }
1901 yyextra->defLitText+=yytext;
1903
1904 if (yyextra->includeStack.empty() || yyextra->curlyCount>0)
1905 {
1907 }
1908 def=
isDefined(yyscanner,yyextra->defName);
1909 if (def==0)
1910 {
1911
1913 }
1914 else if (def )
1915
1916 {
1917
1918
1920 {
1922 def->
name = yyextra->defName;
1924 def->
nargs = yyextra->defArgs;
1926 def->
lineNr = yyextra->yyLineNr-yyextra->yyMLines;
1928 }
1929 else
1930 {
1931 if (def->
fileName != yyextra->fileName && !yyextra->expandOnlyPredef)
addDefine(yyscanner);
1932
1933 }
1934 }
1935 yyextra->argMap.clear();
1936 yyextra->yyLineNr++;
1937 yyextra->yyColNr=1;
1938 yyextra->lastGuardName.clear();
1939 BEGIN(Start);
1940 }
static void addMacroDefinition(yyscan_t yyscanner)
static void addDefine(yyscan_t yyscanner)
static QCString extractTrailingComment(const QCString &s)
1941<DefineText>{B}* { outputString(yyscanner,yytext);
1942 yyextra->defText += ' ';
1943 yyextra->defLitText+=yytext;
1944 }
1945<DefineText>{B}*"##"{B}* { outputString(yyscanner,substitute(yytext,"##"," "));
1946 yyextra->defText += "##";
1947 yyextra->defLitText+=yytext;
1948 }
1949<DefineText>"@" { outputString(yyscanner,substitute(yytext,"@@"," "));
1950 yyextra->defText += "@@";
1951 yyextra->defLitText+=yytext;
1952 }
1953<DefineText>\" {
1955 yyextra->defText += *yytext;
1956 yyextra->defLitText+=yytext;
1957 if (!yyextra->insideComment)
1958 {
1959 BEGIN(SkipDoubleQuote);
1960 }
1961 }
1962<DefineText>\' {
1964 yyextra->defText += *yytext;
1965 yyextra->defLitText+=yytext;
1966 if (!yyextra->insideComment)
1967 {
1968 BEGIN(SkipSingleQuote);
1969 }
1970 }
1971<SkipDoubleQuote>{CPPC}[/]? { outputSpaces(yyscanner,yytext);
1972 yyextra->defText += yytext;
1973 yyextra->defLitText+=yytext;
1974 }
1975<SkipDoubleQuote>{CCS}[*]? { outputSpaces(yyscanner,yytext);
1976 yyextra->defText += yytext;
1977 yyextra->defLitText+=yytext;
1978 }
1979<SkipDoubleQuote>\" {
1981 yyextra->defText += *yytext;
1982 yyextra->defLitText+=yytext;
1983 BEGIN(DefineText);
1984 }
1985<SkipSingleQuote,SkipDoubleQuote>\\. {
1987 yyextra->defText += yytext;
1988 yyextra->defLitText+=yytext;
1989 }
1990<SkipSingleQuote>\' {
1992 yyextra->defText += *yytext;
1993 yyextra->defLitText+=yytext;
1994 BEGIN(DefineText);
1995 }
1996<SkipDoubleQuote,SkipSingleQuote>. { outputSpace(yyscanner,yytext[0]);
1997 yyextra->defText += *yytext;
1998 yyextra->defLitText += *yytext;
1999 }
2000<DefineText>. { outputSpace(yyscanner,yytext[0]);
2001 yyextra->defText += *yytext;
2002 yyextra->defLitText += *yytext;
2003 }
2004<<EOF>> {
2005 TRACE(
"End of include file");
2006
2007 if (yyextra->includeStack.empty())
2008 {
2009 TRACE(
"Terminating scanner");
2011 }
2012 else
2013 {
2014 QCString toFileName = yyextra->fileName;
2015 const std::unique_ptr<FileState> &fs=yyextra->includeStack.back();
2016
2017 YY_BUFFER_STATE oldBuf = YY_CURRENT_BUFFER;
2018 yy_switch_to_buffer( fs->bufState, yyscanner );
2019 yy_delete_buffer( oldBuf, yyscanner );
2020 yyextra->yyLineNr = fs->lineNr;
2021
2022 yyextra->inputBuf = fs->oldFileBuf;
2023 yyextra->inputBufPos = fs->oldFileBufPos;
2024 yyextra->curlyCount = fs->curlyCount;
2026 TRACE(
"switching to {}",yyextra->fileName);
2027
2028
2029
2031 lineStr.sprintf(
"# %d \"%s\" 2",yyextra->yyLineNr,
qPrint(yyextra->fileName));
2033
2034 yyextra->includeStack.pop_back();
2035
2036 {
2038
2039
2040
2041
2043 {
2044
2047 }
2048 else
2049 {
2051 {
2053 }
2054 }
2055 }
2056
2057 for (const auto &kv : yyextra->localDefines)
2058 {
2059 auto pair = yyextra->contextDefines.insert(kv);
2060 if (!pair.second)
2061 {
2062 yyextra->contextDefines.erase(pair.first);
2063 yyextra->contextDefines.insert(kv);
2064 }
2065 }
2066 yyextra->localDefines.clear();
2067 }
2068 }
2069<*>{CCS}/{CCE} |
2070<*>{CCS}[*!]? {
2071 if (YY_START==SkipVerbatim || YY_START == SkipCondVerbatim || YY_START==SkipCond || YY_START==IDLquote || YY_START == PragmaOnce)
2072 {
2073 REJECT;
2074 }
2075 else
2076 {
2078 yyextra->lastCContext=YY_START;
2079 yyextra->commentCount=1;
2080 if (yyleng==3)
2081 {
2082 yyextra->isSpecialComment = true;
2083 yyextra->lastGuardName.clear();
2084 }
2085 else
2086 {
2087 yyextra->isSpecialComment = false;
2088 }
2089 BEGIN(SkipCComment);
2090 }
2091 }
2092<*>{CPPC}[/!]? {
2093 if (YY_START==SkipVerbatim || YY_START == SkipCondVerbatim || YY_START==SkipCond ||
getLanguageFromFileName(yyextra->fileName)==SrcLangExt::Fortran || YY_START==IDLquote || YY_START == PragmaOnce)
2094 {
2095 REJECT;
2096 }
2097 else if (YY_START==RulesRoundDouble)
2098 {
2099 REJECT;
2100 }
2101 else
2102 {
2104 yyextra->lastCPPContext=YY_START;
2105 if (yyleng==3)
2106 {
2107 yyextra->isSpecialComment = true;
2108 yyextra->lastGuardName.clear();
2109 }
2110 else
2111 {
2112 yyextra->isSpecialComment = false;
2113 }
2114 BEGIN(SkipCPPComment);
2115 }
2116 }
2117<*>\n {
2119 yyextra->yyLineNr++;
2120 }
2121<*>. {
2122 yyextra->expectGuard =
FALSE;
2124 }
2125
2126%%