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
968 yyextra->defArgsStr+=
QCString(
"/*")+&yytext[2]+
" */";
969 }
970<FindDefineArgs>\" {
971 yyextra->defArgsStr+=*yytext;
972 BEGIN(ReadString);
973 }
974<FindDefineArgs>' {
976 yyextra->defArgsStr+=*yytext;
977 BEGIN(ReadString);
978 }
979<FindDefineArgs>\n {
980 yyextra->defArgsStr+=' ';
981 yyextra->yyLineNr++;
983 }
984<FindDefineArgs>"@" {
985 yyextra->defArgsStr+="@@";
986 }
987<FindDefineArgs>. {
988 yyextra->defArgsStr+=*yytext;
989 }
990<ArgCopyCComment>[^*\n]+ {
991 yyextra->defArgsStr+=yytext;
992 }
993<ArgCopyCComment>{CCE} {
994 yyextra->defArgsStr+=yytext;
995 BEGIN(FindDefineArgs);
996 }
997<ArgCopyCComment>\n {
998 yyextra->defArgsStr+=yytext;
999 yyextra->yyLineNr++;
1000 }
1001<ArgCopyCComment>. {
1002 yyextra->defArgsStr+=yytext;
1003 }
1004<ArgCopyCppComment>^{B}*
1005<ArgCopyCppComment>{CPPC}[/!].*\n/{B}*{CPPC}[/!] { // replace multi line C++ style comment by C style comment
1006 const char *startContent = &yytext[3];
1007 if (startContent[0]=='<') startContent++;
1008 yyextra->defArgsStr+=startContent;
1009 }
1010<ArgCopyCppComment>{CPPC}[/!].*\n { // replace C++ multie line style comment by C style comment
1011 const char *startContent = &yytext[3];
1012 if (startContent[0]=='<') startContent++;
1013 yyextra->defArgsStr+=
QCString(startContent)+
" */";
1014 BEGIN(FindDefineArgs);
1015 }
1016<ArgCopyCppComment>. { // unexpected character
1017 unput(*yytext);
1018 yyextra->defArgsStr+=" */";
1019 BEGIN(FindDefineArgs);
1020 }
1021<ReadString>"\"" {
1022 yyextra->defArgsStr+=*yytext;
1023 BEGIN(FindDefineArgs);
1024 }
1025<ReadString>"'" {
1027 yyextra->defArgsStr+=*yytext;
1028 BEGIN(FindDefineArgs);
1029 }
1030
1031<ReadString>{CPPC}|{CCS} {
1032 yyextra->defArgsStr+=yytext;
1033 }
1034<ReadString>\\/\r?\n { // line continuation
1035 }
1036<ReadString>\\. {
1037 yyextra->defArgsStr+=yytext;
1038 }
1039<ReadString>. {
1040 yyextra->defArgsStr+=*yytext;
1041 }
1042<Command>("include"|"import"){B}+/{ID} {
1043 yyextra->isImported = yytext[1]=='m';
1044 if (yyextra->macroExpansion)
1045 BEGIN(IncludeID);
1046 }
1047<Command>("include"|"import"){B}*[<"] {
1048 yyextra->isImported = yytext[1]=='m';
1049 char c[2];
1050 c[0]=yytext[yyleng-1];c[1]='\0';
1051 yyextra->incName=c;
1052 BEGIN(Include);
1053 }
1054<Command>("cmake")?"define"{B}+ {
1055 yyextra->potentialDefine +=
substitute(yytext,
"cmake",
" ");
1056
1057 yyextra->yyColNr+=(int)yyleng;
1058 BEGIN(DefName);
1059 }
QCString substitute(const QCString &s, const QCString &src, const QCString &dst)
substitute all occurrences of src in s by dst
1060<Command>"cmakedefine01"{B}+ {
1061 yyextra->potentialDefine +=
substitute(yytext,
"cmakedefine01",
" define ");
1062
1063 yyextra->yyColNr+=(int)yyleng;
1064 BEGIN(CmakeDefName01);
1065 }
1066<Command>"ifdef"/{B}*"(" {
1068 yyextra->guardExpr.clear();
1069 BEGIN(DefinedExpr2);
1070 }
static void incrLevel(yyscan_t yyscanner)
1071<Command>"ifdef"/{B}+ {
1072
1074 yyextra->guardExpr.clear();
1075 BEGIN(DefinedExpr1);
1076 }
1077<Command>"ifndef"/{B}*"(" {
1079 yyextra->guardExpr="! ";
1080 BEGIN(DefinedExpr2);
1081 }
1082<Command>"ifndef"/{B}+ {
1084 yyextra->guardExpr="! ";
1085 BEGIN(DefinedExpr1);
1086 }
1087<Command>"if"/[ \t(!] {
1089 yyextra->guardExpr.clear();
1090 BEGIN(Guard);
1091 }
1092<Command>("elif"|"else"{B}*"if")/[ \t(!] {
1094 {
1095 yyextra->guardExpr.clear();
1096 BEGIN(Guard);
1097 }
1098 else
1099 {
1100 yyextra->ifcount=0;
1101 BEGIN(SkipCPPBlock);
1102 }
1103 }
static bool otherCaseDone(yyscan_t yyscanner)
1104<Command>"else"/[^a-z_A-Z0-9\x80-\xFF] {
1106 {
1107 yyextra->ifcount=0;
1108 BEGIN(SkipCPPBlock);
1109 }
1110 else
1111 {
1113 }
1114 }
static void setCaseDone(yyscan_t yyscanner, bool value)
1115<Command>"undef"{B}+ {
1116 BEGIN(UndefName);
1117 }
1118<Command>("elif"|"else"{B}*"if")/[ \t(!] {
1120 {
1121 yyextra->guardExpr.clear();
1122 BEGIN(Guard);
1123 }
1124 }
1125<Command>"endif"/[^a-z_A-Z0-9\x80-\xFF] {
1126
1128 }
static void decrLevel(yyscan_t yyscanner)
1129<Command,IgnoreLine>\n {
1131 BEGIN(Start);
1132 yyextra->yyLineNr++;
1133 }
1134<Command>"pragma"{B}+"once" {
1135 yyextra->expectGuard =
FALSE;
1136 if (yyextra->pragmaSet.find(yyextra->fileName.str())!=yyextra->pragmaSet.end())
1137 {
1139 BEGIN(PragmaOnce);
1140 }
1141 else
1142 {
1143 yyextra->pragmaSet.insert(yyextra->fileName.data());
1144 }
1145 }
1146<PragmaOnce>. {}
1147<PragmaOnce>\n {}
1148<PragmaOnce><<EOF>> {
1149 yyextra->expectGuard =
FALSE;
1150 BEGIN(Start);
1151 }
1152<Command>{ID} { // unknown directive
1153 BEGIN(IgnoreLine);
1154 }
1155<IgnoreLine>\\[\r]?\n {
1157 yyextra->yyLineNr++;
1158 }
1159<IgnoreLine>.
1160<Command>. { yyextra->potentialDefine += yytext[0]=='\t' ? '\t' : ' ';
1161 yyextra->yyColNr+=(int)yyleng;
1162 }
1163<UndefName>{ID} {
1166
1168 )
1169 {
1170
1172 }
1173 BEGIN(Start);
1174 }
1175<Guard>\\[\r]?\n {
1177 yyextra->guardExpr+=' ';
1178 yyextra->yyLineNr++;
1179 }
1180<Guard>"defined"/{B}*"(" {
1181 BEGIN(DefinedExpr2);
1182 }
1183<Guard>"defined"/{B}+ {
1184 BEGIN(DefinedExpr1);
1185 }
1186<Guard>"true"/{B}|{B}*[\r]?\n { yyextra->guardExpr+="1L"; }
1187<Guard>"false"/{B}|{B}*[\r]?\n { yyextra->guardExpr+="0L"; }
1188<Guard>"not"/{B} { yyextra->guardExpr+='!'; }
1189<Guard>"not_eq"/{B} { yyextra->guardExpr+="!="; }
1190<Guard>"and"/{B} { yyextra->guardExpr+="&&"; }
1191<Guard>"or"/{B} { yyextra->guardExpr+="||"; }
1192<Guard>"bitand"/{B} { yyextra->guardExpr+="&"; }
1193<Guard>"bitor"/{B} { yyextra->guardExpr+="|"; }
1194<Guard>"xor"/{B} { yyextra->guardExpr+="^"; }
1195<Guard>"compl"/{B} { yyextra->guardExpr+="~"; }
1196<Guard>{ID} { yyextra->guardExpr+=yytext; }
1197<Guard>"@" { yyextra->guardExpr+="@@"; }
1198<Guard>. { yyextra->guardExpr+=*yytext; }
1199<Guard>\n {
1200 unput(*yytext);
1201
1202
1205 if (guard)
1206 {
1207 BEGIN(Start);
1208 }
1209 else
1210 {
1211 yyextra->ifcount=0;
1212 BEGIN(SkipCPPBlock);
1213 }
1214 }
static bool computeExpression(yyscan_t yyscanner, const QCString &expr)
1215<DefinedExpr1,DefinedExpr2>\\\n { yyextra->yyLineNr++; outputChar(yyscanner,'\n'); }
1216<DefinedExpr1>{ID} {
1217 if (
isDefined(yyscanner,yytext) || yyextra->guardName==yytext)
1218 yyextra->guardExpr+=" 1L ";
1219 else
1220 yyextra->guardExpr+=" 0L ";
1221 yyextra->lastGuardName=yytext;
1222 BEGIN(Guard);
1223 }
1224<DefinedExpr2>{ID} {
1225 if (
isDefined(yyscanner,yytext) || yyextra->guardName==yytext)
1226 yyextra->guardExpr+=" 1L ";
1227 else
1228 yyextra->guardExpr+=" 0L ";
1229 yyextra->lastGuardName=yytext;
1230 }
1231<DefinedExpr1,DefinedExpr2>\n { // should not happen, handle anyway
1232 yyextra->yyLineNr++;
1233 yyextra->ifcount=0;
1234 BEGIN(SkipCPPBlock);
1235 }
1236<DefinedExpr2>")" {
1237 BEGIN(Guard);
1238 }
1239<DefinedExpr1,DefinedExpr2>.
1240<SkipCPPBlock>^{B}*"#" { BEGIN(SkipCommand); }
1241<SkipCPPBlock>^{Bopt}/[^#] { BEGIN(SkipLine); }
1242<SkipCPPBlock>\n { yyextra->yyLineNr++; outputChar(yyscanner,'\n'); }
1243<SkipCPPBlock>.
1244<SkipCommand>"if"(("n")?("def"))?/[ \t(!] {
1246 yyextra->ifcount++;
1247
1248 }
1249<SkipCommand>"else" {
1250
1252 {
1254
1255 BEGIN(Start);
1256 }
1257 }
1258<SkipCommand>("elif"|"else"{B}*"if")/[ \t(!] {
1259 if (yyextra->ifcount==0)
1260 {
1262 {
1263 yyextra->guardExpr.clear();
1264 yyextra->lastGuardName.clear();
1265 BEGIN(Guard);
1266 }
1267 else
1268 {
1269 BEGIN(SkipCPPBlock);
1270 }
1271 }
1272 }
1273<SkipCommand>"endif" {
1274 yyextra->expectGuard =
FALSE;
1276 if (--yyextra->ifcount<0)
1277 {
1278
1279 BEGIN(Start);
1280 }
1281 }
1282<SkipCommand>\n {
1284 yyextra->yyLineNr++;
1285 BEGIN(SkipCPPBlock);
1286 }
1287<SkipCommand>{ID} { // unknown directive
1288 BEGIN(SkipLine);
1289 }
1290<SkipCommand>.
1291<SkipLine>[^'"/\n]+
1292<SkipLine>{CHARLIT} { }
1293<SkipLine>\" {
1294 BEGIN(SkipString);
1295 }
1296<SkipLine>.
1297<SkipString>{CPPC}/[^\n]* {
1298 }
1299<SkipLine,SkipCommand,SkipCPPBlock>{CPPC}[^\n]* {
1300 yyextra->lastCPPContext=YY_START;
1301 BEGIN(RemoveCPPComment);
1302 }
1303<SkipString>{CCS}/[^\n]* {
1304 }
1305<SkipLine,SkipCommand,SkipCPPBlock>{CCS}/[^\n]* {
1306 yyextra->lastCContext=YY_START;
1307 BEGIN(RemoveCComment);
1308 }
1309<SkipLine>\n {
1311 yyextra->yyLineNr++;
1312 BEGIN(SkipCPPBlock);
1313 }
1314<SkipString>[^"\\\n]+ { }
1315<SkipString>\\. { }
1316<SkipString>\" {
1317 BEGIN(SkipLine);
1318 }
1319<SkipString>. { }
1320<IncludeID>{ID}{Bopt}/"(" {
1321 yyextra->nospaces=
TRUE;
1322 yyextra->roundCount=0;
1323 yyextra->defArgsStr=yytext;
1324 yyextra->findDefArgContext = IncludeID;
1325 BEGIN(FindDefineArgs);
1326 }
1327<IncludeID>{ID} {
1328 yyextra->nospaces=
TRUE;
1330 BEGIN(Start);
1331 }
1332<Include>[^\">\n]+[\">] {
1333 yyextra->incName+=yytext;
1334 if (yyextra->isImported)
1335 {
1336 BEGIN(EndImport);
1337 }
1338 else
1339 {
1341 BEGIN(Start);
1342 }
1343 }
1344<EndImport>{ENDIMPORTopt}/\n {
1346 BEGIN(Start);
1347 }
1348<EndImport>\\[\r]?"\n" {
1350 yyextra->yyLineNr++;
1351 }
1352<EndImport>. {
1353 }
1354<DefName>{ID}/("\\\n")*"(" { // define with argument
1355
1356 yyextra->argMap.clear();
1357 yyextra->defArgs = 0;
1358 yyextra->defArgsStr.clear();
1359 yyextra->defText.clear();
1360 yyextra->defLitText.clear();
1361 yyextra->defName = yytext;
1362 yyextra->defVarArgs =
FALSE;
1363 yyextra->defExtraSpacing.clear();
1364 yyextra->defContinue = false;
1365 BEGIN(DefineArg);
1366 }
1367<DefName>{ID}{B}+"1"/[ \r\t\n] { // special case: define with 1 -> can be "guard"
1368
1369 yyextra->argMap.clear();
1370 yyextra->defArgs = -1;
1371 yyextra->defArgsStr.clear();
1373 yyextra->defVarArgs =
FALSE;
1374
1375
1376 if (yyextra->curlyCount>0 || yyextra->defName!=yyextra->lastGuardName || !yyextra->expectGuard)
1377 {
1378 QCString def = yyextra->potentialDefine +
1379 yyextra->defName ;
1381 outputSpaces(yyscanner,yytext+yyextra->defName.length());
1382 yyextra->quoteArg=
FALSE;
1383 yyextra->insideComment=
FALSE;
1384 yyextra->lastGuardName.clear();
1385 yyextra->defText="1";
1386 yyextra->defLitText="1";
1387 BEGIN(DefineText);
1388 }
1389 else
1390 {
1391
1392 yyextra->defText.clear();
1393 yyextra->defLitText.clear();
1394 BEGIN(Start);
1395 }
1396 yyextra->expectGuard=
FALSE;
1397 }
static void outputSpaces(yyscan_t yyscanner, char *s)
1398<DefName,CmakeDefName01>{ID}/{B}*"\n" { // empty define
1399 yyextra->argMap.clear();
1400 yyextra->defArgs = -1;
1401 yyextra->defName = yytext;
1402 yyextra->defArgsStr.clear();
1403 yyextra->defText.clear();
1404 yyextra->defLitText.clear();
1405 yyextra->defVarArgs =
FALSE;
1406
1407
1408 if (yyextra->curlyCount>0 || yyextra->defName!=yyextra->lastGuardName || !yyextra->expectGuard)
1409 {
1410 QCString def = yyextra->potentialDefine + yyextra->defName;
1412 yyextra->quoteArg=
FALSE;
1413 yyextra->insideComment=
FALSE;
1414 if (YY_START == CmakeDefName01) yyextra->defText = "0";
1415 else if (yyextra->insideCS) yyextra->defText="1";
1416 BEGIN(DefineText);
1417 }
1418 else
1419 {
1420
1421 yyextra->guardName = yytext;
1422 yyextra->lastGuardName.clear();
1423 BEGIN(Start);
1424 }
1425 yyextra->expectGuard=
FALSE;
1426 }
1427<DefName>{ID}/{B}* { // define with content
1428
1429 yyextra->argMap.clear();
1430 yyextra->defArgs = -1;
1431 yyextra->defArgsStr.clear();
1432 yyextra->defText.clear();
1433 yyextra->defLitText.clear();
1434 yyextra->defName = yytext;
1435 yyextra->defVarArgs =
FALSE;
1436 QCString def = yyextra->potentialDefine +
1437 yyextra->defName +
1438 yyextra->defArgsStr ;
1440 yyextra->quoteArg=
FALSE;
1441 yyextra->insideComment=
FALSE;
1442 BEGIN(DefineText);
1443 }
1444<DefineArg>"\\\n" {
1445 yyextra->defExtraSpacing+="\n";
1446 yyextra->defContinue = true;
1447 yyextra->yyLineNr++;
1448 }
1449<DefineArg>{B}* { yyextra->defExtraSpacing+=yytext; }
1450<DefineArg>","{B}* { yyextra->defArgsStr+=yytext; }
1451<DefineArg>"("{B}* { yyextra->defArgsStr+=yytext; }
1452<DefineArg>{B}*")"{B}* {
1454 yyextra->defArgsStr+=yytext;
1455 QCString def = yyextra->potentialDefine +
1456 yyextra->defName +
1457 yyextra->defArgsStr +
1458 yyextra->defExtraSpacing ;
1460 yyextra->quoteArg=
FALSE;
1461 yyextra->insideComment=
FALSE;
1462 BEGIN(DefineText);
1463 }
static void extraSpacing(yyscan_t yyscanner)
1464<DefineArg>"..." { // Variadic macro
1465 yyextra->defVarArgs =
TRUE;
1466 yyextra->defArgsStr+=yytext;
1467 yyextra->argMap.emplace(std::string("__VA_ARGS__"),yyextra->defArgs);
1468 yyextra->defArgs++;
1469 }
1470<DefineArg>{ID}{B}*("..."?) {
1471
1473 yyextra->defVarArgs = yytext[yyleng-1]=='.';
1474 if (yyextra->defVarArgs)
1475 {
1477 }
1479 yyextra->defArgsStr+=yytext;
1480 yyextra->argMap.emplace(
toStdString(argName),yyextra->defArgs);
1481 yyextra->defArgs++;
1483 }
1484
1485<DefineText>"/ **"|"/ *!" {
1486 yyextra->defText+=yytext;
1487 yyextra->defLitText+=yytext;
1488 yyextra->insideComment=
TRUE;
1489 }
1490<DefineText>"* /" {
1491 yyextra->defText+=yytext;
1492 yyextra->defLitText+=yytext;
1493 yyextra->insideComment=
FALSE;
1494 }
1495 */
1496<DefineText>{CCS}[^!*] {
1497 yyextra->defLitText+=' ';
1499 yyextra->lastCContext=YY_START;
1500 yyextra->commentCount=1;
1501 BEGIN(SkipCComment);
1502 }
1503<DefineText>{CCS}[!*] {
1504 yyextra->defText+=yytext;
1505 yyextra->defLitText+=yytext;
1506 yyextra->lastCContext=YY_START;
1507 yyextra->commentCount=1;
1508 BEGIN(CopyCComment);
1509 }
1510<DefineText>{CPPC}[!/]? {
1512 yyextra->lastCPPContext=YY_START;
1513 yyextra->defLitText+=' ';
1514 BEGIN(SkipCPPComment);
1515 }
1516<SkipCComment>[/]?{CCE} {
1517 if (yytext[0]==
'/')
outputChar(yyscanner,
'/');
1519 if (--yyextra->commentCount<=0)
1520 {
1521 if (yyextra->lastCContext==Start)
1522
1523
1524 {
1525 YY_CURRENT_BUFFER->yy_at_bol=1;
1526 }
1527 BEGIN(yyextra->lastCContext);
1528 }
1529 }
1530<SkipCComment>{CPPC}("/")* {
1532 }
1533<SkipCComment>{CCS} {
1535
1536 }
1537<SkipCond>{CMD}{CMD} { }
1538<SkipCond>^({B}*"*"+)?{B}{0,3}"~~~"[~]* {
1540 if (!markdownSupport || !yyextra->isSpecialComment)
1541 {
1542 REJECT;
1543 }
1544 else
1545 {
1546 yyextra->fenceChar='~';
1548 BEGIN(SkipCondVerbatim);
1549 }
1550 }
static yy_size_t getFenceSize(char *txt, yy_size_t leng)
1551<SkipCond>^({B}*"*"+)?{B}{0,3}"```"[`]* {
1553 if (!markdownSupport || !yyextra->isSpecialComment)
1554 {
1555 REJECT;
1556 }
1557 else
1558 {
1559 yyextra->fenceChar='`';
1561 BEGIN(SkipCondVerbatim);
1562 }
1563 }
1564<SkipCComment>^({B}*"*"+)?{B}{0,3}"~~~"[~]* {
1566 if (!markdownSupport || !yyextra->isSpecialComment)
1567 {
1568 REJECT;
1569 }
1570 else
1571 {
1573 yyextra->fenceChar='~';
1575 BEGIN(SkipVerbatim);
1576 }
1577 }
1578<SkipCComment>^({B}*"*"+)?{B}{0,3}"```"[`]* {
1580 if (!markdownSupport || !yyextra->isSpecialComment)
1581 {
1582 REJECT;
1583 }
1584 else
1585 {
1587 yyextra->fenceChar='`';
1589 BEGIN(SkipVerbatim);
1590 }
1591 }
1592<SkipCComment>{CMD}{VERBATIM_LINE} |
1593<SkipCComment>{CMD}{LITERAL_BLOCK} { // escaped command
1596 }
1597<SkipCComment>{VERBATIM_LINE}.*/\n { // normal command
1599 }
1600<SkipCComment>{LITERAL_BLOCK} { // normal block command
1603 if (yyextra->isSpecialComment)
1604 {
1606 BEGIN(SkipVerbatim);
1607 }
1608 }
static void determineBlockName(yyscan_t yyscanner)
1609<SkipCond>{CMD}{CMD}"cond"[ \t]+ {}// escaped cond command
1610<SkipCond>{CMD}"cond"/\n |
1611<SkipCond>{CMD}"cond"[ \t]+ { // cond command in a skipped cond section, this section has to be skipped as well
1612
1614 }
static void startCondSection(yyscan_t yyscanner, const QCString §Id)
1615<SkipCComment>"{"[ \t]*"@code"/[ \t\n] {
1617 yyextra->javaBlock=1;
1618 BEGIN(JavaDocVerbatimCode);
1619 }
1620<SkipCComment>"{"[ \t]*"@literal"/[ \t\n] {
1622 yyextra->javaBlock=1;
1623 BEGIN(JavaDocVerbatimCode);
1624 }
1625<SkipCComment,SkipCPPComment>{CMD}{CMD}"cond"[ \t\n]+ { // escaped cond command
1627 }
1628<SkipCPPComment>{CMD}"cond"[ \t]+ { // conditional section
1629 yyextra->ccomment=
TRUE;
1630 yyextra->condCtx=YY_START;
1631 BEGIN(CondLineCpp);
1632 }
1633<SkipCComment>{CMD}"cond"[ \t]+ { // conditional section
1634 yyextra->ccomment=
FALSE;
1635 yyextra->condCtx=YY_START;
1636 BEGIN(CondLineC);
1637 }
1638<CondLineC,CondLineCpp>[!()&| \ta-z_A-Z0-9\x80-\xFF.\-]+ {
1640 if (yyextra->skip)
1641 {
1642 if (YY_START==CondLineC)
1643 {
1644
1646 yyextra->ccomment=
TRUE;
1647 }
1648 else
1649 {
1650 yyextra->ccomment=
FALSE;
1651 }
1652 BEGIN(SkipCond);
1653 }
1654 else
1655 {
1656 BEGIN(yyextra->condCtx);
1657 }
1658 }
1659<CondLineC,CondLineCpp>. { // non-guard character
1660 unput(*yytext);
1662 if (yyextra->skip)
1663 {
1664 if (YY_START==CondLineC)
1665 {
1666
1668 yyextra->ccomment=
TRUE;
1669 }
1670 else
1671 {
1672 yyextra->ccomment=
FALSE;
1673 }
1674 BEGIN(SkipCond);
1675 }
1676 else
1677 {
1678 BEGIN(yyextra->condCtx);
1679 }
1680 }
1681<SkipCComment,SkipCPPComment>{CMD}"cond"{WSopt}/\n { // no guard
1682 if (YY_START==SkipCComment)
1683 {
1684 yyextra->ccomment=
TRUE;
1685
1687 }
1688 else
1689 {
1690 yyextra->ccomment=
FALSE;
1691 }
1692 yyextra->condCtx=YY_START;
1693 yyextra->condGuardCount=0;
1695 BEGIN(SkipCond);
1696 }
1697<SkipCond>\n { yyextra->yyLineNr++; outputChar(yyscanner,'\n'); }
1698<SkipCond>{VERBATIM_LINE}.*/\n { }
1699<SkipCond>{LITERAL_BLOCK} {
1701 yyextra->yyLineNr+=numNLs;
1702 for (
int i = 0; i < numNLs; i++)
outputChar(yyscanner,
'\n');
1704 BEGIN(SkipCondVerbatim);
1705 }
1706
1707<SkipCond>. { }
1708<SkipCond>"#if"("def")? { yyextra->condGuardCount++; }
1709<SkipCond>"#endif" { yyextra->condGuardCount--; }
1710<SkipCond>[^\/\!*\\@\n#]+ { }
1711<SkipCond>{CPPC}[/!] { yyextra->ccomment=FALSE; }
1712<SkipCond>{CCS}[*!] { yyextra->ccomment=TRUE; }
1713<SkipCond,SkipCComment,SkipCPPComment>{CMD}{CMD}"endcond"/[^a-z_A-Z0-9\x80-\xFF] {
1714 if (!yyextra->skip)
1715 {
1717 }
1718 }
1719<SkipCond>{CMD}"endcond"/[^a-z_A-Z0-9\x80-\xFF] {
1720 bool oldSkip = yyextra->skip;
1722 if (oldSkip && !yyextra->skip)
1723 {
1724 if (yyextra->ccomment)
1725 {
1727 }
1728 BEGIN(yyextra->condCtx);
1729 }
1730 }
static void endCondSection(yyscan_t yyscanner)
1731<SkipCComment,SkipCPPComment>{CMD}"endcond"/[^a-z_A-Z0-9\x80-\xFF] {
1732 bool oldSkip = yyextra->skip;
1734 if (oldSkip && !yyextra->skip)
1735 {
1736 BEGIN(yyextra->condCtx);
1737 }
1738 }
1739<SkipCondVerbatim>{LITERAL_BLOCK_END} { /* end of verbatim block */
1740 if (yytext[1]=='f' && yyextra->blockName==&yytext[2])
1741 {
1742 BEGIN(SkipCond);
1743 }
1744 else if (&yytext[4]==yyextra->blockName)
1745 {
1746 BEGIN(SkipCond);
1747 }
1748 }
1749<SkipVerbatim>{LITERAL_BLOCK_END} { /* end of verbatim block */
1751 if (yytext[1]=='f' && yyextra->blockName==&yytext[2])
1752 {
1753 BEGIN(SkipCComment);
1754 }
1755 else if (&yytext[4]==yyextra->blockName)
1756 {
1757 BEGIN(SkipCComment);
1758 }
1759 }
1760<SkipCondVerbatim>^({B}*"*"+)?{B}{0,3}"~~~"[~]* {
1761 if (yyextra->fenceSize==
getFenceSize(yytext,yyleng) && yyextra->fenceChar==
'~')
1762 {
1763 BEGIN(SkipCond);
1764 }
1765 }
1766<SkipCondVerbatim>^({B}*"*"+)?{B}{0,3}"```"[`]* {
1767 if (yyextra->fenceSize==
getFenceSize(yytext,yyleng) && yyextra->fenceChar==
'`')
1768 {
1769 BEGIN(SkipCond);
1770 }
1771 }
1772<SkipVerbatim>^({B}*"*"+)?{B}{0,3}"~~~"[~]* {
1774 if (yyextra->fenceSize==
getFenceSize(yytext,yyleng) && yyextra->fenceChar==
'~')
1775 {
1776 BEGIN(SkipCComment);
1777 }
1778 }
1779<SkipVerbatim>^({B}*"*"+)?{B}{0,3}"```"[`]* {
1781 if (yyextra->fenceSize==
getFenceSize(yytext,yyleng) && yyextra->fenceChar==
'`')
1782 {
1783 BEGIN(SkipCComment);
1784 }
1785 }
1786<SkipCondVerbatim>{CCE}|{CCS} { }
1787<SkipVerbatim>{CCE}|{CCS} {
1789 }
1790<JavaDocVerbatimCode>"{" {
1791 if (yyextra->javaBlock==0)
1792 {
1793 REJECT;
1794 }
1795 else
1796 {
1797 yyextra->javaBlock++;
1799 }
1800 }
1801<JavaDocVerbatimCode>"}" {
1802 if (yyextra->javaBlock==0)
1803 {
1804 REJECT;
1805 }
1806 else
1807 {
1808 yyextra->javaBlock--;
1809 if (yyextra->javaBlock==0)
1810 {
1812 BEGIN(SkipCComment);
1813 }
1814 else
1815 {
1817 }
1818 }
1819 }
1820<JavaDocVerbatimCode>\n { /* new line in verbatim block */
1822 }
1823<JavaDocVerbatimCode>. { /* any other character */
1825 }
1826<SkipCondVerbatim>[^{*\\@\x06~`\n\/]+ { }
1827<SkipCComment,SkipVerbatim>[^{*\\@\x06~`\n\/]+ {
1829 }
1830<SkipCComment,SkipVerbatim,SkipCondVerbatim>\n {
1831 yyextra->yyLineNr++;
1833 }
1834<SkipCondVerbatim>. { }
1835<SkipCComment,SkipVerbatim>. {
1837 }
1838<CopyCComment>[^*a-z_A-Z\x80-\xFF\n]*[^*a-z_A-Z\x80-\xFF\\\n] {
1839 yyextra->defLitText+=yytext;
1840 yyextra->defText+=
escapeAt(yytext);
1841 }
static QCString escapeAt(const QCString &text)
1842<CopyCComment>\\[\r]?\n {
1843 yyextra->defLitText+=yytext;
1844 yyextra->defText+=" ";
1845 yyextra->yyLineNr++;
1846 yyextra->yyMLines++;
1847 }
1848<CopyCComment>{CCE} {
1849 yyextra->defLitText+=yytext;
1850 yyextra->defText+=yytext;
1851 BEGIN(yyextra->lastCContext);
1852 }
1853<CopyCComment>\n {
1854 yyextra->yyLineNr++;
1855 yyextra->defLitText+=yytext;
1856 yyextra->defText+=' ';
1857 }
1858<RemoveCComment>{CCE}{B}*"#" { // see bug 594021 for a usecase for this rule
1859 if (yyextra->lastCContext==SkipCPPBlock)
1860 {
1861 BEGIN(SkipCommand);
1862 }
1863 else
1864 {
1865 REJECT;
1866 }
1867 }
1868<RemoveCComment>{CCE} { BEGIN(yyextra->lastCContext); }
1869<RemoveCComment>{CPPC}
1870<RemoveCComment>{CCS}
1871<RemoveCComment>[^*\x06\n]+
1872<RemoveCComment>\n { yyextra->yyLineNr++; outputChar(yyscanner,'\n'); }
1873<RemoveCComment>.
1874<SkipCPPComment>[^\n\/\\@]+ {
1876 }
1877<SkipCPPComment,RemoveCPPComment>\n {
1878 unput(*yytext);
1879 BEGIN(yyextra->lastCPPContext);
1880 }
1881<SkipCPPComment>{CCS} {
1883 }
1884<SkipCPPComment>{CPPC} {
1886 }
1887<SkipCPPComment>[^\x06\@\\\n]+ {
1889 }
1890<SkipCPPComment>. {
1892 }
1893<RemoveCPPComment>{CCS}
1894<RemoveCPPComment>{CPPC}
1895<RemoveCPPComment>[^\x06\n]+
1896<RemoveCPPComment>.
1897<DefineText>"__VA_OPT__("{B}*"##" {
1898 warn(yyextra->fileName,yyextra->yyLineNr,
1899 "'##' may not appear at the beginning of a __VA_OPT__()",
1900 yyextra->defName,yyextra->defLitText.stripWhiteSpace());
1901 yyextra->defText+="__VA_OPT__(";
1902 yyextra->defLitText+="__VA_OPT__(";
1903 }
1904<DefineText>"#"/"__VA_OPT__" {
1905 yyextra->defText+=yytext;
1906 yyextra->defLitText+=yytext;
1907 }
1908<DefineText>"#"/{IDSTART} {
1910 yyextra->quoteArg=
TRUE;
1911 yyextra->idStart=true;
1912 yyextra->defLitText+=yytext;
1913 }
1914<DefineText,CopyCComment>{ID} {
1915 yyextra->defLitText+=yytext;
1916 if (YY_START == DefineText)
outputSpaces(yyscanner,yytext);
1917 if (yyextra->quoteArg)
1918 {
1919 yyextra->defText+="\"";
1920 }
1921 if (yyextra->defArgs>0)
1922 {
1923 auto it = yyextra->argMap.find(yytext);
1924 if (it!=yyextra->argMap.end())
1925 {
1926 int n = it->second;
1927 yyextra->defText+='@';
1929 }
1930 else
1931 {
1932 if (yyextra->idStart)
1933 {
1934 warn(yyextra->fileName,yyextra->yyLineNr,
1935 "'#' is not followed by a macro parameter '{}': '{}'",
1936 yyextra->defName,yyextra->defLitText.stripWhiteSpace());
1937 }
1938 yyextra->defText+=yytext;
1939 }
1940 }
1941 else
1942 {
1943 yyextra->defText+=yytext;
1944 }
1945 if (yyextra->quoteArg)
1946 {
1947 yyextra->defText+="\"";
1948 }
1949 yyextra->quoteArg=
FALSE;
1950 yyextra->idStart=false;
1951 }
1952<CopyCComment>. {
1953 yyextra->defLitText+=yytext;
1954 yyextra->defText+=yytext;
1955 }
1956<DefineText>\\[\r]?\n {
1957 yyextra->defLitText+=yytext;
1960 yyextra->defText += ' ';
1961 yyextra->yyLineNr++;
1962 yyextra->yyMLines++;
1963 }
1964<DefineText>\n {
1966 yyextra->defText = yyextra->defText.stripWhiteSpace();
1967 if (yyextra->defText.startsWith("##"))
1968 {
1969 warn(yyextra->fileName,yyextra->yyLineNr,
1970 "'##' cannot occur at the beginning of a macro definition '{}': '{}'",
1971 yyextra->defName,yyextra->defLitText.stripWhiteSpace());
1972 }
1973 else if (yyextra->defText.endsWith("##"))
1974 {
1975 warn(yyextra->fileName,yyextra->yyLineNr,
1976 "'##' cannot occur at the end of a macro definition '{}': '{}'",
1977 yyextra->defName,yyextra->defLitText.stripWhiteSpace());
1978 }
1979 else if (yyextra->defText.endsWith("#"))
1980 {
1981 warn(yyextra->fileName,yyextra->yyLineNr,
1982 "expected formal parameter after # in macro definition '{}': '{}'",
1983 yyextra->defName,yyextra->defLitText.stripWhiteSpace());
1984 }
1986 {
1988 yyextra->defLitText=yyextra->defLitText.left(yyextra->defLitText.length()-
comment.length()-1);
1989 }
1991 yyextra->defLitText+=yytext;
1993
1994 if (yyextra->includeStack.empty() || yyextra->curlyCount>0)
1995 {
1997 }
1998 def=
isDefined(yyscanner,yyextra->defName);
1999 if (def==0)
2000 {
2001
2003 }
2004 else if (def )
2005
2006 {
2007
2008
2010 {
2012 def->
name = yyextra->defName;
2014 def->
nargs = yyextra->defArgs;
2016 def->
lineNr = yyextra->yyLineNr-yyextra->yyMLines;
2018 }
2019 else
2020 {
2021 if (def->
fileName != yyextra->fileName && !yyextra->expandOnlyPredef)
addDefine(yyscanner);
2022
2023 }
2024 }
2025 yyextra->argMap.clear();
2026 yyextra->yyLineNr++;
2027 yyextra->yyColNr=1;
2028 yyextra->lastGuardName.clear();
2029 BEGIN(Start);
2030 }
static void addMacroDefinition(yyscan_t yyscanner)
static void addDefine(yyscan_t yyscanner)
static QCString extractTrailingComment(const QCString &s)
2031<DefineText>{B}* { outputString(yyscanner,yytext);
2032 yyextra->defText += ' ';
2033 yyextra->defLitText+=yytext;
2034 }
2035<DefineText>{B}*"##"{B}* { outputString(yyscanner,substitute(yytext,"##"," "));
2036 yyextra->defText += "##";
2037 yyextra->defLitText+=yytext;
2038 }
2039<DefineText>"@" { outputString(yyscanner,substitute(yytext,"@@"," "));
2040 yyextra->defText += "@@";
2041 yyextra->defLitText+=yytext;
2042 }
2043<DefineText>\" {
2045 yyextra->defText += *yytext;
2046 yyextra->defLitText+=yytext;
2047 if (!yyextra->insideComment)
2048 {
2049 BEGIN(SkipDoubleQuote);
2050 }
2051 }
2052<DefineText>{NUMBER} {
2054 yyextra->defText += yytext;
2055 yyextra->defLitText+=yytext;
2056 }
2057<DefineText>\' {
2059 yyextra->defText += *yytext;
2060 yyextra->defLitText+=yytext;
2061 if (!yyextra->insideComment)
2062 {
2063 BEGIN(SkipSingleQuote);
2064 }
2065 }
2066<SkipDoubleQuote>{CPPC}[/]? { outputSpaces(yyscanner,yytext);
2067 yyextra->defText += yytext;
2068 yyextra->defLitText+=yytext;
2069 }
2070<SkipDoubleQuote>{CCS}[*]? { outputSpaces(yyscanner,yytext);
2071 yyextra->defText += yytext;
2072 yyextra->defLitText+=yytext;
2073 }
2074<SkipDoubleQuote>\" {
2076 yyextra->defText += *yytext;
2077 yyextra->defLitText+=yytext;
2078 BEGIN(DefineText);
2079 }
2080<SkipSingleQuote,SkipDoubleQuote>\\. {
2082 yyextra->defText += yytext;
2083 yyextra->defLitText+=yytext;
2084 }
2085<SkipSingleQuote>\' {
2087 yyextra->defText += *yytext;
2088 yyextra->defLitText+=yytext;
2089 BEGIN(DefineText);
2090 }
2091<SkipDoubleQuote,SkipSingleQuote>. { outputSpace(yyscanner,yytext[0]);
2092 yyextra->defText += *yytext;
2093 yyextra->defLitText += *yytext;
2094 }
2095<DefineText>. { outputSpace(yyscanner,yytext[0]);
2096 yyextra->defText += *yytext;
2097 yyextra->defLitText += *yytext;
2098 }
2099<<EOF>> {
2100 TRACE(
"End of include file");
2101
2102 if (yyextra->includeStack.empty())
2103 {
2104 TRACE(
"Terminating scanner");
2106 }
2107 else
2108 {
2109 if (!yyextra->levelGuard.empty())
2110 {
2111 if (yyextra->condGuardErrorLine!=0)
2112 {
2113 warn(yyextra->condGuardErrorFileName,yyextra->condGuardErrorLine,
"{}",yyextra->condGuardErrorMessage);
2114 }
2115 else
2116 {
2117 warn(yyextra->fileName,yyextra->yyLineNr,
"More #endif's than #if's found.");
2118 }
2119 }
2120 QCString toFileName = yyextra->fileName;
2121 const std::unique_ptr<FileState> &fs=yyextra->includeStack.back();
2122
2123 YY_BUFFER_STATE oldBuf = YY_CURRENT_BUFFER;
2124 yy_switch_to_buffer( fs->bufState, yyscanner );
2125 yy_delete_buffer( oldBuf, yyscanner );
2126 yyextra->yyLineNr = fs->lineNr;
2127
2128 yyextra->inputBuf = fs->oldFileBuf;
2129 yyextra->inputBufPos = fs->oldFileBufPos;
2130 yyextra->curlyCount = fs->curlyCount;
2131 yyextra->levelGuard = fs->levelGuard;
2133 TRACE(
"switching to {}",yyextra->fileName);
2134
2135
2136
2138 lineStr.sprintf(
"# %d \"%s\" 2",yyextra->yyLineNr,
qPrint(yyextra->fileName));
2140
2141 yyextra->includeStack.pop_back();
2142
2143 {
2145
2146
2147
2148
2150 {
2151
2154 }
2155 else
2156 {
2158 {
2160 }
2161 }
2162 }
2163
2164 for (const auto &kv : yyextra->localDefines)
2165 {
2166 auto pair = yyextra->contextDefines.insert(kv);
2167 if (!pair.second)
2168 {
2169 yyextra->contextDefines.erase(pair.first);
2170 yyextra->contextDefines.insert(kv);
2171 }
2172 }
2173 yyextra->localDefines.clear();
2174 }
2175 }
2176<*>{CCS}/{CCE} |
2177<*>{CCS}[*!]? {
2178 if (YY_START==SkipVerbatim || YY_START == SkipCondVerbatim || YY_START==SkipCond || YY_START==IDLquote || YY_START == PragmaOnce)
2179 {
2180 REJECT;
2181 }
2182 else
2183 {
2185 yyextra->lastCContext=YY_START;
2186 yyextra->commentCount=1;
2187 if (yyleng==3)
2188 {
2189 yyextra->isSpecialComment = true;
2190 yyextra->lastGuardName.clear();
2191 }
2192 else
2193 {
2194 yyextra->isSpecialComment = false;
2195 }
2196 BEGIN(SkipCComment);
2197 }
2198 }
2199<*>{CPPC}[/!]? {
2200 if (YY_START==SkipVerbatim || YY_START == SkipCondVerbatim || YY_START==SkipCond ||
getLanguageFromFileName(yyextra->fileName)==SrcLangExt::Fortran || YY_START==IDLquote || YY_START == PragmaOnce)
2201 {
2202 REJECT;
2203 }
2204 else if (YY_START==RulesRoundDouble)
2205 {
2206 REJECT;
2207 }
2208 else
2209 {
2211 yyextra->lastCPPContext=YY_START;
2212 if (yyleng==3)
2213 {
2214 yyextra->isSpecialComment = true;
2215 yyextra->lastGuardName.clear();
2216 }
2217 else
2218 {
2219 yyextra->isSpecialComment = false;
2220 }
2221 BEGIN(SkipCPPComment);
2222 }
2223 }
2224<*>\n {
2226 yyextra->yyLineNr++;
2227 }
2228<*>. {
2229 yyextra->expectGuard =
FALSE;
2231 }
2232
2233%%