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->defText+=yytext;
1498 yyextra->defLitText+=yytext;
1499 yyextra->lastCContext=YY_START;
1500 yyextra->commentCount=1;
1501 BEGIN(CopyCComment);
1502 }
1503<DefineText>{CPPC}[!/]? {
1505 yyextra->lastCPPContext=YY_START;
1506 yyextra->defLitText+=' ';
1507 BEGIN(SkipCPPComment);
1508 }
1509<SkipCComment>[/]?{CCE} {
1510 if (yytext[0]==
'/')
outputChar(yyscanner,
'/');
1512 if (--yyextra->commentCount<=0)
1513 {
1514 if (yyextra->lastCContext==Start)
1515
1516
1517 {
1518 YY_CURRENT_BUFFER->yy_at_bol=1;
1519 }
1520 BEGIN(yyextra->lastCContext);
1521 }
1522 }
1523<SkipCComment>{CPPC}("/")* {
1525 }
1526<SkipCComment>{CCS} {
1528
1529 }
1530<SkipCond>{CMD}{CMD} { }
1531<SkipCond>^({B}*"*"+)?{B}{0,3}"~~~"[~]* {
1533 if (!markdownSupport || !yyextra->isSpecialComment)
1534 {
1535 REJECT;
1536 }
1537 else
1538 {
1539 yyextra->fenceChar='~';
1541 BEGIN(SkipCondVerbatim);
1542 }
1543 }
static yy_size_t getFenceSize(char *txt, yy_size_t leng)
1544<SkipCond>^({B}*"*"+)?{B}{0,3}"```"[`]* {
1546 if (!markdownSupport || !yyextra->isSpecialComment)
1547 {
1548 REJECT;
1549 }
1550 else
1551 {
1552 yyextra->fenceChar='`';
1554 BEGIN(SkipCondVerbatim);
1555 }
1556 }
1557<SkipCComment>^({B}*"*"+)?{B}{0,3}"~~~"[~]* {
1559 if (!markdownSupport || !yyextra->isSpecialComment)
1560 {
1561 REJECT;
1562 }
1563 else
1564 {
1566 yyextra->fenceChar='~';
1568 BEGIN(SkipVerbatim);
1569 }
1570 }
1571<SkipCComment>^({B}*"*"+)?{B}{0,3}"```"[`]* {
1573 if (!markdownSupport || !yyextra->isSpecialComment)
1574 {
1575 REJECT;
1576 }
1577 else
1578 {
1580 yyextra->fenceChar='`';
1582 BEGIN(SkipVerbatim);
1583 }
1584 }
1585<SkipCComment>{CMD}{VERBATIM_LINE} |
1586<SkipCComment>{CMD}{LITERAL_BLOCK} { // escaped command
1589 }
1590<SkipCComment>{VERBATIM_LINE}.*/\n { // normal command
1592 }
1593<SkipCComment>{LITERAL_BLOCK} { // normal block command
1596 if (yyextra->isSpecialComment)
1597 {
1599 BEGIN(SkipVerbatim);
1600 }
1601 }
static void determineBlockName(yyscan_t yyscanner)
1602<SkipCond>{CMD}{CMD}"cond"[ \t]+ {}// escaped cond command
1603<SkipCond>{CMD}"cond"/\n |
1604<SkipCond>{CMD}"cond"[ \t]+ { // cond command in a skipped cond section, this section has to be skipped as well
1605
1607 }
static void startCondSection(yyscan_t yyscanner, const QCString §Id)
1608<SkipCComment>"{"[ \t]*"@code"/[ \t\n] {
1610 yyextra->javaBlock=1;
1611 BEGIN(JavaDocVerbatimCode);
1612 }
1613<SkipCComment>"{"[ \t]*"@literal"/[ \t\n] {
1615 yyextra->javaBlock=1;
1616 BEGIN(JavaDocVerbatimCode);
1617 }
1618<SkipCComment,SkipCPPComment>{CMD}{CMD}"cond"[ \t\n]+ { // escaped cond command
1620 }
1621<SkipCPPComment>{CMD}"cond"[ \t]+ { // conditional section
1622 yyextra->ccomment=
TRUE;
1623 yyextra->condCtx=YY_START;
1624 BEGIN(CondLineCpp);
1625 }
1626<SkipCComment>{CMD}"cond"[ \t]+ { // conditional section
1627 yyextra->ccomment=
FALSE;
1628 yyextra->condCtx=YY_START;
1629 BEGIN(CondLineC);
1630 }
1631<CondLineC,CondLineCpp>[!()&| \ta-z_A-Z0-9\x80-\xFF.\-]+ {
1633 if (yyextra->skip)
1634 {
1635 if (YY_START==CondLineC)
1636 {
1637
1639 yyextra->ccomment=
TRUE;
1640 }
1641 else
1642 {
1643 yyextra->ccomment=
FALSE;
1644 }
1645 BEGIN(SkipCond);
1646 }
1647 else
1648 {
1649 BEGIN(yyextra->condCtx);
1650 }
1651 }
1652<CondLineC,CondLineCpp>. { // non-guard character
1653 unput(*yytext);
1655 if (yyextra->skip)
1656 {
1657 if (YY_START==CondLineC)
1658 {
1659
1661 yyextra->ccomment=
TRUE;
1662 }
1663 else
1664 {
1665 yyextra->ccomment=
FALSE;
1666 }
1667 BEGIN(SkipCond);
1668 }
1669 else
1670 {
1671 BEGIN(yyextra->condCtx);
1672 }
1673 }
1674<SkipCComment,SkipCPPComment>{CMD}"cond"{WSopt}/\n { // no guard
1675 if (YY_START==SkipCComment)
1676 {
1677 yyextra->ccomment=
TRUE;
1678
1680 }
1681 else
1682 {
1683 yyextra->ccomment=
FALSE;
1684 }
1685 yyextra->condCtx=YY_START;
1686 yyextra->condGuardCount=0;
1688 BEGIN(SkipCond);
1689 }
1690<SkipCond>\n { yyextra->yyLineNr++; outputChar(yyscanner,'\n'); }
1691<SkipCond>{VERBATIM_LINE}.*/\n { }
1692<SkipCond>{LITERAL_BLOCK} {
1694 yyextra->yyLineNr+=numNLs;
1695 for (
int i = 0; i < numNLs; i++)
outputChar(yyscanner,
'\n');
1697 BEGIN(SkipCondVerbatim);
1698 }
1699
1700<SkipCond>. { }
1701<SkipCond>"#if"("def")? { yyextra->condGuardCount++; }
1702<SkipCond>"#endif" { yyextra->condGuardCount--; }
1703<SkipCond>[^\/\!*\\@\n#]+ { }
1704<SkipCond>{CPPC}[/!] { yyextra->ccomment=FALSE; }
1705<SkipCond>{CCS}[*!] { yyextra->ccomment=TRUE; }
1706<SkipCond,SkipCComment,SkipCPPComment>{CMD}{CMD}"endcond"/[^a-z_A-Z0-9\x80-\xFF] {
1707 if (!yyextra->skip)
1708 {
1710 }
1711 }
1712<SkipCond>{CMD}"endcond"/[^a-z_A-Z0-9\x80-\xFF] {
1713 bool oldSkip = yyextra->skip;
1715 if (oldSkip && !yyextra->skip)
1716 {
1717 if (yyextra->ccomment)
1718 {
1720 }
1721 BEGIN(yyextra->condCtx);
1722 }
1723 }
static void endCondSection(yyscan_t yyscanner)
1724<SkipCComment,SkipCPPComment>{CMD}"endcond"/[^a-z_A-Z0-9\x80-\xFF] {
1725 bool oldSkip = yyextra->skip;
1727 if (oldSkip && !yyextra->skip)
1728 {
1729 BEGIN(yyextra->condCtx);
1730 }
1731 }
1732<SkipCondVerbatim>{LITERAL_BLOCK_END} { /* end of verbatim block */
1733 if (yytext[1]=='f' && yyextra->blockName==&yytext[2])
1734 {
1735 BEGIN(SkipCond);
1736 }
1737 else if (&yytext[4]==yyextra->blockName)
1738 {
1739 BEGIN(SkipCond);
1740 }
1741 }
1742<SkipVerbatim>{LITERAL_BLOCK_END} { /* end of verbatim block */
1744 if (yytext[1]=='f' && yyextra->blockName==&yytext[2])
1745 {
1746 BEGIN(SkipCComment);
1747 }
1748 else if (&yytext[4]==yyextra->blockName)
1749 {
1750 BEGIN(SkipCComment);
1751 }
1752 }
1753<SkipCondVerbatim>^({B}*"*"+)?{B}{0,3}"~~~"[~]* {
1754 if (yyextra->fenceSize==
getFenceSize(yytext,yyleng) && yyextra->fenceChar==
'~')
1755 {
1756 BEGIN(SkipCond);
1757 }
1758 }
1759<SkipCondVerbatim>^({B}*"*"+)?{B}{0,3}"```"[`]* {
1760 if (yyextra->fenceSize==
getFenceSize(yytext,yyleng) && yyextra->fenceChar==
'`')
1761 {
1762 BEGIN(SkipCond);
1763 }
1764 }
1765<SkipVerbatim>^({B}*"*"+)?{B}{0,3}"~~~"[~]* {
1767 if (yyextra->fenceSize==
getFenceSize(yytext,yyleng) && yyextra->fenceChar==
'~')
1768 {
1769 BEGIN(SkipCComment);
1770 }
1771 }
1772<SkipVerbatim>^({B}*"*"+)?{B}{0,3}"```"[`]* {
1774 if (yyextra->fenceSize==
getFenceSize(yytext,yyleng) && yyextra->fenceChar==
'`')
1775 {
1776 BEGIN(SkipCComment);
1777 }
1778 }
1779<SkipCondVerbatim>{CCE}|{CCS} { }
1780<SkipVerbatim>{CCE}|{CCS} {
1782 }
1783<JavaDocVerbatimCode>"{" {
1784 if (yyextra->javaBlock==0)
1785 {
1786 REJECT;
1787 }
1788 else
1789 {
1790 yyextra->javaBlock++;
1792 }
1793 }
1794<JavaDocVerbatimCode>"}" {
1795 if (yyextra->javaBlock==0)
1796 {
1797 REJECT;
1798 }
1799 else
1800 {
1801 yyextra->javaBlock--;
1802 if (yyextra->javaBlock==0)
1803 {
1805 BEGIN(SkipCComment);
1806 }
1807 else
1808 {
1810 }
1811 }
1812 }
1813<JavaDocVerbatimCode>\n { /* new line in verbatim block */
1815 }
1816<JavaDocVerbatimCode>. { /* any other character */
1818 }
1819<SkipCondVerbatim>[^{*\\@\x06~`\n\/]+ { }
1820<SkipCComment,SkipVerbatim>[^{*\\@\x06~`\n\/]+ {
1822 }
1823<SkipCComment,SkipVerbatim,SkipCondVerbatim>\n {
1824 yyextra->yyLineNr++;
1826 }
1827<SkipCondVerbatim>. { }
1828<SkipCComment,SkipVerbatim>. {
1830 }
1831<CopyCComment>[^*a-z_A-Z\x80-\xFF\n]*[^*a-z_A-Z\x80-\xFF\\\n] {
1832 yyextra->defLitText+=yytext;
1833 yyextra->defText+=
escapeAt(yytext);
1834 }
static QCString escapeAt(const QCString &text)
1835<CopyCComment>\\[\r]?\n {
1836 yyextra->defLitText+=yytext;
1837 yyextra->defText+=" ";
1838 yyextra->yyLineNr++;
1839 yyextra->yyMLines++;
1840 }
1841<CopyCComment>{CCE} {
1842 yyextra->defLitText+=yytext;
1843 yyextra->defText+=yytext;
1844 BEGIN(yyextra->lastCContext);
1845 }
1846<CopyCComment>\n {
1847 yyextra->yyLineNr++;
1848 yyextra->defLitText+=yytext;
1849 yyextra->defText+=' ';
1850 }
1851<RemoveCComment>{CCE}{B}*"#" { // see bug 594021 for a usecase for this rule
1852 if (yyextra->lastCContext==SkipCPPBlock)
1853 {
1854 BEGIN(SkipCommand);
1855 }
1856 else
1857 {
1858 REJECT;
1859 }
1860 }
1861<RemoveCComment>{CCE} { BEGIN(yyextra->lastCContext); }
1862<RemoveCComment>{CPPC}
1863<RemoveCComment>{CCS}
1864<RemoveCComment>[^*\x06\n]+
1865<RemoveCComment>\n { yyextra->yyLineNr++; outputChar(yyscanner,'\n'); }
1866<RemoveCComment>.
1867<SkipCPPComment>[^\n\/\\@]+ {
1869 }
1870<SkipCPPComment,RemoveCPPComment>\n {
1871 unput(*yytext);
1872 BEGIN(yyextra->lastCPPContext);
1873 }
1874<SkipCPPComment>{CCS} {
1876 }
1877<SkipCPPComment>{CPPC} {
1879 }
1880<SkipCPPComment>[^\x06\@\\\n]+ {
1882 }
1883<SkipCPPComment>. {
1885 }
1886<RemoveCPPComment>{CCS}
1887<RemoveCPPComment>{CPPC}
1888<RemoveCPPComment>[^\x06\n]+
1889<RemoveCPPComment>.
1890<DefineText>"__VA_OPT__("{B}*"##" {
1891 warn(yyextra->fileName,yyextra->yyLineNr,
1892 "'##' may not appear at the beginning of a __VA_OPT__()",
1893 yyextra->defName,yyextra->defLitText.stripWhiteSpace());
1894 yyextra->defText+="__VA_OPT__(";
1895 yyextra->defLitText+="__VA_OPT__(";
1896 }
1897<DefineText>"#"/"__VA_OPT__" {
1898 yyextra->defText+=yytext;
1899 yyextra->defLitText+=yytext;
1900 }
1901<DefineText>"#"/{IDSTART} {
1903 yyextra->quoteArg=
TRUE;
1904 yyextra->idStart=true;
1905 yyextra->defLitText+=yytext;
1906 }
1907<DefineText,CopyCComment>{ID} {
1908 yyextra->defLitText+=yytext;
1909 if (YY_START == DefineText)
outputSpaces(yyscanner,yytext);
1910 if (yyextra->quoteArg)
1911 {
1912 yyextra->defText+="\"";
1913 }
1914 if (yyextra->defArgs>0)
1915 {
1916 auto it = yyextra->argMap.find(yytext);
1917 if (it!=yyextra->argMap.end())
1918 {
1919 int n = it->second;
1920 yyextra->defText+='@';
1922 }
1923 else
1924 {
1925 if (yyextra->idStart)
1926 {
1927 warn(yyextra->fileName,yyextra->yyLineNr,
1928 "'#' is not followed by a macro parameter '{}': '{}'",
1929 yyextra->defName,yyextra->defLitText.stripWhiteSpace());
1930 }
1931 yyextra->defText+=yytext;
1932 }
1933 }
1934 else
1935 {
1936 yyextra->defText+=yytext;
1937 }
1938 if (yyextra->quoteArg)
1939 {
1940 yyextra->defText+="\"";
1941 }
1942 yyextra->quoteArg=
FALSE;
1943 yyextra->idStart=false;
1944 }
1945<CopyCComment>. {
1946 yyextra->defLitText+=yytext;
1947 yyextra->defText+=yytext;
1948 }
1949<DefineText>\\[\r]?\n {
1950 yyextra->defLitText+=yytext;
1953 yyextra->defText += ' ';
1954 yyextra->yyLineNr++;
1955 yyextra->yyMLines++;
1956 }
1957<DefineText>\n {
1959 yyextra->defText = yyextra->defText.stripWhiteSpace();
1960 if (yyextra->defText.startsWith("##"))
1961 {
1962 warn(yyextra->fileName,yyextra->yyLineNr,
1963 "'##' cannot occur at the beginning of a macro definition '{}': '{}'",
1964 yyextra->defName,yyextra->defLitText.stripWhiteSpace());
1965 }
1966 else if (yyextra->defText.endsWith("##"))
1967 {
1968 warn(yyextra->fileName,yyextra->yyLineNr,
1969 "'##' cannot occur at the end of a macro definition '{}': '{}'",
1970 yyextra->defName,yyextra->defLitText.stripWhiteSpace());
1971 }
1972 else if (yyextra->defText.endsWith("#"))
1973 {
1974 warn(yyextra->fileName,yyextra->yyLineNr,
1975 "expected formal parameter after # in macro definition '{}': '{}'",
1976 yyextra->defName,yyextra->defLitText.stripWhiteSpace());
1977 }
1979 {
1981 yyextra->defLitText=yyextra->defLitText.left(yyextra->defLitText.length()-
comment.length()-1);
1982 }
1984 yyextra->defLitText+=yytext;
1986
1987 if (yyextra->includeStack.empty() || yyextra->curlyCount>0)
1988 {
1990 }
1991 def=
isDefined(yyscanner,yyextra->defName);
1992 if (def==0)
1993 {
1994
1996 }
1997 else if (def )
1998
1999 {
2000
2001
2003 {
2005 def->
name = yyextra->defName;
2007 def->
nargs = yyextra->defArgs;
2009 def->
lineNr = yyextra->yyLineNr-yyextra->yyMLines;
2011 }
2012 else
2013 {
2014 if (def->
fileName != yyextra->fileName && !yyextra->expandOnlyPredef)
addDefine(yyscanner);
2015
2016 }
2017 }
2018 yyextra->argMap.clear();
2019 yyextra->yyLineNr++;
2020 yyextra->yyColNr=1;
2021 yyextra->lastGuardName.clear();
2022 BEGIN(Start);
2023 }
static void addMacroDefinition(yyscan_t yyscanner)
static void addDefine(yyscan_t yyscanner)
static QCString extractTrailingComment(const QCString &s)
2024<DefineText>{B}* { outputString(yyscanner,yytext);
2025 yyextra->defText += ' ';
2026 yyextra->defLitText+=yytext;
2027 }
2028<DefineText>{B}*"##"{B}* { outputString(yyscanner,substitute(yytext,"##"," "));
2029 yyextra->defText += "##";
2030 yyextra->defLitText+=yytext;
2031 }
2032<DefineText>"@" { outputString(yyscanner,substitute(yytext,"@@"," "));
2033 yyextra->defText += "@@";
2034 yyextra->defLitText+=yytext;
2035 }
2036<DefineText>\" {
2038 yyextra->defText += *yytext;
2039 yyextra->defLitText+=yytext;
2040 if (!yyextra->insideComment)
2041 {
2042 BEGIN(SkipDoubleQuote);
2043 }
2044 }
2045<DefineText>{NUMBER} {
2047 yyextra->defText += yytext;
2048 yyextra->defLitText+=yytext;
2049 }
2050<DefineText>\' {
2052 yyextra->defText += *yytext;
2053 yyextra->defLitText+=yytext;
2054 if (!yyextra->insideComment)
2055 {
2056 BEGIN(SkipSingleQuote);
2057 }
2058 }
2059<SkipDoubleQuote>{CPPC}[/]? { outputSpaces(yyscanner,yytext);
2060 yyextra->defText += yytext;
2061 yyextra->defLitText+=yytext;
2062 }
2063<SkipDoubleQuote>{CCS}[*]? { outputSpaces(yyscanner,yytext);
2064 yyextra->defText += yytext;
2065 yyextra->defLitText+=yytext;
2066 }
2067<SkipDoubleQuote>\" {
2069 yyextra->defText += *yytext;
2070 yyextra->defLitText+=yytext;
2071 BEGIN(DefineText);
2072 }
2073<SkipSingleQuote,SkipDoubleQuote>\\. {
2075 yyextra->defText += yytext;
2076 yyextra->defLitText+=yytext;
2077 }
2078<SkipSingleQuote>\' {
2080 yyextra->defText += *yytext;
2081 yyextra->defLitText+=yytext;
2082 BEGIN(DefineText);
2083 }
2084<SkipDoubleQuote,SkipSingleQuote>. { outputSpace(yyscanner,yytext[0]);
2085 yyextra->defText += *yytext;
2086 yyextra->defLitText += *yytext;
2087 }
2088<DefineText>. { outputSpace(yyscanner,yytext[0]);
2089 yyextra->defText += *yytext;
2090 yyextra->defLitText += *yytext;
2091 }
2092<<EOF>> {
2093 TRACE(
"End of include file");
2094
2095 if (yyextra->includeStack.empty())
2096 {
2097 TRACE(
"Terminating scanner");
2099 }
2100 else
2101 {
2102 if (!yyextra->levelGuard.empty())
2103 {
2104 if (yyextra->condGuardErrorLine!=0)
2105 {
2106 warn(yyextra->condGuardErrorFileName,yyextra->condGuardErrorLine,
"{}",yyextra->condGuardErrorMessage);
2107 }
2108 else
2109 {
2110 warn(yyextra->fileName,yyextra->yyLineNr,
"More #endif's than #if's found.");
2111 }
2112 }
2113 QCString toFileName = yyextra->fileName;
2114 const std::unique_ptr<FileState> &fs=yyextra->includeStack.back();
2115
2116 YY_BUFFER_STATE oldBuf = YY_CURRENT_BUFFER;
2117 yy_switch_to_buffer( fs->bufState, yyscanner );
2118 yy_delete_buffer( oldBuf, yyscanner );
2119 yyextra->yyLineNr = fs->lineNr;
2120
2121 yyextra->inputBuf = fs->oldFileBuf;
2122 yyextra->inputBufPos = fs->oldFileBufPos;
2123 yyextra->curlyCount = fs->curlyCount;
2124 yyextra->levelGuard = fs->levelGuard;
2126 TRACE(
"switching to {}",yyextra->fileName);
2127
2128
2129
2131 lineStr.sprintf(
"# %d \"%s\" 2",yyextra->yyLineNr,
qPrint(yyextra->fileName));
2133
2134 yyextra->includeStack.pop_back();
2135
2136 {
2138
2139
2140
2141
2143 {
2144
2147 }
2148 else
2149 {
2151 {
2153 }
2154 }
2155 }
2156
2157 for (const auto &kv : yyextra->localDefines)
2158 {
2159 auto pair = yyextra->contextDefines.insert(kv);
2160 if (!pair.second)
2161 {
2162 yyextra->contextDefines.erase(pair.first);
2163 yyextra->contextDefines.insert(kv);
2164 }
2165 }
2166 yyextra->localDefines.clear();
2167 }
2168 }
2169<*>{CCS}/{CCE} |
2170<*>{CCS}[*!]? {
2171 if (YY_START==SkipVerbatim || YY_START == SkipCondVerbatim || YY_START==SkipCond || YY_START==IDLquote || YY_START == PragmaOnce)
2172 {
2173 REJECT;
2174 }
2175 else
2176 {
2178 yyextra->lastCContext=YY_START;
2179 yyextra->commentCount=1;
2180 if (yyleng==3)
2181 {
2182 yyextra->isSpecialComment = true;
2183 yyextra->lastGuardName.clear();
2184 }
2185 else
2186 {
2187 yyextra->isSpecialComment = false;
2188 }
2189 BEGIN(SkipCComment);
2190 }
2191 }
2192<*>{CPPC}[/!]? {
2193 if (YY_START==SkipVerbatim || YY_START == SkipCondVerbatim || YY_START==SkipCond ||
getLanguageFromFileName(yyextra->fileName)==SrcLangExt::Fortran || YY_START==IDLquote || YY_START == PragmaOnce)
2194 {
2195 REJECT;
2196 }
2197 else if (YY_START==RulesRoundDouble)
2198 {
2199 REJECT;
2200 }
2201 else
2202 {
2204 yyextra->lastCPPContext=YY_START;
2205 if (yyleng==3)
2206 {
2207 yyextra->isSpecialComment = true;
2208 yyextra->lastGuardName.clear();
2209 }
2210 else
2211 {
2212 yyextra->isSpecialComment = false;
2213 }
2214 BEGIN(SkipCPPComment);
2215 }
2216 }
2217<*>\n {
2219 yyextra->yyLineNr++;
2220 }
2221<*>. {
2222 yyextra->expectGuard =
FALSE;
2224 }
2225
2226%%