490 {
492 }
static char resolveTrigraph(char c)
493<Start>^{B}*"#" {
494 yyextra->yyColNr+=(int)yyleng;
495 yyextra->yyMLines=0;
496 yyextra->potentialDefine=yytext;
497 BEGIN(Command);
498 }
499<Start>^("%top{"|"%{") {
502 BEGIN(LexCopyLine);
503 }
static void outputArray(yyscan_t yyscanner, const char *a, yy_size_t len)
504<Start>^{Bopt}"cpp_quote"{Bopt}"("{Bopt}\" {
505 if (yyextra->insideIDL)
506 {
507 BEGIN(IDLquote);
508 }
509 else
510 {
511 REJECT;
512 }
513 }
514<IDLquote>"\\\\" {
516 }
517<IDLquote>"\\\"" {
519 }
520<IDLquote>"\""{Bopt}")" {
521 BEGIN(Start);
522 }
523<IDLquote>\n {
525 yyextra->yyLineNr++;
526 }
527<IDLquote>. {
529 }
530<Start>^{Bopt}/[^#] {
532 BEGIN(CopyLine);
533 }
534<Start>^{B}*[a-z_A-Z\x80-\xFF][a-z_A-Z0-9\x80-\xFF]+{B}*"("[^\)\n]*")"/{BN}{1,10}*[:{] { // constructors?
535 int i;
536 for (i=(int)yyleng-1;i>=0;i--)
537 {
538 unput(yytext[i]);
539 }
540 BEGIN(CopyLine);
541 }
542<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
543<Start>^{B}*[_A-Z][_A-Z0-9]+{B}*"("[^\)\n]*")"{B}*\n | // function like macro
544<Start>^{B}*[_A-Z][_A-Z0-9]+{B}*"("[^\(\)\n]*"("[^\)\n]*")"[^\)\n]*")"/{B}*("//"|"/\*") | // function list macro with one (...) argument followed by comment
545<Start>^{B}*[_A-Z][_A-Z0-9]+{B}*"("[^\)\n]*")"/{B}*("//"|"/\*") { // function like macro followed by comment
548 int pos = name.find('(');
549 if (pos<0) pos=0;
550 name=name.left(pos).stripWhiteSpace();
#define Config_getBool(name)
551
553 if (skipFuncMacros && !yyextra->insideFtn &&
554 name!="Q_PROPERTY" &&
555 !(
556 (yyextra->includeStack.empty() || yyextra->curlyCount>0) &&
557 yyextra->macroExpansion &&
559
561 )
562 )
563 {
564
565 if (yytext[yyleng-1] == '\n')
566 {
568 yyextra->yyLineNr++;
569 }
570 }
571 else
572 {
573 int i;
574 for (i=(int)yyleng-1;i>=0;i--)
575 {
576 unput(yytext[i]);
577 }
578 BEGIN(CopyLine);
579 }
580 }
581<CopyLine,LexCopyLine>"extern"{BN}*"\""[^\"]+"\""{BN}*("{")? {
583 yyextra->yyLineNr+=text.
contains(
'\n');
585 }
586<CopyLine,LexCopyLine>{RAWBEGIN} {
589 BEGIN(CopyRawString);
590 }
QCString extractBeginRawStringDelimiter(const char *rawStart)
591<CopyLine,LexCopyLine>"{" { // count brackets inside the main file
592 if (yyextra->includeStack.empty())
593 {
594 yyextra->curlyCount++;
595 }
597 }
598<LexCopyLine>^"%}" {
600 }
601<CopyLine,LexCopyLine>"}" { // count brackets inside the main file
602 if (yyextra->includeStack.empty() && yyextra->curlyCount>0)
603 {
604 yyextra->curlyCount--;
605 }
607 }
608<CopyLine,LexCopyLine>"'"\\[0-7]{1,3}"'" {
610 }
611<CopyLine,LexCopyLine>"'"\\."'" {
613 }
614<CopyLine,LexCopyLine>"'"."'" {
616 }
617<CopyLine,LexCopyLine>[$]?@\" {
620 BEGIN( CopyStringCs );
621 }
622<CopyLine,LexCopyLine>\" {
625 {
626 BEGIN( CopyString );
627 }
628 else
629 {
630 BEGIN( CopyStringFtnDouble );
631 }
632 }
633<CopyLine,LexCopyLine>\' {
636 BEGIN( CopyStringFtn );
637 }
638<CopyString>[^\"\\\r\n]{1,1000} {
640 }
641<CopyStringCs>[^\"\r\n]{1,1000} {
643 }
644<CopyStringCs>\"\" {
646 }
647<CopyString>\\. {
649 }
650<CopyString,CopyStringCs>\" {
652 BEGIN( CopyLine );
653 }
654<CopyStringFtnDouble>[^\"\\\r\n]{1,1000} {
656 }
657<CopyStringFtnDouble>\\. {
659 }
660<CopyStringFtnDouble>\" {
662 BEGIN( CopyLine );
663 }
664<CopyStringFtn>[^\'\\\r\n]{1,1000} {
666 }
667<CopyStringFtn>\\. {
669 }
670<CopyStringFtn>\' {
672 BEGIN( CopyLine );
673 }
674<CopyRawString>{RAWEND} {
677 {
678 BEGIN( CopyLine );
679 }
680 }
QCString extractEndRawStringDelimiter(const char *rawEnd)
681<CopyRawString>[^)]{1,1000} {
683 }
684<CopyRawString>. {
686 }
687<CopyLine,LexCopyLine>{ID}/{BN}{0,80}"(" {
688 yyextra->expectGuard =
FALSE;
690
691
692
693
694
695
696
697
698 if ((yyextra->includeStack.empty() || yyextra->curlyCount>0) &&
699 yyextra->macroExpansion &&
702 )
703 {
704
705 yyextra->roundCount=0;
706 yyextra->defArgsStr=yytext;
708 {
713 }
714 else
715 {
716 yyextra->findDefArgContext = CopyLine;
717 BEGIN(FindDefineArgs);
718 }
719 }
720 else
721 {
723 }
724 }
static QCString expandMacro(yyscan_t yyscanner, const QCString &name)
725<CopyLine>{RulesDelim} {
727 yyextra->lexRulesPart = !yyextra->lexRulesPart;
729 }
730
731<CopyLine>{RulesSharp} {
732 if (!yyextra->lexRulesPart) REJECT;
733 if (yyextra->curlyCount) REJECT;
735 BEGIN(RulesPattern);
736 }
737<RulesPattern>{EscapeRulesChar} {
739 }
740<RulesPattern>{RulesCurly} {
742 }
743<RulesPattern>{StartDouble} {
745 yyextra->lastContext = YY_START;
746 BEGIN(RulesDouble);
747 }
748<RulesDouble,RulesRoundDouble>"\\\\" {
750 }
751<RulesDouble,RulesRoundDouble>"\\\"" {
753 }
754<RulesDouble>"\"" {
756 BEGIN( yyextra->lastContext ) ;
757 }
758<RulesRoundDouble>"\"" {
760 BEGIN(RulesRound) ;
761 }
762<RulesDouble,RulesRoundDouble>. {
764 }
765<RulesPattern>{StartSquare} {
767 yyextra->lastContext = YY_START;
768 BEGIN(RulesSquare);
769 }
770<RulesSquare,RulesRoundSquare>{CHARCE} {
772 }
773<RulesSquare,RulesRoundSquare>"\\[" |
774<RulesSquare,RulesRoundSquare>"\\]" {
776 }
777<RulesSquare>"]" {
779 BEGIN(RulesPattern);
780 }
781<RulesRoundSquare>"]" {
783 BEGIN(RulesRound) ;
784 }
785<RulesSquare,RulesRoundSquare>"\\\\" {
787 }
788<RulesSquare,RulesRoundSquare>. {
790 }
791<RulesPattern>{StartRoundQuest} {
793 yyextra->lastContext = YY_START;
794 BEGIN(RulesRoundQuest);
795 }
796<RulesRoundQuest>{nl} {
798 }
799<RulesRoundQuest>[^)] {
801 }
802<RulesRoundQuest>")" {
804 BEGIN(yyextra->lastContext);
805 }
806<RulesPattern>{StartRound} {
807 yyextra->roundCount++;
809 yyextra->lastContext = YY_START;
810 BEGIN(RulesRound);
811 }
812<RulesRound>{RulesCurly} {
814 }
815<RulesRound>{StartSquare} {
817 BEGIN(RulesRoundSquare);
818 }
819<RulesRound>{StartDouble} {
821 BEGIN(RulesRoundDouble);
822 }
823<RulesRound>{EscapeRulesChar} {
825 }
826<RulesRound>"(" {
827 yyextra->roundCount++;
829 }
830<RulesRound>")" {
831 yyextra->roundCount--;
833 if (!yyextra->roundCount) BEGIN( yyextra->lastContext ) ;
834 }
835<RulesRound>{nl} {
837 }
838<RulesRound>{B} {
840 }
841<RulesRound>. {
843 }
844<RulesPattern>{B} {
846 BEGIN(CopyLine);
847 }
848<RulesPattern>. {
850 }
851
852<CopyLine,LexCopyLine>{ID} {
854 if ((yyextra->includeStack.empty() || yyextra->curlyCount>0) &&
855 yyextra->macroExpansion &&
859 )
860 {
865 }
866 else
867 {
869 }
870 }
871<CopyLine,LexCopyLine>"\\"\r?/\n { // strip line continuation characters
873 }
874<CopyLine,LexCopyLine>\\. {
876 }
877<CopyLine,LexCopyLine>. {
879 }
880<CopyLine,LexCopyLine>\n {
882 BEGIN(Start);
883 yyextra->yyLineNr++;
884 yyextra->yyColNr=1;
885 }
886<FindDefineArgs>"(" {
887 yyextra->defArgsStr+='(';
888 yyextra->roundCount++;
889 }
890<FindDefineArgs>")" {
891 yyextra->defArgsStr+=')';
892 yyextra->roundCount--;
893 if (yyextra->roundCount==0)
894 {
896
897 if (yyextra->findDefArgContext==CopyLine)
898 {
900 BEGIN(yyextra->findDefArgContext);
901 }
902 else
903 {
905 yyextra->nospaces=
FALSE;
906 BEGIN(Start);
907 }
908 }
909 }
910
static void readIncludeFile(yyscan_t yyscanner, const QCString &inc)
911<FindDefineArgs>")"{B}*"(" {
912 yyextra->defArgsStr+=yytext;
913 }
914 */
915<FindDefineArgs>{CHARLIT} {
916 yyextra->defArgsStr+=yytext;
917 }
918<FindDefineArgs>{CCS}[*!]? {
919 yyextra->defArgsStr+=yytext;
920 BEGIN(ArgCopyCComment);
921 }
922<FindDefineArgs>{CPPC}[/!].*\n/{B}*{CPPC}[/!] { // replace multi line C++ style comment by C style comment
924 {
925 if (yytext[3]=='<')
926 {
927 yyextra->defArgsStr+=
QCString(
"/**< @brief ")+&yytext[4];
928 }
929 else
930 {
931 yyextra->defArgsStr+=
QCString(
"/** @brief ")+&yytext[3];
932 }
933 }
934 else
935 {
936 yyextra->defArgsStr+=
QCString(
"/**")+&yytext[3];
937 }
938 BEGIN(ArgCopyCppComment);
939 }
940<FindDefineArgs>{CPPC}[/!].*\n { // replace C++ single line style comment by C style comment
942 {
943 yyextra->defArgsStr+=
QCString(
"/**")+&yytext[3]+
" */";
944 }
945 else
946 {
947 if (yytext[3]=='<')
948 {
949 yyextra->defArgsStr+=
QCString(
"/**< @brief ")+&yytext[4]+
" */";
950 }
951 else
952 {
953 yyextra->defArgsStr+=
QCString(
"/** @brief ")+&yytext[3]+
" */";
954 }
955 }
956 }
957<FindDefineArgs>{CPPC}.*\n { // replace C++ single line style comment by C style comment
958 yyextra->defArgsStr+=
QCString(
"/*")+&yytext[2]+
" */";
959 }
960<FindDefineArgs>\" {
961 yyextra->defArgsStr+=*yytext;
962 BEGIN(ReadString);
963 }
964<FindDefineArgs>' {
966 yyextra->defArgsStr+=*yytext;
967 BEGIN(ReadString);
968 }
969<FindDefineArgs>\n {
970 yyextra->defArgsStr+=' ';
971 yyextra->yyLineNr++;
973 }
974<FindDefineArgs>"@" {
975 yyextra->defArgsStr+="@@";
976 }
977<FindDefineArgs>. {
978 yyextra->defArgsStr+=*yytext;
979 }
980<ArgCopyCComment>[^*\n]+ {
981 yyextra->defArgsStr+=yytext;
982 }
983<ArgCopyCComment>{CCE} {
984 yyextra->defArgsStr+=yytext;
985 BEGIN(FindDefineArgs);
986 }
987<ArgCopyCComment>\n {
988 yyextra->defArgsStr+=yytext;
989 yyextra->yyLineNr++;
990 }
991<ArgCopyCComment>. {
992 yyextra->defArgsStr+=yytext;
993 }
994<ArgCopyCppComment>^{B}*
995<ArgCopyCppComment>{CPPC}[/!].*\n/{B}*{CPPC}[/!] { // replace multi line C++ style comment by C style comment
996 const char *startContent = &yytext[3];
997 if (startContent[0]=='<') startContent++;
998 yyextra->defArgsStr+=startContent;
999 }
1000<ArgCopyCppComment>{CPPC}[/!].*\n { // replace C++ multie line style comment by C style comment
1001 const char *startContent = &yytext[3];
1002 if (startContent[0]=='<') startContent++;
1003 yyextra->defArgsStr+=
QCString(startContent)+
" */";
1004 BEGIN(FindDefineArgs);
1005 }
1006<ArgCopyCppComment>. { // unexpected character
1007 unput(*yytext);
1008 yyextra->defArgsStr+=" */";
1009 BEGIN(FindDefineArgs);
1010 }
1011<ReadString>"\"" {
1012 yyextra->defArgsStr+=*yytext;
1013 BEGIN(FindDefineArgs);
1014 }
1015<ReadString>"'" {
1017 yyextra->defArgsStr+=*yytext;
1018 BEGIN(FindDefineArgs);
1019 }
1020
1021<ReadString>{CPPC}|{CCS} {
1022 yyextra->defArgsStr+=yytext;
1023 }
1024<ReadString>\\/\r?\n { // line continuation
1025 }
1026<ReadString>\\. {
1027 yyextra->defArgsStr+=yytext;
1028 }
1029<ReadString>. {
1030 yyextra->defArgsStr+=*yytext;
1031 }
1032<Command>("include"|"import"){B}+/{ID} {
1033 yyextra->isImported = yytext[1]=='m';
1034 if (yyextra->macroExpansion)
1035 BEGIN(IncludeID);
1036 }
1037<Command>("include"|"import"){B}*[<"] {
1038 yyextra->isImported = yytext[1]=='m';
1039 char c[2];
1040 c[0]=yytext[yyleng-1];c[1]='\0';
1041 yyextra->incName=c;
1042 BEGIN(Include);
1043 }
1044<Command>("cmake")?"define"{B}+ {
1045 yyextra->potentialDefine +=
substitute(yytext,
"cmake",
" ");
1046
1047 yyextra->yyColNr+=(int)yyleng;
1048 BEGIN(DefName);
1049 }
QCString substitute(const QCString &s, const QCString &src, const QCString &dst)
substitute all occurrences of src in s by dst
1050<Command>"cmakedefine01"{B}+ {
1051 yyextra->potentialDefine +=
substitute(yytext,
"cmakedefine01",
" define ");
1052
1053 yyextra->yyColNr+=(int)yyleng;
1054 BEGIN(CmakeDefName01);
1055 }
1056<Command>"ifdef"/{B}*"(" {
1058 yyextra->guardExpr.clear();
1059 BEGIN(DefinedExpr2);
1060 }
static void incrLevel(yyscan_t yyscanner)
1061<Command>"ifdef"/{B}+ {
1062
1064 yyextra->guardExpr.clear();
1065 BEGIN(DefinedExpr1);
1066 }
1067<Command>"ifndef"/{B}*"(" {
1069 yyextra->guardExpr="! ";
1070 BEGIN(DefinedExpr2);
1071 }
1072<Command>"ifndef"/{B}+ {
1074 yyextra->guardExpr="! ";
1075 BEGIN(DefinedExpr1);
1076 }
1077<Command>"if"/[ \t(!] {
1079 yyextra->guardExpr.clear();
1080 BEGIN(Guard);
1081 }
1082<Command>("elif"|"else"{B}*"if")/[ \t(!] {
1084 {
1085 yyextra->guardExpr.clear();
1086 BEGIN(Guard);
1087 }
1088 else
1089 {
1090 yyextra->ifcount=0;
1091 BEGIN(SkipCPPBlock);
1092 }
1093 }
static bool otherCaseDone(yyscan_t yyscanner)
1094<Command>"else"/[^a-z_A-Z0-9\x80-\xFF] {
1096 {
1097 yyextra->ifcount=0;
1098 BEGIN(SkipCPPBlock);
1099 }
1100 else
1101 {
1103 }
1104 }
static void setCaseDone(yyscan_t yyscanner, bool value)
1105<Command>"undef"{B}+ {
1106 BEGIN(UndefName);
1107 }
1108<Command>("elif"|"else"{B}*"if")/[ \t(!] {
1110 {
1111 yyextra->guardExpr.clear();
1112 BEGIN(Guard);
1113 }
1114 }
1115<Command>"endif"/[^a-z_A-Z0-9\x80-\xFF] {
1116
1118 }
static void decrLevel(yyscan_t yyscanner)
1119<Command,IgnoreLine>\n {
1121 BEGIN(Start);
1122 yyextra->yyLineNr++;
1123 }
1124<Command>"pragma"{B}+"once" {
1125 yyextra->expectGuard =
FALSE;
1126 if (yyextra->pragmaSet.find(yyextra->fileName.str())!=yyextra->pragmaSet.end())
1127 {
1129 BEGIN(PragmaOnce);
1130 }
1131 else
1132 {
1133 yyextra->pragmaSet.insert(yyextra->fileName.data());
1134 }
1135 }
1136<PragmaOnce>. {}
1137<PragmaOnce>\n {}
1138<PragmaOnce><<EOF>> {
1139 yyextra->expectGuard =
FALSE;
1140 BEGIN(Start);
1141 }
1142<Command>{ID} { // unknown directive
1143 BEGIN(IgnoreLine);
1144 }
1145<IgnoreLine>\\[\r]?\n {
1147 yyextra->yyLineNr++;
1148 }
1149<IgnoreLine>.
1150<Command>. { yyextra->potentialDefine += yytext[0]=='\t' ? '\t' : ' ';
1151 yyextra->yyColNr+=(int)yyleng;
1152 }
1153<UndefName>{ID} {
1156
1158 )
1159 {
1160
1162 }
1163 BEGIN(Start);
1164 }
1165<Guard>\\[\r]?\n {
1167 yyextra->guardExpr+=' ';
1168 yyextra->yyLineNr++;
1169 }
1170<Guard>"defined"/{B}*"(" {
1171 BEGIN(DefinedExpr2);
1172 }
1173<Guard>"defined"/{B}+ {
1174 BEGIN(DefinedExpr1);
1175 }
1176<Guard>"true"/{B}|{B}*[\r]?\n { yyextra->guardExpr+="1L"; }
1177<Guard>"false"/{B}|{B}*[\r]?\n { yyextra->guardExpr+="0L"; }
1178<Guard>"not"/{B} { yyextra->guardExpr+='!'; }
1179<Guard>"not_eq"/{B} { yyextra->guardExpr+="!="; }
1180<Guard>"and"/{B} { yyextra->guardExpr+="&&"; }
1181<Guard>"or"/{B} { yyextra->guardExpr+="||"; }
1182<Guard>"bitand"/{B} { yyextra->guardExpr+="&"; }
1183<Guard>"bitor"/{B} { yyextra->guardExpr+="|"; }
1184<Guard>"xor"/{B} { yyextra->guardExpr+="^"; }
1185<Guard>"compl"/{B} { yyextra->guardExpr+="~"; }
1186<Guard>{ID} { yyextra->guardExpr+=yytext; }
1187<Guard>"@" { yyextra->guardExpr+="@@"; }
1188<Guard>. { yyextra->guardExpr+=*yytext; }
1189<Guard>\n {
1190 unput(*yytext);
1191
1192
1195 if (guard)
1196 {
1197 BEGIN(Start);
1198 }
1199 else
1200 {
1201 yyextra->ifcount=0;
1202 BEGIN(SkipCPPBlock);
1203 }
1204 }
static bool computeExpression(yyscan_t yyscanner, const QCString &expr)
1205<DefinedExpr1,DefinedExpr2>\\\n { yyextra->yyLineNr++; outputChar(yyscanner,'\n'); }
1206<DefinedExpr1>{ID} {
1207 if (
isDefined(yyscanner,yytext) || yyextra->guardName==yytext)
1208 yyextra->guardExpr+=" 1L ";
1209 else
1210 yyextra->guardExpr+=" 0L ";
1211 yyextra->lastGuardName=yytext;
1212 BEGIN(Guard);
1213 }
1214<DefinedExpr2>{ID} {
1215 if (
isDefined(yyscanner,yytext) || yyextra->guardName==yytext)
1216 yyextra->guardExpr+=" 1L ";
1217 else
1218 yyextra->guardExpr+=" 0L ";
1219 yyextra->lastGuardName=yytext;
1220 }
1221<DefinedExpr1,DefinedExpr2>\n { // should not happen, handle anyway
1222 yyextra->yyLineNr++;
1223 yyextra->ifcount=0;
1224 BEGIN(SkipCPPBlock);
1225 }
1226<DefinedExpr2>")" {
1227 BEGIN(Guard);
1228 }
1229<DefinedExpr1,DefinedExpr2>.
1230<SkipCPPBlock>^{B}*"#" { BEGIN(SkipCommand); }
1231<SkipCPPBlock>^{Bopt}/[^#] { BEGIN(SkipLine); }
1232<SkipCPPBlock>\n { yyextra->yyLineNr++; outputChar(yyscanner,'\n'); }
1233<SkipCPPBlock>.
1234<SkipCommand>"if"(("n")?("def"))?/[ \t(!] {
1236 yyextra->ifcount++;
1237
1238 }
1239<SkipCommand>"else" {
1240
1242 {
1244
1245 BEGIN(Start);
1246 }
1247 }
1248<SkipCommand>("elif"|"else"{B}*"if")/[ \t(!] {
1249 if (yyextra->ifcount==0)
1250 {
1252 {
1253 yyextra->guardExpr.clear();
1254 yyextra->lastGuardName.clear();
1255 BEGIN(Guard);
1256 }
1257 else
1258 {
1259 BEGIN(SkipCPPBlock);
1260 }
1261 }
1262 }
1263<SkipCommand>"endif" {
1264 yyextra->expectGuard =
FALSE;
1266 if (--yyextra->ifcount<0)
1267 {
1268
1269 BEGIN(Start);
1270 }
1271 }
1272<SkipCommand>\n {
1274 yyextra->yyLineNr++;
1275 BEGIN(SkipCPPBlock);
1276 }
1277<SkipCommand>{ID} { // unknown directive
1278 BEGIN(SkipLine);
1279 }
1280<SkipCommand>.
1281<SkipLine>[^'"/\n]+
1282<SkipLine>{CHARLIT} { }
1283<SkipLine>\" {
1284 BEGIN(SkipString);
1285 }
1286<SkipLine>.
1287<SkipString>{CPPC}/[^\n]* {
1288 }
1289<SkipLine,SkipCommand,SkipCPPBlock>{CPPC}[^\n]* {
1290 yyextra->lastCPPContext=YY_START;
1291 BEGIN(RemoveCPPComment);
1292 }
1293<SkipString>{CCS}/[^\n]* {
1294 }
1295<SkipLine,SkipCommand,SkipCPPBlock>{CCS}/[^\n]* {
1296 yyextra->lastCContext=YY_START;
1297 BEGIN(RemoveCComment);
1298 }
1299<SkipLine>\n {
1301 yyextra->yyLineNr++;
1302 BEGIN(SkipCPPBlock);
1303 }
1304<SkipString>[^"\\\n]+ { }
1305<SkipString>\\. { }
1306<SkipString>\" {
1307 BEGIN(SkipLine);
1308 }
1309<SkipString>. { }
1310<IncludeID>{ID}{Bopt}/"(" {
1311 yyextra->nospaces=
TRUE;
1312 yyextra->roundCount=0;
1313 yyextra->defArgsStr=yytext;
1314 yyextra->findDefArgContext = IncludeID;
1315 BEGIN(FindDefineArgs);
1316 }
1317<IncludeID>{ID} {
1318 yyextra->nospaces=
TRUE;
1320 BEGIN(Start);
1321 }
1322<Include>[^\">\n]+[\">] {
1323 yyextra->incName+=yytext;
1324 if (yyextra->isImported)
1325 {
1326 BEGIN(EndImport);
1327 }
1328 else
1329 {
1331 BEGIN(Start);
1332 }
1333 }
1334<EndImport>{ENDIMPORTopt}/\n {
1336 BEGIN(Start);
1337 }
1338<EndImport>\\[\r]?"\n" {
1340 yyextra->yyLineNr++;
1341 }
1342<EndImport>. {
1343 }
1344<DefName>{ID}/("\\\n")*"(" { // define with argument
1345
1346 yyextra->argMap.clear();
1347 yyextra->defArgs = 0;
1348 yyextra->defArgsStr.clear();
1349 yyextra->defText.clear();
1350 yyextra->defLitText.clear();
1351 yyextra->defName = yytext;
1352 yyextra->defVarArgs =
FALSE;
1353 yyextra->defExtraSpacing.clear();
1354 yyextra->defContinue = false;
1355 BEGIN(DefineArg);
1356 }
1357<DefName>{ID}{B}+"1"/[ \r\t\n] { // special case: define with 1 -> can be "guard"
1358
1359 yyextra->argMap.clear();
1360 yyextra->defArgs = -1;
1361 yyextra->defArgsStr.clear();
1363 yyextra->defVarArgs =
FALSE;
1364
1365
1366 if (yyextra->curlyCount>0 || yyextra->defName!=yyextra->lastGuardName || !yyextra->expectGuard)
1367 {
1368 QCString def = yyextra->potentialDefine +
1369 yyextra->defName ;
1371 outputSpaces(yyscanner,yytext+yyextra->defName.length());
1372 yyextra->quoteArg=
FALSE;
1373 yyextra->insideComment=
FALSE;
1374 yyextra->lastGuardName.clear();
1375 yyextra->defText="1";
1376 yyextra->defLitText="1";
1377 BEGIN(DefineText);
1378 }
1379 else
1380 {
1381
1382 yyextra->defText.clear();
1383 yyextra->defLitText.clear();
1384 BEGIN(Start);
1385 }
1386 yyextra->expectGuard=
FALSE;
1387 }
static void outputSpaces(yyscan_t yyscanner, char *s)
1388<DefName,CmakeDefName01>{ID}/{B}*"\n" { // empty define
1389 yyextra->argMap.clear();
1390 yyextra->defArgs = -1;
1391 yyextra->defName = yytext;
1392 yyextra->defArgsStr.clear();
1393 yyextra->defText.clear();
1394 yyextra->defLitText.clear();
1395 yyextra->defVarArgs =
FALSE;
1396
1397
1398 if (yyextra->curlyCount>0 || yyextra->defName!=yyextra->lastGuardName || !yyextra->expectGuard)
1399 {
1400 QCString def = yyextra->potentialDefine + yyextra->defName;
1402 yyextra->quoteArg=
FALSE;
1403 yyextra->insideComment=
FALSE;
1404 if (YY_START == CmakeDefName01) yyextra->defText = "0";
1405 else if (yyextra->insideCS) yyextra->defText="1";
1406 BEGIN(DefineText);
1407 }
1408 else
1409 {
1410
1411 yyextra->guardName = yytext;
1412 yyextra->lastGuardName.clear();
1413 BEGIN(Start);
1414 }
1415 yyextra->expectGuard=
FALSE;
1416 }
1417<DefName>{ID}/{B}* { // define with content
1418
1419 yyextra->argMap.clear();
1420 yyextra->defArgs = -1;
1421 yyextra->defArgsStr.clear();
1422 yyextra->defText.clear();
1423 yyextra->defLitText.clear();
1424 yyextra->defName = yytext;
1425 yyextra->defVarArgs =
FALSE;
1426 QCString def = yyextra->potentialDefine +
1427 yyextra->defName +
1428 yyextra->defArgsStr ;
1430 yyextra->quoteArg=
FALSE;
1431 yyextra->insideComment=
FALSE;
1432 BEGIN(DefineText);
1433 }
1434<DefineArg>"\\\n" {
1435 yyextra->defExtraSpacing+="\n";
1436 yyextra->defContinue = true;
1437 yyextra->yyLineNr++;
1438 }
1439<DefineArg>{B}* { yyextra->defExtraSpacing+=yytext; }
1440<DefineArg>","{B}* { yyextra->defArgsStr+=yytext; }
1441<DefineArg>"("{B}* { yyextra->defArgsStr+=yytext; }
1442<DefineArg>{B}*")"{B}* {
1444 yyextra->defArgsStr+=yytext;
1445 QCString def = yyextra->potentialDefine +
1446 yyextra->defName +
1447 yyextra->defArgsStr +
1448 yyextra->defExtraSpacing ;
1450 yyextra->quoteArg=
FALSE;
1451 yyextra->insideComment=
FALSE;
1452 BEGIN(DefineText);
1453 }
static void extraSpacing(yyscan_t yyscanner)
1454<DefineArg>"..." { // Variadic macro
1455 yyextra->defVarArgs =
TRUE;
1456 yyextra->defArgsStr+=yytext;
1457 yyextra->argMap.emplace(std::string("__VA_ARGS__"),yyextra->defArgs);
1458 yyextra->defArgs++;
1459 }
1460<DefineArg>{ID}{B}*("..."?) {
1461
1463 yyextra->defVarArgs = yytext[yyleng-1]=='.';
1464 if (yyextra->defVarArgs)
1465 {
1467 }
1469 yyextra->defArgsStr+=yytext;
1470 yyextra->argMap.emplace(
toStdString(argName),yyextra->defArgs);
1471 yyextra->defArgs++;
1473 }
1474
1475<DefineText>"/ **"|"/ *!" {
1476 yyextra->defText+=yytext;
1477 yyextra->defLitText+=yytext;
1478 yyextra->insideComment=
TRUE;
1479 }
1480<DefineText>"* /" {
1481 yyextra->defText+=yytext;
1482 yyextra->defLitText+=yytext;
1483 yyextra->insideComment=
FALSE;
1484 }
1485 */
1486<DefineText>{CCS}[!*]? {
1487 yyextra->defText+=yytext;
1488 yyextra->defLitText+=yytext;
1489 yyextra->lastCContext=YY_START;
1490 yyextra->commentCount=1;
1491 BEGIN(CopyCComment);
1492 }
1493<DefineText>{CPPC}[!/]? {
1495 yyextra->lastCPPContext=YY_START;
1496 yyextra->defLitText+=' ';
1497 BEGIN(SkipCPPComment);
1498 }
1499<SkipCComment>[/]?{CCE} {
1500 if (yytext[0]==
'/')
outputChar(yyscanner,
'/');
1502 if (--yyextra->commentCount<=0)
1503 {
1504 if (yyextra->lastCContext==Start)
1505
1506
1507 {
1508 YY_CURRENT_BUFFER->yy_at_bol=1;
1509 }
1510 BEGIN(yyextra->lastCContext);
1511 }
1512 }
1513<SkipCComment>{CPPC}("/")* {
1515 }
1516<SkipCComment>{CCS} {
1518
1519 }
1520<SkipCond>{CMD}{CMD} { }
1521<SkipCond>^({B}*"*"+)?{B}{0,3}"~~~"[~]* {
1523 if (!markdownSupport || !yyextra->isSpecialComment)
1524 {
1525 REJECT;
1526 }
1527 else
1528 {
1529 yyextra->fenceChar='~';
1531 BEGIN(SkipCondVerbatim);
1532 }
1533 }
static yy_size_t getFenceSize(char *txt, yy_size_t leng)
1534<SkipCond>^({B}*"*"+)?{B}{0,3}"```"[`]* {
1536 if (!markdownSupport || !yyextra->isSpecialComment)
1537 {
1538 REJECT;
1539 }
1540 else
1541 {
1542 yyextra->fenceChar='`';
1544 BEGIN(SkipCondVerbatim);
1545 }
1546 }
1547<SkipCComment>^({B}*"*"+)?{B}{0,3}"~~~"[~]* {
1549 if (!markdownSupport || !yyextra->isSpecialComment)
1550 {
1551 REJECT;
1552 }
1553 else
1554 {
1556 yyextra->fenceChar='~';
1558 BEGIN(SkipVerbatim);
1559 }
1560 }
1561<SkipCComment>^({B}*"*"+)?{B}{0,3}"```"[`]* {
1563 if (!markdownSupport || !yyextra->isSpecialComment)
1564 {
1565 REJECT;
1566 }
1567 else
1568 {
1570 yyextra->fenceChar='`';
1572 BEGIN(SkipVerbatim);
1573 }
1574 }
1575<SkipCComment>{CMD}{VERBATIM_LINE} |
1576<SkipCComment>{CMD}{LITERAL_BLOCK} { // escaped command
1579 }
1580<SkipCComment>{VERBATIM_LINE}.*/\n { // normal command
1582 }
1583<SkipCComment>{LITERAL_BLOCK} { // normal block command
1587 BEGIN(SkipVerbatim);
1588 }
static void determineBlockName(yyscan_t yyscanner)
1589<SkipCond>{CMD}{CMD}"cond"[ \t]+ {}// escaped cond command
1590<SkipCond>{CMD}"cond"/\n |
1591<SkipCond>{CMD}"cond"[ \t]+ { // cond command in a skipped cond section, this section has to be skipped as well
1592
1594 }
static void startCondSection(yyscan_t yyscanner, const QCString §Id)
1595<SkipCComment>"{"[ \t]*"@code"/[ \t\n] {
1597 yyextra->javaBlock=1;
1598 BEGIN(JavaDocVerbatimCode);
1599 }
1600<SkipCComment>"{"[ \t]*"@literal"/[ \t\n] {
1602 yyextra->javaBlock=1;
1603 BEGIN(JavaDocVerbatimCode);
1604 }
1605<SkipCComment,SkipCPPComment>{CMD}{CMD}"cond"[ \t\n]+ { // escaped cond command
1607 }
1608<SkipCPPComment>{CMD}"cond"[ \t]+ { // conditional section
1609 yyextra->ccomment=
TRUE;
1610 yyextra->condCtx=YY_START;
1611 BEGIN(CondLineCpp);
1612 }
1613<SkipCComment>{CMD}"cond"[ \t]+ { // conditional section
1614 yyextra->ccomment=
FALSE;
1615 yyextra->condCtx=YY_START;
1616 BEGIN(CondLineC);
1617 }
1618<CondLineC,CondLineCpp>[!()&| \ta-z_A-Z0-9\x80-\xFF.\-]+ {
1620 if (yyextra->skip)
1621 {
1622 if (YY_START==CondLineC)
1623 {
1624
1626 yyextra->ccomment=
TRUE;
1627 }
1628 else
1629 {
1630 yyextra->ccomment=
FALSE;
1631 }
1632 BEGIN(SkipCond);
1633 }
1634 else
1635 {
1636 BEGIN(yyextra->condCtx);
1637 }
1638 }
1639<CondLineC,CondLineCpp>. { // non-guard character
1640 unput(*yytext);
1642 if (yyextra->skip)
1643 {
1644 if (YY_START==CondLineC)
1645 {
1646
1648 yyextra->ccomment=
TRUE;
1649 }
1650 else
1651 {
1652 yyextra->ccomment=
FALSE;
1653 }
1654 BEGIN(SkipCond);
1655 }
1656 else
1657 {
1658 BEGIN(yyextra->condCtx);
1659 }
1660 }
1661<SkipCComment,SkipCPPComment>{CMD}"cond"{WSopt}/\n { // no guard
1662 if (YY_START==SkipCComment)
1663 {
1664 yyextra->ccomment=
TRUE;
1665
1667 }
1668 else
1669 {
1670 yyextra->ccomment=
FALSE;
1671 }
1672 yyextra->condCtx=YY_START;
1674 BEGIN(SkipCond);
1675 }
1676<SkipCond>\n { yyextra->yyLineNr++; outputChar(yyscanner,'\n'); }
1677<SkipCond>{VERBATIM_LINE}.*/\n { }
1678<SkipCond>{LITERAL_BLOCK} {
1680 yyextra->yyLineNr+=numNLs;
1681 for (
int i = 0; i < numNLs; i++)
outputChar(yyscanner,
'\n');
1683 BEGIN(SkipCondVerbatim);
1684 }
1685
1686<SkipCond>. { }
1687<SkipCond>[^\/\!*\\@\n]+ { }
1688<SkipCond>{CPPC}[/!] { yyextra->ccomment=FALSE; }
1689<SkipCond>{CCS}[*!] { yyextra->ccomment=TRUE; }
1690<SkipCond,SkipCComment,SkipCPPComment>{CMD}{CMD}"endcond"/[^a-z_A-Z0-9\x80-\xFF] {
1691 if (!yyextra->skip)
1692 {
1694 }
1695 }
1696<SkipCond>{CMD}"endcond"/[^a-z_A-Z0-9\x80-\xFF] {
1697 bool oldSkip = yyextra->skip;
1699 if (oldSkip && !yyextra->skip)
1700 {
1701 if (yyextra->ccomment)
1702 {
1704 }
1705 BEGIN(yyextra->condCtx);
1706 }
1707 }
static void endCondSection(yyscan_t yyscanner)
1708<SkipCComment,SkipCPPComment>{CMD}"endcond"/[^a-z_A-Z0-9\x80-\xFF] {
1709 bool oldSkip = yyextra->skip;
1711 if (oldSkip && !yyextra->skip)
1712 {
1713 BEGIN(yyextra->condCtx);
1714 }
1715 }
1716<SkipCondVerbatim>{LITERAL_BLOCK_END} { /* end of verbatim block */
1717 if (yytext[1]=='f' && yyextra->blockName==&yytext[2])
1718 {
1719 BEGIN(SkipCond);
1720 }
1721 else if (&yytext[4]==yyextra->blockName)
1722 {
1723 BEGIN(SkipCond);
1724 }
1725 }
1726<SkipVerbatim>{LITERAL_BLOCK_END} { /* end of verbatim block */
1728 if (yytext[1]=='f' && yyextra->blockName==&yytext[2])
1729 {
1730 BEGIN(SkipCComment);
1731 }
1732 else if (&yytext[4]==yyextra->blockName)
1733 {
1734 BEGIN(SkipCComment);
1735 }
1736 }
1737<SkipCondVerbatim>^({B}*"*"+)?{B}{0,3}"~~~"[~]* {
1738 if (yyextra->fenceSize==
getFenceSize(yytext,yyleng) && yyextra->fenceChar==
'~')
1739 {
1740 BEGIN(SkipCond);
1741 }
1742 }
1743<SkipCondVerbatim>^({B}*"*"+)?{B}{0,3}"```"[`]* {
1744 if (yyextra->fenceSize==
getFenceSize(yytext,yyleng) && yyextra->fenceChar==
'`')
1745 {
1746 BEGIN(SkipCond);
1747 }
1748 }
1749<SkipVerbatim>^({B}*"*"+)?{B}{0,3}"~~~"[~]* {
1751 if (yyextra->fenceSize==
getFenceSize(yytext,yyleng) && yyextra->fenceChar==
'~')
1752 {
1753 BEGIN(SkipCComment);
1754 }
1755 }
1756<SkipVerbatim>^({B}*"*"+)?{B}{0,3}"```"[`]* {
1758 if (yyextra->fenceSize==
getFenceSize(yytext,yyleng) && yyextra->fenceChar==
'`')
1759 {
1760 BEGIN(SkipCComment);
1761 }
1762 }
1763<SkipCondVerbatim>{CCE}|{CCS} { }
1764<SkipVerbatim>{CCE}|{CCS} {
1766 }
1767<JavaDocVerbatimCode>"{" {
1768 if (yyextra->javaBlock==0)
1769 {
1770 REJECT;
1771 }
1772 else
1773 {
1774 yyextra->javaBlock++;
1776 }
1777 }
1778<JavaDocVerbatimCode>"}" {
1779 if (yyextra->javaBlock==0)
1780 {
1781 REJECT;
1782 }
1783 else
1784 {
1785 yyextra->javaBlock--;
1786 if (yyextra->javaBlock==0)
1787 {
1789 BEGIN(SkipCComment);
1790 }
1791 else
1792 {
1794 }
1795 }
1796 }
1797<JavaDocVerbatimCode>\n { /* new line in verbatim block */
1799 }
1800<JavaDocVerbatimCode>. { /* any other character */
1802 }
1803<SkipCondVerbatim>[^{*\\@\x06~`\n\/]+ { }
1804<SkipCComment,SkipVerbatim>[^{*\\@\x06~`\n\/]+ {
1806 }
1807<SkipCComment,SkipVerbatim,SkipCondVerbatim>\n {
1808 yyextra->yyLineNr++;
1810 }
1811<SkipCondVerbatim>. { }
1812<SkipCComment,SkipVerbatim>. {
1814 }
1815<CopyCComment>[^*a-z_A-Z\x80-\xFF\n]*[^*a-z_A-Z\x80-\xFF\\\n] {
1816 yyextra->defLitText+=yytext;
1817 yyextra->defText+=
escapeAt(yytext);
1818 }
static QCString escapeAt(const QCString &text)
1819<CopyCComment>\\[\r]?\n {
1820 yyextra->defLitText+=yytext;
1821 yyextra->defText+=" ";
1822 yyextra->yyLineNr++;
1823 yyextra->yyMLines++;
1824 }
1825<CopyCComment>{CCE} {
1826 yyextra->defLitText+=yytext;
1827 yyextra->defText+=yytext;
1828 BEGIN(yyextra->lastCContext);
1829 }
1830<CopyCComment>\n {
1831 yyextra->yyLineNr++;
1832 yyextra->defLitText+=yytext;
1833 yyextra->defText+=' ';
1834 }
1835<RemoveCComment>{CCE}{B}*"#" { // see bug 594021 for a usecase for this rule
1836 if (yyextra->lastCContext==SkipCPPBlock)
1837 {
1838 BEGIN(SkipCommand);
1839 }
1840 else
1841 {
1842 REJECT;
1843 }
1844 }
1845<RemoveCComment>{CCE} { BEGIN(yyextra->lastCContext); }
1846<RemoveCComment>{CPPC}
1847<RemoveCComment>{CCS}
1848<RemoveCComment>[^*\x06\n]+
1849<RemoveCComment>\n { yyextra->yyLineNr++; outputChar(yyscanner,'\n'); }
1850<RemoveCComment>.
1851<SkipCPPComment>[^\n\/\\@]+ {
1853 }
1854<SkipCPPComment,RemoveCPPComment>\n {
1855 unput(*yytext);
1856 BEGIN(yyextra->lastCPPContext);
1857 }
1858<SkipCPPComment>{CCS} {
1860 }
1861<SkipCPPComment>{CPPC} {
1863 }
1864<SkipCPPComment>[^\x06\@\\\n]+ {
1866 }
1867<SkipCPPComment>. {
1869 }
1870<RemoveCPPComment>{CCS}
1871<RemoveCPPComment>{CPPC}
1872<RemoveCPPComment>[^\x06\n]+
1873<RemoveCPPComment>.
1874<DefineText>"#"/{IDSTART} {
1876 yyextra->quoteArg=
TRUE;
1877 yyextra->idStart=true;
1878 yyextra->defLitText+=yytext;
1879 }
1880<DefineText,CopyCComment>{ID} {
1881 yyextra->defLitText+=yytext;
1882 if (YY_START == DefineText)
outputSpaces(yyscanner,yytext);
1883 if (yyextra->quoteArg)
1884 {
1885 yyextra->defText+="\"";
1886 }
1887 if (yyextra->defArgs>0)
1888 {
1889 auto it = yyextra->argMap.find(yytext);
1890 if (it!=yyextra->argMap.end())
1891 {
1892 int n = it->second;
1893 yyextra->defText+='@';
1895 }
1896 else
1897 {
1898 if (yyextra->idStart)
1899 {
1900 warn(yyextra->fileName,yyextra->yyLineNr,
1901 "'#' is not followed by a macro parameter '{}': '{}'",
1902 yyextra->defName,yyextra->defLitText.stripWhiteSpace());
1903 }
1904 yyextra->defText+=yytext;
1905 }
1906 }
1907 else
1908 {
1909 yyextra->defText+=yytext;
1910 }
1911 if (yyextra->quoteArg)
1912 {
1913 yyextra->defText+="\"";
1914 }
1915 yyextra->quoteArg=
FALSE;
1916 yyextra->idStart=false;
1917 }
1918<CopyCComment>. {
1919 yyextra->defLitText+=yytext;
1920 yyextra->defText+=yytext;
1921 }
1922<DefineText>\\[\r]?\n {
1923 yyextra->defLitText+=yytext;
1926 yyextra->defText += ' ';
1927 yyextra->yyLineNr++;
1928 yyextra->yyMLines++;
1929 }
1930<DefineText>\n {
1932 yyextra->defText = yyextra->defText.stripWhiteSpace();
1933 if (yyextra->defText.startsWith("##"))
1934 {
1935 warn(yyextra->fileName,yyextra->yyLineNr,
1936 "'##' cannot occur at the beginning of a macro definition '{}': '{}'",
1937 yyextra->defName,yyextra->defLitText.stripWhiteSpace());
1938 }
1939 else if (yyextra->defText.endsWith("##"))
1940 {
1941 warn(yyextra->fileName,yyextra->yyLineNr,
1942 "'##' cannot occur at the end of a macro definition '{}': '{}'",
1943 yyextra->defName,yyextra->defLitText.stripWhiteSpace());
1944 }
1945 else if (yyextra->defText.endsWith("#"))
1946 {
1947 warn(yyextra->fileName,yyextra->yyLineNr,
1948 "expected formal parameter after # in macro definition '{}': '{}'",
1949 yyextra->defName,yyextra->defLitText.stripWhiteSpace());
1950 }
1952 {
1954 yyextra->defLitText=yyextra->defLitText.left(yyextra->defLitText.length()-
comment.length()-1);
1955 }
1957 yyextra->defLitText+=yytext;
1959
1960 if (yyextra->includeStack.empty() || yyextra->curlyCount>0)
1961 {
1963 }
1964 def=
isDefined(yyscanner,yyextra->defName);
1965 if (def==0)
1966 {
1967
1969 }
1970 else if (def )
1971
1972 {
1973
1974
1976 {
1978 def->
name = yyextra->defName;
1980 def->
nargs = yyextra->defArgs;
1982 def->
lineNr = yyextra->yyLineNr-yyextra->yyMLines;
1984 }
1985 else
1986 {
1987 if (def->
fileName != yyextra->fileName && !yyextra->expandOnlyPredef)
addDefine(yyscanner);
1988
1989 }
1990 }
1991 yyextra->argMap.clear();
1992 yyextra->yyLineNr++;
1993 yyextra->yyColNr=1;
1994 yyextra->lastGuardName.clear();
1995 BEGIN(Start);
1996 }
static void addMacroDefinition(yyscan_t yyscanner)
static void addDefine(yyscan_t yyscanner)
static QCString extractTrailingComment(const QCString &s)
1997<DefineText>{B}* { outputString(yyscanner,yytext);
1998 yyextra->defText += ' ';
1999 yyextra->defLitText+=yytext;
2000 }
2001<DefineText>{B}*"##"{B}* { outputString(yyscanner,substitute(yytext,"##"," "));
2002 yyextra->defText += "##";
2003 yyextra->defLitText+=yytext;
2004 }
2005<DefineText>"@" { outputString(yyscanner,substitute(yytext,"@@"," "));
2006 yyextra->defText += "@@";
2007 yyextra->defLitText+=yytext;
2008 }
2009<DefineText>\" {
2011 yyextra->defText += *yytext;
2012 yyextra->defLitText+=yytext;
2013 if (!yyextra->insideComment)
2014 {
2015 BEGIN(SkipDoubleQuote);
2016 }
2017 }
2018<DefineText>{NUMBER} {
2020 yyextra->defText += yytext;
2021 yyextra->defLitText+=yytext;
2022 }
2023<DefineText>\' {
2025 yyextra->defText += *yytext;
2026 yyextra->defLitText+=yytext;
2027 if (!yyextra->insideComment)
2028 {
2029 BEGIN(SkipSingleQuote);
2030 }
2031 }
2032<SkipDoubleQuote>{CPPC}[/]? { outputSpaces(yyscanner,yytext);
2033 yyextra->defText += yytext;
2034 yyextra->defLitText+=yytext;
2035 }
2036<SkipDoubleQuote>{CCS}[*]? { outputSpaces(yyscanner,yytext);
2037 yyextra->defText += yytext;
2038 yyextra->defLitText+=yytext;
2039 }
2040<SkipDoubleQuote>\" {
2042 yyextra->defText += *yytext;
2043 yyextra->defLitText+=yytext;
2044 BEGIN(DefineText);
2045 }
2046<SkipSingleQuote,SkipDoubleQuote>\\. {
2048 yyextra->defText += yytext;
2049 yyextra->defLitText+=yytext;
2050 }
2051<SkipSingleQuote>\' {
2053 yyextra->defText += *yytext;
2054 yyextra->defLitText+=yytext;
2055 BEGIN(DefineText);
2056 }
2057<SkipDoubleQuote,SkipSingleQuote>. { outputSpace(yyscanner,yytext[0]);
2058 yyextra->defText += *yytext;
2059 yyextra->defLitText += *yytext;
2060 }
2061<DefineText>. { outputSpace(yyscanner,yytext[0]);
2062 yyextra->defText += *yytext;
2063 yyextra->defLitText += *yytext;
2064 }
2065<<EOF>> {
2066 TRACE(
"End of include file");
2067
2068 if (yyextra->includeStack.empty())
2069 {
2070 TRACE(
"Terminating scanner");
2072 }
2073 else
2074 {
2075 QCString toFileName = yyextra->fileName;
2076 const std::unique_ptr<FileState> &fs=yyextra->includeStack.back();
2077
2078 YY_BUFFER_STATE oldBuf = YY_CURRENT_BUFFER;
2079 yy_switch_to_buffer( fs->bufState, yyscanner );
2080 yy_delete_buffer( oldBuf, yyscanner );
2081 yyextra->yyLineNr = fs->lineNr;
2082
2083 yyextra->inputBuf = fs->oldFileBuf;
2084 yyextra->inputBufPos = fs->oldFileBufPos;
2085 yyextra->curlyCount = fs->curlyCount;
2087 TRACE(
"switching to {}",yyextra->fileName);
2088
2089
2090
2092 lineStr.sprintf(
"# %d \"%s\" 2",yyextra->yyLineNr,
qPrint(yyextra->fileName));
2094
2095 yyextra->includeStack.pop_back();
2096
2097 {
2099
2100
2101
2102
2104 {
2105
2108 }
2109 else
2110 {
2112 {
2114 }
2115 }
2116 }
2117
2118 for (const auto &kv : yyextra->localDefines)
2119 {
2120 auto pair = yyextra->contextDefines.insert(kv);
2121 if (!pair.second)
2122 {
2123 yyextra->contextDefines.erase(pair.first);
2124 yyextra->contextDefines.insert(kv);
2125 }
2126 }
2127 yyextra->localDefines.clear();
2128 }
2129 }
2130<*>{CCS}/{CCE} |
2131<*>{CCS}[*!]? {
2132 if (YY_START==SkipVerbatim || YY_START == SkipCondVerbatim || YY_START==SkipCond || YY_START==IDLquote || YY_START == PragmaOnce)
2133 {
2134 REJECT;
2135 }
2136 else
2137 {
2139 yyextra->lastCContext=YY_START;
2140 yyextra->commentCount=1;
2141 if (yyleng==3)
2142 {
2143 yyextra->isSpecialComment = true;
2144 yyextra->lastGuardName.clear();
2145 }
2146 else
2147 {
2148 yyextra->isSpecialComment = false;
2149 }
2150 BEGIN(SkipCComment);
2151 }
2152 }
2153<*>{CPPC}[/!]? {
2154 if (YY_START==SkipVerbatim || YY_START == SkipCondVerbatim || YY_START==SkipCond ||
getLanguageFromFileName(yyextra->fileName)==SrcLangExt::Fortran || YY_START==IDLquote || YY_START == PragmaOnce)
2155 {
2156 REJECT;
2157 }
2158 else if (YY_START==RulesRoundDouble)
2159 {
2160 REJECT;
2161 }
2162 else
2163 {
2165 yyextra->lastCPPContext=YY_START;
2166 if (yyleng==3)
2167 {
2168 yyextra->isSpecialComment = true;
2169 yyextra->lastGuardName.clear();
2170 }
2171 else
2172 {
2173 yyextra->isSpecialComment = false;
2174 }
2175 BEGIN(SkipCPPComment);
2176 }
2177 }
2178<*>\n {
2180 yyextra->yyLineNr++;
2181 }
2182<*>. {
2183 yyextra->expectGuard =
FALSE;
2185 }
2186
2187%%