494 {
496 }
static char resolveTrigraph(char c)
497<Start>^{B}*"#" {
498 yyextra->yyColNr+=(int)yyleng;
499 yyextra->yyMLines=0;
500 yyextra->potentialDefine=yytext;
501 BEGIN(Command);
502 }
503<Start>^("%top{"|"%{") {
506 BEGIN(LexCopyLine);
507 }
static void outputArray(yyscan_t yyscanner, const char *a, yy_size_t len)
508<Start>^{Bopt}"cpp_quote"{Bopt}"("{Bopt}\" {
509 if (yyextra->insideIDL)
510 {
511 BEGIN(IDLquote);
512 }
513 else
514 {
515 REJECT;
516 }
517 }
518<IDLquote>"\\\\" {
520 }
521<IDLquote>"\\\"" {
523 }
524<IDLquote>"\""{Bopt}")" {
525 BEGIN(Start);
526 }
527<IDLquote>\n {
529 yyextra->yyLineNr++;
530 }
531<IDLquote>. {
533 }
534<Start>^{Bopt}/[^#] {
536 BEGIN(CopyLine);
537 }
538<Start>^{B}*[a-z_A-Z\x80-\xFF][a-z_A-Z0-9\x80-\xFF]+{B}*"("[^\)\n]*")"/{BN}{1,10}*[:{] { // constructors?
539 int i;
540 for (i=(int)yyleng-1;i>=0;i--)
541 {
542 unput(yytext[i]);
543 }
544 BEGIN(CopyLine);
545 }
546<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
547<Start>^{B}*[_A-Z][_A-Z0-9]+{B}*"("[^\)\n]*")"{B}*\n | // function like macro
548<Start>^{B}*[_A-Z][_A-Z0-9]+{B}*"("[^\(\)\n]*"("[^\)\n]*")"[^\)\n]*")"/{B}*("//"|"/\*") | // function list macro with one (...) argument followed by comment
549<Start>^{B}*[_A-Z][_A-Z0-9]+{B}*"("[^\)\n]*")"/{B}*("//"|"/\*") { // function like macro followed by comment
552 int pos = name.find('(');
553 if (pos<0) pos=0;
554 name=name.left(pos).stripWhiteSpace();
#define Config_getBool(name)
555
557 if (skipFuncMacros && !yyextra->insideFtn &&
558 name!="Q_PROPERTY" &&
559 !(
560 (yyextra->includeStack.empty() || yyextra->curlyCount>0) &&
561 yyextra->macroExpansion &&
563
565 )
566 )
567 {
568
569 if (yytext[yyleng-1] == '\n')
570 {
572 yyextra->yyLineNr++;
573 }
574 }
575 else
576 {
577 int i;
578 for (i=(int)yyleng-1;i>=0;i--)
579 {
580 unput(yytext[i]);
581 }
582 BEGIN(CopyLine);
583 }
584 }
585<CopyLine,LexCopyLine>"extern"{BN}*"\""[^\"]+"\""{BN}*("{")? {
587 yyextra->yyLineNr+=text.
contains(
'\n');
589 }
590<CopyLine,LexCopyLine>{RAWBEGIN} {
593 BEGIN(CopyRawString);
594 }
QCString extractBeginRawStringDelimiter(const char *rawStart)
595<CopyLine,LexCopyLine>"{" { // count brackets inside the main file
596 if (yyextra->includeStack.empty())
597 {
598 yyextra->curlyCount++;
599 }
601 }
602<LexCopyLine>^"%}" {
604 }
605<CopyLine,LexCopyLine>"}" { // count brackets inside the main file
606 if (yyextra->includeStack.empty() && yyextra->curlyCount>0)
607 {
608 yyextra->curlyCount--;
609 }
611 }
612<CopyLine,LexCopyLine>"'"\\[0-7]{1,3}"'" {
614 }
615<CopyLine,LexCopyLine>"'"\\."'" {
617 }
618<CopyLine,LexCopyLine>"'"."'" {
620 }
621<CopyLine,LexCopyLine>[$]?@\" {
624 BEGIN( CopyStringCs );
625 }
626<CopyLine,LexCopyLine>\" {
629 {
630 BEGIN( CopyString );
631 }
632 else
633 {
634 BEGIN( CopyStringFtnDouble );
635 }
636 }
637<CopyLine,LexCopyLine>\' {
640 BEGIN( CopyStringFtn );
641 }
642<CopyString>[^\"\\\r\n]{1,1000} {
644 }
645<CopyStringCs>[^\"\r\n]{1,1000} {
647 }
648<CopyStringCs>\"\" {
650 }
651<CopyString>\\. {
653 }
654<CopyString,CopyStringCs>\" {
656 BEGIN( CopyLine );
657 }
658<CopyStringFtnDouble>[^\"\\\r\n]{1,1000} {
660 }
661<CopyStringFtnDouble>\\. {
663 }
664<CopyStringFtnDouble>\" {
666 BEGIN( CopyLine );
667 }
668<CopyStringFtn>[^\'\\\r\n]{1,1000} {
670 }
671<CopyStringFtn>\\. {
673 }
674<CopyStringFtn>\' {
676 BEGIN( CopyLine );
677 }
678<CopyRawString>{RAWEND} {
681 {
682 BEGIN( CopyLine );
683 }
684 }
QCString extractEndRawStringDelimiter(const char *rawEnd)
685<CopyRawString>[^)]{1,1000} {
687 }
688<CopyRawString>. {
690 }
691<CopyLine,LexCopyLine>{ID}/{BN}{0,80}"(" {
692 yyextra->expectGuard = false;
694
695
696
697
698
699
700
701
702 if ((yyextra->includeStack.empty() || yyextra->curlyCount>0) &&
703 yyextra->macroExpansion &&
706 )
707 {
708
709 yyextra->roundCount=0;
710 yyextra->defArgsStr=yytext;
713 {
718 }
719 else
720 {
721 yyextra->findDefArgContext = CopyLine;
722 BEGIN(FindDefineArgs);
723 }
724 }
725 else
726 {
728 }
729 }
static QCString expandMacro(yyscan_t yyscanner, const QCString &name)
730<CopyLine>{RulesDelim} {
732 yyextra->lexRulesPart = !yyextra->lexRulesPart;
734 }
735
736<CopyLine>{RulesSharp} {
737 if (!yyextra->lexRulesPart) REJECT;
738 if (yyextra->curlyCount) REJECT;
740 BEGIN(RulesPattern);
741 }
742<RulesPattern>{EscapeRulesChar} {
744 }
745<RulesPattern>{RulesCurly} {
747 }
748<RulesPattern>{StartDouble} {
750 yyextra->lastContext = YY_START;
751 BEGIN(RulesDouble);
752 }
753<RulesDouble,RulesRoundDouble>"\\\\" {
755 }
756<RulesDouble,RulesRoundDouble>"\\\"" {
758 }
759<RulesDouble>"\"" {
761 BEGIN( yyextra->lastContext ) ;
762 }
763<RulesRoundDouble>"\"" {
765 BEGIN(RulesRound) ;
766 }
767<RulesDouble,RulesRoundDouble>. {
769 }
770<RulesPattern>{StartSquare} {
772 yyextra->lastContext = YY_START;
773 BEGIN(RulesSquare);
774 }
775<RulesSquare,RulesRoundSquare>{CHARCE} {
777 }
778<RulesSquare,RulesRoundSquare>"\\[" |
779<RulesSquare,RulesRoundSquare>"\\]" {
781 }
782<RulesSquare>"]" {
784 BEGIN(RulesPattern);
785 }
786<RulesRoundSquare>"]" {
788 BEGIN(RulesRound) ;
789 }
790<RulesSquare,RulesRoundSquare>"\\\\" {
792 }
793<RulesSquare,RulesRoundSquare>. {
795 }
796<RulesPattern>{StartRoundQuest} {
798 yyextra->lastContext = YY_START;
799 BEGIN(RulesRoundQuest);
800 }
801<RulesRoundQuest>{nl} {
803 }
804<RulesRoundQuest>[^)] {
806 }
807<RulesRoundQuest>")" {
809 BEGIN(yyextra->lastContext);
810 }
811<RulesPattern>{StartRound} {
812 yyextra->roundCount++;
814 yyextra->lastContext = YY_START;
815 BEGIN(RulesRound);
816 }
817<RulesRound>{RulesCurly} {
819 }
820<RulesRound>{StartSquare} {
822 BEGIN(RulesRoundSquare);
823 }
824<RulesRound>{StartDouble} {
826 BEGIN(RulesRoundDouble);
827 }
828<RulesRound>{EscapeRulesChar} {
830 }
831<RulesRound>"(" {
832 yyextra->roundCount++;
834 }
835<RulesRound>")" {
836 yyextra->roundCount--;
838 if (!yyextra->roundCount) BEGIN( yyextra->lastContext ) ;
839 }
840<RulesRound>{nl} {
842 }
843<RulesRound>{B} {
845 }
846<RulesRound>. {
848 }
849<RulesPattern>{B} {
851 BEGIN(CopyLine);
852 }
853<RulesPattern>. {
855 }
856
857<CopyLine,LexCopyLine>{ID} {
860 if ((yyextra->includeStack.empty() || yyextra->curlyCount>0) &&
861 yyextra->macroExpansion &&
865 )
866 {
871 }
873 {
875 }
876 else
877 {
879 }
880 }
881<CopyLine,LexCopyLine>"\\"\r?/\n { // strip line continuation characters
883 }
884<CopyLine,LexCopyLine>\\. {
886 }
887<CopyLine,LexCopyLine>. {
889 }
890<CopyLine,LexCopyLine>\n {
892 BEGIN(Start);
893 yyextra->yyLineNr++;
894 yyextra->yyColNr=1;
895 }
896<FindDefineArgs>"(" {
897 yyextra->defArgsStr+='(';
898 yyextra->roundCount++;
899 }
900<FindDefineArgs>")" {
901 yyextra->defArgsStr+=')';
902 yyextra->roundCount--;
903 if (yyextra->roundCount==0)
904 {
906
907 if (yyextra->findDefArgContext==CopyLine)
908 {
910 BEGIN(yyextra->findDefArgContext);
911 }
912 else
913 {
915 yyextra->nospaces=false;
916 BEGIN(Start);
917 }
918 }
919 }
920
static void readIncludeFile(yyscan_t yyscanner, const QCString &inc)
921<FindDefineArgs>")"{B}*"(" {
922 yyextra->defArgsStr+=yytext;
923 }
924 */
925<FindDefineArgs>{CHARLIT} {
926 yyextra->defArgsStr+=yytext;
927 }
928<FindDefineArgs>{CCS}[*!]? {
929 yyextra->defArgsStr+=yytext;
930 BEGIN(ArgCopyCComment);
931 }
932<FindDefineArgs>{CPPC}[/!].*\n/{B}*{CPPC}[/!] { // replace multi line C++ style comment by C style comment
934 {
935 if (yytext[3]=='<')
936 {
937 yyextra->defArgsStr+=
QCString(
"/**< @brief ")+&yytext[4];
938 }
939 else
940 {
941 yyextra->defArgsStr+=
QCString(
"/** @brief ")+&yytext[3];
942 }
943 }
944 else
945 {
946 yyextra->defArgsStr+=
QCString(
"/**")+&yytext[3];
947 }
948 BEGIN(ArgCopyCppComment);
949 }
950<FindDefineArgs>{CPPC}[/!].*\n { // replace C++ single line style comment by C style comment
952 {
953 yyextra->defArgsStr+=
QCString(
"/**")+&yytext[3]+
" */";
954 }
955 else
956 {
957 if (yytext[3]=='<')
958 {
959 yyextra->defArgsStr+=
QCString(
"/**< @brief ")+&yytext[4]+
" */";
960 }
961 else
962 {
963 yyextra->defArgsStr+=
QCString(
"/** @brief ")+&yytext[3]+
" */";
964 }
965 }
966 }
967<FindDefineArgs>{CPPC}.*\n { // replace C++ single line style comment by C style comment
969 yyextra->defArgsStr+=
QCString(
"/*")+&yytext[2]+
" */";
970 }
971<FindDefineArgs>\" {
972 yyextra->defArgsStr+=*yytext;
973 BEGIN(ReadString);
974 }
975<FindDefineArgs>' {
977 yyextra->defArgsStr+=*yytext;
978 BEGIN(ReadString);
979 }
980<FindDefineArgs>\n {
981 yyextra->defArgsStr+=' ';
982 yyextra->yyLineNr++;
984 }
985<FindDefineArgs>"@" {
986 yyextra->defArgsStr+="@@";
987 }
988<FindDefineArgs>. {
989 yyextra->defArgsStr+=*yytext;
990 }
991<ArgCopyCComment>[^*\n]+ {
992 yyextra->defArgsStr+=yytext;
993 }
994<ArgCopyCComment>{CCE} {
995 yyextra->defArgsStr+=yytext;
996 BEGIN(FindDefineArgs);
997 }
998<ArgCopyCComment>\n {
999 yyextra->defArgsStr+=yytext;
1000 yyextra->yyLineNr++;
1001 }
1002<ArgCopyCComment>. {
1003 yyextra->defArgsStr+=yytext;
1004 }
1005<ArgCopyCppComment>^{B}*
1006<ArgCopyCppComment>{CPPC}[/!].*\n/{B}*{CPPC}[/!] { // replace multi line C++ style comment by C style comment
1007 const char *startContent = &yytext[3];
1008 if (startContent[0]=='<') startContent++;
1009 yyextra->defArgsStr+=startContent;
1010 }
1011<ArgCopyCppComment>{CPPC}[/!].*\n { // replace C++ multie line style comment by C style comment
1012 const char *startContent = &yytext[3];
1013 if (startContent[0]=='<') startContent++;
1014 yyextra->defArgsStr+=
QCString(startContent)+
" */";
1015 BEGIN(FindDefineArgs);
1016 }
1017<ArgCopyCppComment>. { // unexpected character
1018 unput(*yytext);
1019 yyextra->defArgsStr+=" */";
1020 BEGIN(FindDefineArgs);
1021 }
1022<ReadString>"\"" {
1023 yyextra->defArgsStr+=*yytext;
1024 BEGIN(FindDefineArgs);
1025 }
1026<ReadString>"'" {
1028 yyextra->defArgsStr+=*yytext;
1029 BEGIN(FindDefineArgs);
1030 }
1031
1032<ReadString>{CPPC}|{CCS} {
1033 yyextra->defArgsStr+=yytext;
1034 }
1035<ReadString>\\/\r?\n { // line continuation
1036 }
1037<ReadString>\\. {
1038 yyextra->defArgsStr+=yytext;
1039 }
1040<ReadString>. {
1041 yyextra->defArgsStr+=*yytext;
1042 }
1043<Command>("include"|"import"){B}+/{ID} {
1044 yyextra->isImported = yytext[1]=='m';
1045 if (yyextra->macroExpansion)
1046 BEGIN(IncludeID);
1047 }
1048<Command>("include"|"import"){B}*[<"] {
1049 yyextra->isImported = yytext[1]=='m';
1050 char c[2];
1051 c[0]=yytext[yyleng-1];c[1]='\0';
1052 yyextra->incName=c;
1053 BEGIN(Include);
1054 }
1055<Command>("cmake")?"define"{B}+ {
1056 yyextra->potentialDefine +=
substitute(yytext,
"cmake",
" ");
1057
1058 yyextra->yyColNr+=(int)yyleng;
1059 BEGIN(DefName);
1060 }
QCString substitute(const QCString &s, const QCString &src, const QCString &dst)
substitute all occurrences of src in s by dst
1061<Command>"cmakedefine01"{B}+ {
1062 yyextra->potentialDefine +=
substitute(yytext,
"cmakedefine01",
" define ");
1063
1064 yyextra->yyColNr+=(int)yyleng;
1065 BEGIN(CmakeDefName01);
1066 }
1067<Command>"ifdef"/{B}*"(" {
1069 yyextra->guardExpr.clear();
1070 BEGIN(DefinedExpr2);
1071 }
static void incrLevel(yyscan_t yyscanner)
1072<Command>"ifdef"/{B}+ {
1073
1075 yyextra->guardExpr.clear();
1076 BEGIN(DefinedExpr1);
1077 }
1078<Command>"ifndef"/{B}*"(" {
1080 yyextra->guardExpr="! ";
1081 BEGIN(DefinedExpr2);
1082 }
1083<Command>"ifndef"/{B}+ {
1085 yyextra->guardExpr="! ";
1086 BEGIN(DefinedExpr1);
1087 }
1088<Command>"if"/[ \t(!] {
1090 yyextra->guardExpr.clear();
1091 BEGIN(Guard);
1092 }
1093<Command>("elif"|"else"{B}*"if")/[ \t(!] {
1095 {
1096 yyextra->guardExpr.clear();
1097 BEGIN(Guard);
1098 }
1099 else
1100 {
1101 yyextra->ifcount=0;
1102 BEGIN(SkipCPPBlock);
1103 }
1104 }
static bool otherCaseDone(yyscan_t yyscanner)
1105<Command>"else"/[^a-z_A-Z0-9\x80-\xFF] {
1107 {
1108 yyextra->ifcount=0;
1109 BEGIN(SkipCPPBlock);
1110 }
1111 else
1112 {
1114 }
1115 }
static void setCaseDone(yyscan_t yyscanner, bool value)
1116<Command>"undef"{B}+ {
1117 BEGIN(UndefName);
1118 }
1119<Command>("elif"|"else"{B}*"if")/[ \t(!] {
1121 {
1122 yyextra->guardExpr.clear();
1123 BEGIN(Guard);
1124 }
1125 }
1126<Command>"endif"/[^a-z_A-Z0-9\x80-\xFF] {
1127
1129 }
static void decrLevel(yyscan_t yyscanner)
1130<Command,IgnoreLine>\n {
1132 BEGIN(Start);
1133 yyextra->yyLineNr++;
1134 }
1135<Command>"pragma"{B}+"once" {
1136 yyextra->expectGuard = false;
1137 if (yyextra->pragmaSet.find(yyextra->fileName.str())!=yyextra->pragmaSet.end())
1138 {
1140 BEGIN(PragmaOnce);
1141 }
1142 else
1143 {
1144 yyextra->pragmaSet.insert(yyextra->fileName.data());
1145 }
1146 }
1147<PragmaOnce>. {}
1148<PragmaOnce>\n {}
1149<PragmaOnce><<EOF>> {
1150 yyextra->expectGuard = false;
1151 BEGIN(Start);
1152 }
1153<Command>{ID} { // unknown directive
1154 BEGIN(IgnoreLine);
1155 }
1156<IgnoreLine>\\[\r]?\n {
1158 yyextra->yyLineNr++;
1159 }
1160<IgnoreLine>.
1161<Command>. { yyextra->potentialDefine += yytext[0]=='\t' ? '\t' : ' ';
1162 yyextra->yyColNr+=(int)yyleng;
1163 }
1164<UndefName>{ID} {
1167
1169 )
1170 {
1171
1173 }
1174 BEGIN(Start);
1175 }
1176<Guard>\\[\r]?\n {
1178 yyextra->guardExpr+=' ';
1179 yyextra->yyLineNr++;
1180 }
1181<Guard>"defined"/{B}*"(" {
1182 BEGIN(DefinedExpr2);
1183 }
1184<Guard>"defined"/{B}+ {
1185 BEGIN(DefinedExpr1);
1186 }
1187<Guard>"true"/{B}|{B}*[\r]?\n { yyextra->guardExpr+="1L"; }
1188<Guard>"false"/{B}|{B}*[\r]?\n { yyextra->guardExpr+="0L"; }
1189<Guard>"not"/{B} { yyextra->guardExpr+='!'; }
1190<Guard>"not_eq"/{B} { yyextra->guardExpr+="!="; }
1191<Guard>"and"/{B} { yyextra->guardExpr+="&&"; }
1192<Guard>"or"/{B} { yyextra->guardExpr+="||"; }
1193<Guard>"bitand"/{B} { yyextra->guardExpr+="&"; }
1194<Guard>"bitor"/{B} { yyextra->guardExpr+="|"; }
1195<Guard>"xor"/{B} { yyextra->guardExpr+="^"; }
1196<Guard>"compl"/{B} { yyextra->guardExpr+="~"; }
1197<Guard>{ID} { yyextra->guardExpr+=yytext; }
1198<Guard>"@" { yyextra->guardExpr+="@@"; }
1199<Guard>. { yyextra->guardExpr+=*yytext; }
1200<Guard>\n {
1201 unput(*yytext);
1202
1203
1206 if (guard)
1207 {
1208 BEGIN(Start);
1209 }
1210 else
1211 {
1212 yyextra->ifcount=0;
1213 BEGIN(SkipCPPBlock);
1214 }
1215 }
static bool computeExpression(yyscan_t yyscanner, const QCString &expr)
1216<DefinedExpr1,DefinedExpr2>\\\n { yyextra->yyLineNr++; outputChar(yyscanner,'\n'); }
1217<DefinedExpr1>{ID} {
1218 if (
isDefined(yyscanner,yytext) || yyextra->guardName==yytext)
1219 yyextra->guardExpr+=" 1L ";
1220 else
1221 yyextra->guardExpr+=" 0L ";
1222 yyextra->lastGuardName=yytext;
1223 BEGIN(Guard);
1224 }
1225<DefinedExpr2>{ID} {
1226 if (
isDefined(yyscanner,yytext) || yyextra->guardName==yytext)
1227 yyextra->guardExpr+=" 1L ";
1228 else
1229 yyextra->guardExpr+=" 0L ";
1230 yyextra->lastGuardName=yytext;
1231 }
1232<DefinedExpr1,DefinedExpr2>\n { // should not happen, handle anyway
1233 yyextra->yyLineNr++;
1234 yyextra->ifcount=0;
1235 BEGIN(SkipCPPBlock);
1236 }
1237<DefinedExpr2>")" {
1238 BEGIN(Guard);
1239 }
1240<DefinedExpr1,DefinedExpr2>.
1241<SkipCPPBlock>^{B}*"#" { BEGIN(SkipCommand); }
1242<SkipCPPBlock>^{Bopt}/[^#] { BEGIN(SkipLine); }
1243<SkipCPPBlock>\n { yyextra->yyLineNr++; outputChar(yyscanner,'\n'); }
1244<SkipCPPBlock>.
1245<SkipCommand>"if"(("n")?("def"))?/[ \t(!] {
1247 yyextra->ifcount++;
1248
1249 }
1250<SkipCommand>"else" {
1251
1253 {
1255
1256 BEGIN(Start);
1257 }
1258 }
1259<SkipCommand>("elif"|"else"{B}*"if")/[ \t(!] {
1260 if (yyextra->ifcount==0)
1261 {
1263 {
1264 yyextra->guardExpr.clear();
1265 yyextra->lastGuardName.clear();
1266 BEGIN(Guard);
1267 }
1268 else
1269 {
1270 BEGIN(SkipCPPBlock);
1271 }
1272 }
1273 }
1274<SkipCommand>"endif" {
1275 yyextra->expectGuard = false;
1277 if (--yyextra->ifcount<0)
1278 {
1279
1280 BEGIN(Start);
1281 }
1282 }
1283<SkipCommand>\n {
1285 yyextra->yyLineNr++;
1286 BEGIN(SkipCPPBlock);
1287 }
1288<SkipCommand>{ID} { // unknown directive
1289 BEGIN(SkipLine);
1290 }
1291<SkipCommand>.
1292<SkipLine>[^'"/\n]+
1293<SkipLine>{CHARLIT} { }
1294<SkipLine>\" {
1295 BEGIN(SkipString);
1296 }
1297<SkipLine>.
1298<SkipString>{CPPC}/[^\n]* {
1299 }
1300<SkipLine,SkipCommand,SkipCPPBlock>{CPPC}[^\n]* {
1301 yyextra->lastCPPContext=YY_START;
1302 BEGIN(RemoveCPPComment);
1303 }
1304<SkipString>{CCS}/[^\n]* {
1305 }
1306<SkipLine,SkipCommand,SkipCPPBlock>{CCS}/[^\n]* {
1307 yyextra->lastCContext=YY_START;
1308 BEGIN(RemoveCComment);
1309 }
1310<SkipLine>\n {
1312 yyextra->yyLineNr++;
1313 BEGIN(SkipCPPBlock);
1314 }
1315<SkipString>[^"\\\n]+ { }
1316<SkipString>\\. { }
1317<SkipString>\" {
1318 BEGIN(SkipLine);
1319 }
1320<SkipString>. { }
1321<IncludeID>{ID}{Bopt}/"(" {
1322 yyextra->nospaces=true;
1323 yyextra->roundCount=0;
1324 yyextra->defArgsStr=yytext;
1325 yyextra->findDefArgContext = IncludeID;
1326 BEGIN(FindDefineArgs);
1327 }
1328<IncludeID>{ID} {
1329 yyextra->nospaces=true;
1331 BEGIN(Start);
1332 }
1333<Include>[^\">\n]+[\">] {
1334 yyextra->incName+=yytext;
1335 if (yyextra->isImported)
1336 {
1337 BEGIN(EndImport);
1338 }
1339 else
1340 {
1342 BEGIN(Start);
1343 }
1344 }
1345<EndImport>{ENDIMPORTopt}/\n {
1347 BEGIN(Start);
1348 }
1349<EndImport>\\[\r]?"\n" {
1351 yyextra->yyLineNr++;
1352 }
1353<EndImport>. {
1354 }
1355<DefName>{ID}/("\\\n")*"(" { // define with argument
1356
1357 yyextra->argMap.clear();
1358 yyextra->defArgs = 0;
1359 yyextra->defArgsStr.clear();
1360 yyextra->defText.clear();
1361 yyextra->defLitText.clear();
1362 yyextra->defName = yytext;
1363 yyextra->defVarArgs = false;
1364 yyextra->defExtraSpacing.clear();
1365 yyextra->defContinue = false;
1366 BEGIN(DefineArg);
1367 }
1368<DefName>{ID}{B}+"1"/[ \r\t\n] { // special case: define with 1 -> can be "guard"
1369
1370 yyextra->argMap.clear();
1371 yyextra->defArgs = -1;
1372 yyextra->defArgsStr.clear();
1374 yyextra->defVarArgs = false;
1375
1376
1377 if (yyextra->curlyCount>0 || yyextra->defName!=yyextra->lastGuardName || !yyextra->expectGuard)
1378 {
1379 QCString def = yyextra->potentialDefine +
1380 yyextra->defName ;
1382 outputSpaces(yyscanner,yytext+yyextra->defName.length());
1383 yyextra->quoteArg=false;
1384 yyextra->insideComment=false;
1385 yyextra->lastGuardName.clear();
1386 yyextra->defText="1";
1387 yyextra->defLitText="1";
1388 BEGIN(DefineText);
1389 }
1390 else
1391 {
1392
1393 yyextra->defText.clear();
1394 yyextra->defLitText.clear();
1395 BEGIN(Start);
1396 }
1397 yyextra->expectGuard=false;
1398 }
static void outputSpaces(yyscan_t yyscanner, char *s)
1399<DefName,CmakeDefName01>{ID}/{B}*"\n" { // empty define
1400 yyextra->argMap.clear();
1401 yyextra->defArgs = -1;
1402 yyextra->defName = yytext;
1403 yyextra->defArgsStr.clear();
1404 yyextra->defText.clear();
1405 yyextra->defLitText.clear();
1406 yyextra->defVarArgs = false;
1407
1408
1409 if (yyextra->curlyCount>0 || yyextra->defName!=yyextra->lastGuardName || !yyextra->expectGuard)
1410 {
1411 QCString def = yyextra->potentialDefine + yyextra->defName;
1413 yyextra->quoteArg=false;
1414 yyextra->insideComment=false;
1415 if (YY_START == CmakeDefName01) yyextra->defText = "0";
1416 else if (yyextra->insideCS) yyextra->defText="1";
1417 BEGIN(DefineText);
1418 }
1419 else
1420 {
1421
1422 yyextra->guardName = yytext;
1423 yyextra->lastGuardName.clear();
1424 BEGIN(Start);
1425 }
1426 yyextra->expectGuard=false;
1427 }
1428<DefName>{ID}/{B}* { // define with content
1429
1430 yyextra->argMap.clear();
1431 yyextra->defArgs = -1;
1432 yyextra->defArgsStr.clear();
1433 yyextra->defText.clear();
1434 yyextra->defLitText.clear();
1435 yyextra->defName = yytext;
1436 yyextra->defVarArgs = false;
1437 QCString def = yyextra->potentialDefine +
1438 yyextra->defName +
1439 yyextra->defArgsStr ;
1441 yyextra->quoteArg=false;
1442 yyextra->insideComment=false;
1443 BEGIN(DefineText);
1444 }
1445<DefineArg>"\\\n" {
1446 yyextra->defExtraSpacing+="\n";
1447 yyextra->defContinue = true;
1448 yyextra->yyLineNr++;
1449 }
1450<DefineArg>{B}* { yyextra->defExtraSpacing+=yytext; }
1451<DefineArg>","{B}* { yyextra->defArgsStr+=yytext; }
1452<DefineArg>"("{B}* { yyextra->defArgsStr+=yytext; }
1453<DefineArg>{B}*")"{B}* {
1455 yyextra->defArgsStr+=yytext;
1456 QCString def = yyextra->potentialDefine +
1457 yyextra->defName +
1458 yyextra->defArgsStr +
1459 yyextra->defExtraSpacing ;
1461 yyextra->quoteArg=false;
1462 yyextra->insideComment=false;
1463 BEGIN(DefineText);
1464 }
static void extraSpacing(yyscan_t yyscanner)
1465<DefineArg>"..." { // Variadic macro
1466 yyextra->defVarArgs = true;
1467 yyextra->defArgsStr+=yytext;
1468 yyextra->argMap.emplace(std::string("__VA_ARGS__"),yyextra->defArgs);
1469 yyextra->defArgs++;
1470 }
1471<DefineArg>{ID}{B}*("..."?) {
1472
1474 yyextra->defVarArgs = yytext[yyleng-1]=='.';
1475 if (yyextra->defVarArgs)
1476 {
1478 }
1480 yyextra->defArgsStr+=yytext;
1481 yyextra->argMap.emplace(
toStdString(argName),yyextra->defArgs);
1482 yyextra->defArgs++;
1484 }
1485
1486<DefineText>"/ **"|"/ *!" {
1487 yyextra->defText+=yytext;
1488 yyextra->defLitText+=yytext;
1489 yyextra->insideComment=true;
1490 }
1491<DefineText>"* /" {
1492 yyextra->defText+=yytext;
1493 yyextra->defLitText+=yytext;
1494 yyextra->insideComment=false;
1495 }
1496 */
1497<DefineText>{CCS}[^!*] {
1498 yyextra->defLitText+=' ';
1500 yyextra->lastCContext=YY_START;
1501 yyextra->commentCount=1;
1502 BEGIN(SkipCComment);
1503 }
1504<DefineText>{CCS}[!*] {
1505 yyextra->defText+=yytext;
1506 yyextra->defLitText+=yytext;
1507 yyextra->lastCContext=YY_START;
1508 yyextra->commentCount=1;
1509 BEGIN(CopyCComment);
1510 }
1511<DefineText>{CPPC}[!/]? {
1513 yyextra->lastCPPContext=YY_START;
1514 yyextra->defLitText+=' ';
1515 BEGIN(SkipCPPComment);
1516 }
1517<SkipCComment>[/]?{CCE} {
1518 if (yytext[0]==
'/')
outputChar(yyscanner,
'/');
1520 if (--yyextra->commentCount<=0)
1521 {
1522 if (yyextra->lastCContext==Start)
1523
1524
1525 {
1526 YY_CURRENT_BUFFER->yy_at_bol=1;
1527 }
1528 BEGIN(yyextra->lastCContext);
1529 }
1530 }
1531<SkipCComment>{CPPC}("/")* {
1533 }
1534<SkipCComment>{CCS} {
1536
1537 }
1538<SkipCond>{CMD}{CMD} { }
1539<SkipCond>^({B}*"*"+)?{B}{0,3}"~~~"[~]* {
1541 if (!markdownSupport || !yyextra->isSpecialComment)
1542 {
1543 REJECT;
1544 }
1545 else
1546 {
1547 yyextra->fenceChar='~';
1549 BEGIN(SkipCondVerbatim);
1550 }
1551 }
static yy_size_t getFenceSize(char *txt, yy_size_t leng)
1552<SkipCond>^({B}*"*"+)?{B}{0,3}"```"[`]* {
1554 if (!markdownSupport || !yyextra->isSpecialComment)
1555 {
1556 REJECT;
1557 }
1558 else
1559 {
1560 yyextra->fenceChar='`';
1562 BEGIN(SkipCondVerbatim);
1563 }
1564 }
1565<SkipCComment>^({B}*"*"+)?{B}{0,3}"~~~"[~]* {
1567 if (!markdownSupport || !yyextra->isSpecialComment)
1568 {
1569 REJECT;
1570 }
1571 else
1572 {
1574 yyextra->fenceChar='~';
1576 BEGIN(SkipVerbatim);
1577 }
1578 }
1579<SkipCComment>^({B}*"*"+)?{B}{0,3}"```"[`]* {
1581 if (!markdownSupport || !yyextra->isSpecialComment)
1582 {
1583 REJECT;
1584 }
1585 else
1586 {
1588 yyextra->fenceChar='`';
1590 BEGIN(SkipVerbatim);
1591 }
1592 }
1593<SkipCComment>{CMD}{VERBATIM_LINE} |
1594<SkipCComment>{CMD}{LITERAL_BLOCK} { // escaped command
1597 }
1598<SkipCComment>{VERBATIM_LINE}.*/\n { // normal command
1600 }
1601<SkipCComment>{LITERAL_BLOCK} { // normal block command
1604 if (yyextra->isSpecialComment)
1605 {
1607 BEGIN(SkipVerbatim);
1608 }
1609 }
static void determineBlockName(yyscan_t yyscanner)
1610<SkipCond>{CMD}{CMD}"cond"[ \t]+ {}// escaped cond command
1611<SkipCond>{CMD}"cond"/\n |
1612<SkipCond>{CMD}"cond"[ \t]+ { // cond command in a skipped cond section, this section has to be skipped as well
1613
1615 }
static void startCondSection(yyscan_t yyscanner, const QCString §Id)
1616<SkipCComment>"{"[ \t]*"@code"/[ \t\n] {
1618 yyextra->javaBlock=1;
1619 BEGIN(JavaDocVerbatimCode);
1620 }
1621<SkipCComment>"{"[ \t]*"@literal"/[ \t\n] {
1623 yyextra->javaBlock=1;
1624 BEGIN(JavaDocVerbatimCode);
1625 }
1626<SkipCComment,SkipCPPComment>{CMD}{CMD}"cond"[ \t\n]+ { // escaped cond command
1628 }
1629<SkipCPPComment>{CMD}"cond"[ \t]+ { // conditional section
1630 yyextra->ccomment=true;
1631 yyextra->condCtx=YY_START;
1632 BEGIN(CondLineCpp);
1633 }
1634<SkipCComment>{CMD}"cond"[ \t]+ { // conditional section
1635 yyextra->ccomment=false;
1636 yyextra->condCtx=YY_START;
1637 BEGIN(CondLineC);
1638 }
1639<CondLineC,CondLineCpp>[!()&| \ta-z_A-Z0-9\x80-\xFF.\-]+ {
1641 if (yyextra->skip)
1642 {
1643 if (YY_START==CondLineC)
1644 {
1645
1647 yyextra->ccomment=true;
1648 }
1649 else
1650 {
1651 yyextra->ccomment=false;
1652 }
1653 BEGIN(SkipCond);
1654 }
1655 else
1656 {
1657 BEGIN(yyextra->condCtx);
1658 }
1659 }
1660<CondLineC,CondLineCpp>. { // non-guard character
1661 unput(*yytext);
1663 if (yyextra->skip)
1664 {
1665 if (YY_START==CondLineC)
1666 {
1667
1669 yyextra->ccomment=true;
1670 }
1671 else
1672 {
1673 yyextra->ccomment=false;
1674 }
1675 BEGIN(SkipCond);
1676 }
1677 else
1678 {
1679 BEGIN(yyextra->condCtx);
1680 }
1681 }
1682<SkipCComment,SkipCPPComment>{CMD}"cond"{WSopt}/\n { // no guard
1683 if (YY_START==SkipCComment)
1684 {
1685 yyextra->ccomment=true;
1686
1688 }
1689 else
1690 {
1691 yyextra->ccomment=false;
1692 }
1693 yyextra->condCtx=YY_START;
1694 yyextra->condGuardCount=0;
1696 BEGIN(SkipCond);
1697 }
1698<SkipCond>\n { yyextra->yyLineNr++; outputChar(yyscanner,'\n'); }
1699<SkipCond>{VERBATIM_LINE}.*/\n { }
1700<SkipCond>{LITERAL_BLOCK} {
1702 yyextra->yyLineNr+=numNLs;
1703 for (
int i = 0; i < numNLs; i++)
outputChar(yyscanner,
'\n');
1705 BEGIN(SkipCondVerbatim);
1706 }
1707
1708<SkipCond>. { }
1709<SkipCond>"#if"("def")? { yyextra->condGuardCount++; }
1710<SkipCond>"#endif" { yyextra->condGuardCount--; }
1711<SkipCond>[^\/\!*\\@\n#]+ { }
1712<SkipCond>{CPPC}[/!] { yyextra->ccomment=false; }
1713<SkipCond>{CCS}[*!] { yyextra->ccomment=true; }
1714<SkipCond,SkipCComment,SkipCPPComment>{CMD}{CMD}"endcond"/[^a-z_A-Z0-9\x80-\xFF] {
1715 if (!yyextra->skip)
1716 {
1718 }
1719 }
1720<SkipCond>{CMD}"endcond"/[^a-z_A-Z0-9\x80-\xFF] {
1721 bool oldSkip = yyextra->skip;
1723 if (oldSkip && !yyextra->skip)
1724 {
1725 if (yyextra->ccomment)
1726 {
1728 }
1729 BEGIN(yyextra->condCtx);
1730 }
1731 }
static void endCondSection(yyscan_t yyscanner)
1732<SkipCComment,SkipCPPComment>{CMD}"endcond"/[^a-z_A-Z0-9\x80-\xFF] {
1733 bool oldSkip = yyextra->skip;
1735 if (oldSkip && !yyextra->skip)
1736 {
1737 BEGIN(yyextra->condCtx);
1738 }
1739 }
1740<SkipCondVerbatim>{LITERAL_BLOCK_END} { /* end of verbatim block */
1741 if (yytext[1]=='f' && yyextra->blockName==&yytext[2])
1742 {
1743 BEGIN(SkipCond);
1744 }
1745 else if (&yytext[4]==yyextra->blockName)
1746 {
1747 BEGIN(SkipCond);
1748 }
1749 }
1750<SkipVerbatim>{LITERAL_BLOCK_END} { /* end of verbatim block */
1752 if (yytext[1]=='f' && yyextra->blockName==&yytext[2])
1753 {
1754 BEGIN(SkipCComment);
1755 }
1756 else if (&yytext[4]==yyextra->blockName)
1757 {
1758 BEGIN(SkipCComment);
1759 }
1760 }
1761<SkipCondVerbatim>^({B}*"*"+)?{B}{0,3}"~~~"[~]* {
1762 if (yyextra->fenceSize==
getFenceSize(yytext,yyleng) && yyextra->fenceChar==
'~')
1763 {
1764 BEGIN(SkipCond);
1765 }
1766 }
1767<SkipCondVerbatim>^({B}*"*"+)?{B}{0,3}"```"[`]* {
1768 if (yyextra->fenceSize==
getFenceSize(yytext,yyleng) && yyextra->fenceChar==
'`')
1769 {
1770 BEGIN(SkipCond);
1771 }
1772 }
1773<SkipVerbatim>^({B}*"*"+)?{B}{0,3}"~~~"[~]* {
1775 if (yyextra->fenceSize==
getFenceSize(yytext,yyleng) && yyextra->fenceChar==
'~')
1776 {
1777 BEGIN(SkipCComment);
1778 }
1779 }
1780<SkipVerbatim>^({B}*"*"+)?{B}{0,3}"```"[`]* {
1782 if (yyextra->fenceSize==
getFenceSize(yytext,yyleng) && yyextra->fenceChar==
'`')
1783 {
1784 BEGIN(SkipCComment);
1785 }
1786 }
1787<SkipCondVerbatim>{CCE}|{CCS} { }
1788<SkipVerbatim>{CCE}|{CCS} {
1790 }
1791<JavaDocVerbatimCode>"{" {
1792 if (yyextra->javaBlock==0)
1793 {
1794 REJECT;
1795 }
1796 else
1797 {
1798 yyextra->javaBlock++;
1800 }
1801 }
1802<JavaDocVerbatimCode>"}" {
1803 if (yyextra->javaBlock==0)
1804 {
1805 REJECT;
1806 }
1807 else
1808 {
1809 yyextra->javaBlock--;
1810 if (yyextra->javaBlock==0)
1811 {
1813 BEGIN(SkipCComment);
1814 }
1815 else
1816 {
1818 }
1819 }
1820 }
1821<JavaDocVerbatimCode>\n { /* new line in verbatim block */
1823 }
1824<JavaDocVerbatimCode>. { /* any other character */
1826 }
1827<SkipCondVerbatim>[^{*\\@\x06~`\n\/]+ { }
1828<SkipCComment,SkipVerbatim>[^{*\\@\x06~`\n\/]+ {
1830 }
1831<SkipCComment,SkipVerbatim,SkipCondVerbatim>\n {
1832 yyextra->yyLineNr++;
1834 }
1835<SkipCondVerbatim>. { }
1836<SkipCComment,SkipVerbatim>. {
1838 }
1839<CopyCComment>[^*a-z_A-Z\x80-\xFF\n]*[^*a-z_A-Z\x80-\xFF\\\n] {
1840 yyextra->defLitText+=yytext;
1841 yyextra->defText+=
escapeAt(yytext);
1842 }
static QCString escapeAt(const QCString &text)
1843<CopyCComment>\\[\r]?\n {
1844 yyextra->defLitText+=yytext;
1845 yyextra->defText+=" ";
1846 yyextra->yyLineNr++;
1847 yyextra->yyMLines++;
1848 }
1849<CopyCComment>{CCE} {
1850 yyextra->defLitText+=yytext;
1851 yyextra->defText+=yytext;
1852 BEGIN(yyextra->lastCContext);
1853 }
1854<CopyCComment>\n {
1855 yyextra->yyLineNr++;
1856 yyextra->defLitText+=yytext;
1857 yyextra->defText+=' ';
1858 }
1859<RemoveCComment>{CCE}{B}*"#" { // see bug 594021 for a usecase for this rule
1860 if (yyextra->lastCContext==SkipCPPBlock)
1861 {
1862 BEGIN(SkipCommand);
1863 }
1864 else
1865 {
1866 REJECT;
1867 }
1868 }
1869<RemoveCComment>{CCE} { BEGIN(yyextra->lastCContext); }
1870<RemoveCComment>{CPPC}
1871<RemoveCComment>{CCS}
1872<RemoveCComment>[^*\x06\n]+
1873<RemoveCComment>\n { yyextra->yyLineNr++; outputChar(yyscanner,'\n'); }
1874<RemoveCComment>.
1875<SkipCPPComment>[^\n\/\\@]+ {
1877 }
1878<SkipCPPComment,RemoveCPPComment>\n {
1879 unput(*yytext);
1880 BEGIN(yyextra->lastCPPContext);
1881 }
1882<SkipCPPComment>{CCS} {
1884 }
1885<SkipCPPComment>{CPPC} {
1887 }
1888<SkipCPPComment>[^\x06\@\\\n]+ {
1890 }
1891<SkipCPPComment>. {
1893 }
1894<RemoveCPPComment>{CCS}
1895<RemoveCPPComment>{CPPC}
1896<RemoveCPPComment>[^\x06\n]+
1897<RemoveCPPComment>.
1898<DefineText>"__VA_OPT__("{B}*"##" {
1899 warn(yyextra->fileName,yyextra->yyLineNr,
1900 "'##' may not appear at the beginning of a __VA_OPT__()",
1901 yyextra->defName,yyextra->defLitText.stripWhiteSpace());
1902 yyextra->defText+="__VA_OPT__(";
1903 yyextra->defLitText+="__VA_OPT__(";
1904 }
1905<DefineText>"#"/"__VA_OPT__" {
1906 yyextra->defText+=yytext;
1907 yyextra->defLitText+=yytext;
1908 }
1909<DefineText>"#"/{IDSTART} {
1911 yyextra->quoteArg=true;
1912 yyextra->idStart=true;
1913 yyextra->defLitText+=yytext;
1914 }
1915<DefineText,CopyCComment>{ID} {
1916 yyextra->defLitText+=yytext;
1917 if (YY_START == DefineText)
outputSpaces(yyscanner,yytext);
1918 if (yyextra->quoteArg)
1919 {
1920 yyextra->defText+="\"";
1921 }
1922 if (yyextra->defArgs>0)
1923 {
1924 auto it = yyextra->argMap.find(yytext);
1925 if (it!=yyextra->argMap.end())
1926 {
1927 int n = it->second;
1928 yyextra->defText+='@';
1930 }
1931 else
1932 {
1933 if (yyextra->idStart)
1934 {
1935 warn(yyextra->fileName,yyextra->yyLineNr,
1936 "'#' is not followed by a macro parameter '{}': '{}'",
1937 yyextra->defName,yyextra->defLitText.stripWhiteSpace());
1938 }
1939 yyextra->defText+=yytext;
1940 }
1941 }
1942 else
1943 {
1944 yyextra->defText+=yytext;
1945 }
1946 if (yyextra->quoteArg)
1947 {
1948 yyextra->defText+="\"";
1949 }
1950 yyextra->quoteArg=false;
1951 yyextra->idStart=false;
1952 }
1953<CopyCComment>. {
1954 yyextra->defLitText+=yytext;
1955 yyextra->defText+=yytext;
1956 }
1957<DefineText>\\[\r]?\n {
1958 yyextra->defLitText+=yytext;
1961 yyextra->defText += ' ';
1962 yyextra->yyLineNr++;
1963 yyextra->yyMLines++;
1964 }
1965<DefineText>\n {
1967 yyextra->defText = yyextra->defText.stripWhiteSpace();
1968 if (yyextra->defText.startsWith("##"))
1969 {
1970 warn(yyextra->fileName,yyextra->yyLineNr,
1971 "'##' cannot occur at the beginning of a macro definition '{}': '{}'",
1972 yyextra->defName,yyextra->defLitText.stripWhiteSpace());
1973 }
1974 else if (yyextra->defText.endsWith("##"))
1975 {
1976 warn(yyextra->fileName,yyextra->yyLineNr,
1977 "'##' cannot occur at the end of a macro definition '{}': '{}'",
1978 yyextra->defName,yyextra->defLitText.stripWhiteSpace());
1979 }
1980 else if (yyextra->defText.endsWith("#"))
1981 {
1982 warn(yyextra->fileName,yyextra->yyLineNr,
1983 "expected formal parameter after # in macro definition '{}': '{}'",
1984 yyextra->defName,yyextra->defLitText.stripWhiteSpace());
1985 }
1987 {
1989 yyextra->defLitText=yyextra->defLitText.left(yyextra->defLitText.length()-comment.
length()-1);
1990 }
1992 yyextra->defLitText+=yytext;
1994
1995 if (yyextra->includeStack.empty() || yyextra->curlyCount>0)
1996 {
1998 }
1999 def=
isDefined(yyscanner,yyextra->defName);
2000 if (def==0)
2001 {
2002
2004 }
2005 else if (def )
2006
2007 {
2008
2009
2011 {
2013 def->
name = yyextra->defName;
2015 def->
nargs = yyextra->defArgs;
2017 def->
lineNr = yyextra->yyLineNr-yyextra->yyMLines;
2019 }
2020 else
2021 {
2022 if (def->
fileName != yyextra->fileName && !yyextra->expandOnlyPredef)
addDefine(yyscanner);
2023
2024 }
2025 }
2026 yyextra->argMap.clear();
2027 yyextra->yyLineNr++;
2028 yyextra->yyColNr=1;
2029 yyextra->lastGuardName.clear();
2030 BEGIN(Start);
2031 }
static void addMacroDefinition(yyscan_t yyscanner)
static void addDefine(yyscan_t yyscanner)
static QCString extractTrailingComment(const QCString &s)
2032<DefineText>{B}* { outputString(yyscanner,yytext);
2033 yyextra->defText += ' ';
2034 yyextra->defLitText+=yytext;
2035 }
2036<DefineText>{B}*"##"{B}* { outputString(yyscanner,substitute(yytext,"##"," "));
2037 yyextra->defText += "##";
2038 yyextra->defLitText+=yytext;
2039 }
2040<DefineText>"@" { outputString(yyscanner,substitute(yytext,"@@"," "));
2041 yyextra->defText += "@@";
2042 yyextra->defLitText+=yytext;
2043 }
2044<DefineText>\" {
2046 yyextra->defText += *yytext;
2047 yyextra->defLitText+=yytext;
2048 if (!yyextra->insideComment)
2049 {
2050 BEGIN(SkipDoubleQuote);
2051 }
2052 }
2053<DefineText>{NUMBER} {
2055 yyextra->defText += yytext;
2056 yyextra->defLitText+=yytext;
2057 }
2058<DefineText>\' {
2060 yyextra->defText += *yytext;
2061 yyextra->defLitText+=yytext;
2062 if (!yyextra->insideComment)
2063 {
2064 BEGIN(SkipSingleQuote);
2065 }
2066 }
2067<SkipDoubleQuote>{CPPC}[/]? { outputSpaces(yyscanner,yytext);
2068 yyextra->defText += yytext;
2069 yyextra->defLitText+=yytext;
2070 }
2071<SkipDoubleQuote>{CCS}[*]? { outputSpaces(yyscanner,yytext);
2072 yyextra->defText += yytext;
2073 yyextra->defLitText+=yytext;
2074 }
2075<SkipDoubleQuote>\" {
2077 yyextra->defText += *yytext;
2078 yyextra->defLitText+=yytext;
2079 BEGIN(DefineText);
2080 }
2081<SkipSingleQuote,SkipDoubleQuote>\\. {
2083 yyextra->defText += yytext;
2084 yyextra->defLitText+=yytext;
2085 }
2086<SkipSingleQuote>\' {
2088 yyextra->defText += *yytext;
2089 yyextra->defLitText+=yytext;
2090 BEGIN(DefineText);
2091 }
2092<SkipDoubleQuote,SkipSingleQuote>. { outputSpace(yyscanner,yytext[0]);
2093 yyextra->defText += *yytext;
2094 yyextra->defLitText += *yytext;
2095 }
2096<DefineText>. { outputSpace(yyscanner,yytext[0]);
2097 yyextra->defText += *yytext;
2098 yyextra->defLitText += *yytext;
2099 }
2100<<EOF>> {
2101 TRACE(
"End of include file");
2102
2103 if (yyextra->includeStack.empty())
2104 {
2105 TRACE(
"Terminating scanner");
2107 }
2108 else
2109 {
2110 if (!yyextra->levelGuard.empty())
2111 {
2112 if (yyextra->condGuardErrorLine!=0)
2113 {
2114 warn(yyextra->condGuardErrorFileName,yyextra->condGuardErrorLine,
"{}",yyextra->condGuardErrorMessage);
2115 }
2116 else
2117 {
2118 warn(yyextra->fileName,yyextra->yyLineNr,
"More #endif's than #if's found.");
2119 }
2120 }
2121 QCString toFileName = yyextra->fileName;
2122 const std::unique_ptr<FileState> &fs=yyextra->includeStack.back();
2123
2124 YY_BUFFER_STATE oldBuf = YY_CURRENT_BUFFER;
2125 yy_switch_to_buffer( fs->bufState, yyscanner );
2126 yy_delete_buffer( oldBuf, yyscanner );
2127 yyextra->yyLineNr = fs->lineNr;
2128
2129 yyextra->inputBuf = fs->oldFileBuf;
2130 yyextra->inputBufPos = fs->oldFileBufPos;
2131 yyextra->curlyCount = fs->curlyCount;
2132 yyextra->levelGuard = fs->levelGuard;
2134 TRACE(
"switching to {}",yyextra->fileName);
2135
2136
2137
2139 lineStr.sprintf(
"# %d \"%s\" 2",yyextra->yyLineNr,
qPrint(yyextra->fileName));
2141
2142 yyextra->includeStack.pop_back();
2143
2144 {
2146
2147
2148
2149
2151 {
2152
2155 }
2156 else
2157 {
2159 {
2161 }
2162 }
2163 }
2164
2165 for (const auto &kv : yyextra->localDefines)
2166 {
2167 auto pair = yyextra->contextDefines.insert(kv);
2168 if (!pair.second)
2169 {
2170 yyextra->contextDefines.erase(pair.first);
2171 yyextra->contextDefines.insert(kv);
2172 }
2173 }
2174 yyextra->localDefines.clear();
2175 }
2176 }
void store(const std::string &fileName, const DefineMap &fromMap)
2177<*>{CCS}/{CCE} |
2178<*>{CCS}[*!]? {
2179 if (YY_START==SkipVerbatim || YY_START == SkipCondVerbatim || YY_START==SkipCond || YY_START==IDLquote || YY_START == PragmaOnce)
2180 {
2181 REJECT;
2182 }
2183 else
2184 {
2186 yyextra->lastCContext=YY_START;
2187 yyextra->commentCount=1;
2188 if (yyleng==3)
2189 {
2190 yyextra->isSpecialComment = true;
2191 yyextra->lastGuardName.clear();
2192 }
2193 else
2194 {
2195 yyextra->isSpecialComment = false;
2196 }
2197 BEGIN(SkipCComment);
2198 }
2199 }
2200<*>{CPPC}[/!]? {
2201 if (YY_START==SkipVerbatim || YY_START == SkipCondVerbatim || YY_START==SkipCond ||
getLanguageFromFileName(yyextra->fileName)==SrcLangExt::Fortran || YY_START==IDLquote || YY_START == PragmaOnce)
2202 {
2203 REJECT;
2204 }
2205 else if (YY_START==RulesRoundDouble)
2206 {
2207 REJECT;
2208 }
2209 else
2210 {
2212 yyextra->lastCPPContext=YY_START;
2213 if (yyleng==3)
2214 {
2215 yyextra->isSpecialComment = true;
2216 yyextra->lastGuardName.clear();
2217 }
2218 else
2219 {
2220 yyextra->isSpecialComment = false;
2221 }
2222 BEGIN(SkipCPPComment);
2223 }
2224 }
2225<*>\n {
2227 yyextra->yyLineNr++;
2228 }
2229<*>. {
2230 yyextra->expectGuard = false;
2232 }
2233
2234%%