489 {
491 }
static char resolveTrigraph(char c)
492<Start>^{B}*"#" {
493 yyextra->yyColNr+=(int)yyleng;
494 yyextra->yyMLines=0;
495 yyextra->potentialDefine=yytext;
496 BEGIN(Command);
497 }
498<Start>^("%top{"|"%{") {
501 BEGIN(LexCopyLine);
502 }
static void outputArray(yyscan_t yyscanner, const char *a, yy_size_t len)
503<Start>^{Bopt}"cpp_quote"{Bopt}"("{Bopt}\" {
504 if (yyextra->insideIDL)
505 {
506 BEGIN(IDLquote);
507 }
508 else
509 {
510 REJECT;
511 }
512 }
513<IDLquote>"\\\\" {
515 }
516<IDLquote>"\\\"" {
518 }
519<IDLquote>"\""{Bopt}")" {
520 BEGIN(Start);
521 }
522<IDLquote>\n {
524 yyextra->yyLineNr++;
525 }
526<IDLquote>. {
528 }
529<Start>^{Bopt}/[^#] {
531 BEGIN(CopyLine);
532 }
533<Start>^{B}*[a-z_A-Z\x80-\xFF][a-z_A-Z0-9\x80-\xFF]+{B}*"("[^\)\n]*")"/{BN}{1,10}*[:{] { // constructors?
534 int i;
535 for (i=(int)yyleng-1;i>=0;i--)
536 {
537 unput(yytext[i]);
538 }
539 BEGIN(CopyLine);
540 }
541<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
542<Start>^{B}*[_A-Z][_A-Z0-9]+{B}*"("[^\)\n]*")"{B}*\n | // function like macro
543<Start>^{B}*[_A-Z][_A-Z0-9]+{B}*"("[^\(\)\n]*"("[^\)\n]*")"[^\)\n]*")"/{B}*("//"|"/\*") | // function list macro with one (...) argument followed by comment
544<Start>^{B}*[_A-Z][_A-Z0-9]+{B}*"("[^\)\n]*")"/{B}*("//"|"/\*") { // function like macro followed by comment
547 int pos = name.find('(');
548 if (pos<0) pos=0;
549 name=name.left(pos).stripWhiteSpace();
#define Config_getBool(name)
550
552 if (skipFuncMacros && !yyextra->insideFtn &&
553 name!="Q_PROPERTY" &&
554 !(
555 (yyextra->includeStack.empty() || yyextra->curlyCount>0) &&
556 yyextra->macroExpansion &&
558
560 )
561 )
562 {
563
564 if (yytext[yyleng-1] == '\n')
565 {
567 yyextra->yyLineNr++;
568 }
569 }
570 else
571 {
572 int i;
573 for (i=(int)yyleng-1;i>=0;i--)
574 {
575 unput(yytext[i]);
576 }
577 BEGIN(CopyLine);
578 }
579 }
580<CopyLine,LexCopyLine>"extern"{BN}*"\""[^\"]+"\""{BN}*("{")? {
582 yyextra->yyLineNr+=text.
contains(
'\n');
584 }
585<CopyLine,LexCopyLine>{RAWBEGIN} {
588 BEGIN(CopyRawString);
589 }
QCString extractBeginRawStringDelimiter(const char *rawStart)
590<CopyLine,LexCopyLine>"{" { // count brackets inside the main file
591 if (yyextra->includeStack.empty())
592 {
593 yyextra->curlyCount++;
594 }
596 }
597<LexCopyLine>^"%}" {
599 }
600<CopyLine,LexCopyLine>"}" { // count brackets inside the main file
601 if (yyextra->includeStack.empty() && yyextra->curlyCount>0)
602 {
603 yyextra->curlyCount--;
604 }
606 }
607<CopyLine,LexCopyLine>"'"\\[0-7]{1,3}"'" {
609 }
610<CopyLine,LexCopyLine>"'"\\."'" {
612 }
613<CopyLine,LexCopyLine>"'"."'" {
615 }
616<CopyLine,LexCopyLine>[$]?@\" {
619 BEGIN( CopyStringCs );
620 }
621<CopyLine,LexCopyLine>\" {
624 {
625 BEGIN( CopyString );
626 }
627 else
628 {
629 BEGIN( CopyStringFtnDouble );
630 }
631 }
632<CopyLine,LexCopyLine>\' {
635 BEGIN( CopyStringFtn );
636 }
637<CopyString>[^\"\\\r\n]{1,1000} {
639 }
640<CopyStringCs>[^\"\r\n]{1,1000} {
642 }
643<CopyStringCs>\"\" {
645 }
646<CopyString>\\. {
648 }
649<CopyString,CopyStringCs>\" {
651 BEGIN( CopyLine );
652 }
653<CopyStringFtnDouble>[^\"\\\r\n]{1,1000} {
655 }
656<CopyStringFtnDouble>\\. {
658 }
659<CopyStringFtnDouble>\" {
661 BEGIN( CopyLine );
662 }
663<CopyStringFtn>[^\'\\\r\n]{1,1000} {
665 }
666<CopyStringFtn>\\. {
668 }
669<CopyStringFtn>\' {
671 BEGIN( CopyLine );
672 }
673<CopyRawString>{RAWEND} {
676 {
677 BEGIN( CopyLine );
678 }
679 }
QCString extractEndRawStringDelimiter(const char *rawEnd)
680<CopyRawString>[^)]{1,1000} {
682 }
683<CopyRawString>. {
685 }
686<CopyLine,LexCopyLine>{ID}/{BN}{0,80}"(" {
687 yyextra->expectGuard =
FALSE;
689
690
691
692
693
694
695
696
697 if ((yyextra->includeStack.empty() || yyextra->curlyCount>0) &&
698 yyextra->macroExpansion &&
701 )
702 {
703
704 yyextra->roundCount=0;
705 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} {
855 if ((yyextra->includeStack.empty() || yyextra->curlyCount>0) &&
856 yyextra->macroExpansion &&
860 )
861 {
866 }
868 {
870 }
871 else
872 {
874 }
875 }
876<CopyLine,LexCopyLine>"\\"\r?/\n { // strip line continuation characters
878 }
879<CopyLine,LexCopyLine>\\. {
881 }
882<CopyLine,LexCopyLine>. {
884 }
885<CopyLine,LexCopyLine>\n {
887 BEGIN(Start);
888 yyextra->yyLineNr++;
889 yyextra->yyColNr=1;
890 }
891<FindDefineArgs>"(" {
892 yyextra->defArgsStr+='(';
893 yyextra->roundCount++;
894 }
895<FindDefineArgs>")" {
896 yyextra->defArgsStr+=')';
897 yyextra->roundCount--;
898 if (yyextra->roundCount==0)
899 {
901
902 if (yyextra->findDefArgContext==CopyLine)
903 {
905 BEGIN(yyextra->findDefArgContext);
906 }
907 else
908 {
910 yyextra->nospaces=
FALSE;
911 BEGIN(Start);
912 }
913 }
914 }
915
static void readIncludeFile(yyscan_t yyscanner, const QCString &inc)
916<FindDefineArgs>")"{B}*"(" {
917 yyextra->defArgsStr+=yytext;
918 }
919 */
920<FindDefineArgs>{CHARLIT} {
921 yyextra->defArgsStr+=yytext;
922 }
923<FindDefineArgs>{CCS}[*!]? {
924 yyextra->defArgsStr+=yytext;
925 BEGIN(ArgCopyCComment);
926 }
927<FindDefineArgs>{CPPC}[/!].*\n/{B}*{CPPC}[/!] { // replace multi line C++ style comment by C style comment
929 {
930 if (yytext[3]=='<')
931 {
932 yyextra->defArgsStr+=
QCString(
"/**< @brief ")+&yytext[4];
933 }
934 else
935 {
936 yyextra->defArgsStr+=
QCString(
"/** @brief ")+&yytext[3];
937 }
938 }
939 else
940 {
941 yyextra->defArgsStr+=
QCString(
"/**")+&yytext[3];
942 }
943 BEGIN(ArgCopyCppComment);
944 }
945<FindDefineArgs>{CPPC}[/!].*\n { // replace C++ single line style comment by C style comment
947 {
948 yyextra->defArgsStr+=
QCString(
"/**")+&yytext[3]+
" */";
949 }
950 else
951 {
952 if (yytext[3]=='<')
953 {
954 yyextra->defArgsStr+=
QCString(
"/**< @brief ")+&yytext[4]+
" */";
955 }
956 else
957 {
958 yyextra->defArgsStr+=
QCString(
"/** @brief ")+&yytext[3]+
" */";
959 }
960 }
961 }
962<FindDefineArgs>{CPPC}.*\n { // replace C++ single line style comment by C style comment
963 yyextra->defArgsStr+=
QCString(
"/*")+&yytext[2]+
" */";
964 }
965<FindDefineArgs>\" {
966 yyextra->defArgsStr+=*yytext;
967 BEGIN(ReadString);
968 }
969<FindDefineArgs>' {
971 yyextra->defArgsStr+=*yytext;
972 BEGIN(ReadString);
973 }
974<FindDefineArgs>\n {
975 yyextra->defArgsStr+=' ';
976 yyextra->yyLineNr++;
978 }
979<FindDefineArgs>"@" {
980 yyextra->defArgsStr+="@@";
981 }
982<FindDefineArgs>. {
983 yyextra->defArgsStr+=*yytext;
984 }
985<ArgCopyCComment>[^*\n]+ {
986 yyextra->defArgsStr+=yytext;
987 }
988<ArgCopyCComment>{CCE} {
989 yyextra->defArgsStr+=yytext;
990 BEGIN(FindDefineArgs);
991 }
992<ArgCopyCComment>\n {
993 yyextra->defArgsStr+=yytext;
994 yyextra->yyLineNr++;
995 }
996<ArgCopyCComment>. {
997 yyextra->defArgsStr+=yytext;
998 }
999<ArgCopyCppComment>^{B}*
1000<ArgCopyCppComment>{CPPC}[/!].*\n/{B}*{CPPC}[/!] { // replace multi line C++ style comment by C style comment
1001 const char *startContent = &yytext[3];
1002 if (startContent[0]=='<') startContent++;
1003 yyextra->defArgsStr+=startContent;
1004 }
1005<ArgCopyCppComment>{CPPC}[/!].*\n { // replace C++ multie line style comment by C style comment
1006 const char *startContent = &yytext[3];
1007 if (startContent[0]=='<') startContent++;
1008 yyextra->defArgsStr+=
QCString(startContent)+
" */";
1009 BEGIN(FindDefineArgs);
1010 }
1011<ArgCopyCppComment>. { // unexpected character
1012 unput(*yytext);
1013 yyextra->defArgsStr+=" */";
1014 BEGIN(FindDefineArgs);
1015 }
1016<ReadString>"\"" {
1017 yyextra->defArgsStr+=*yytext;
1018 BEGIN(FindDefineArgs);
1019 }
1020<ReadString>"'" {
1022 yyextra->defArgsStr+=*yytext;
1023 BEGIN(FindDefineArgs);
1024 }
1025
1026<ReadString>{CPPC}|{CCS} {
1027 yyextra->defArgsStr+=yytext;
1028 }
1029<ReadString>\\/\r?\n { // line continuation
1030 }
1031<ReadString>\\. {
1032 yyextra->defArgsStr+=yytext;
1033 }
1034<ReadString>. {
1035 yyextra->defArgsStr+=*yytext;
1036 }
1037<Command>("include"|"import"){B}+/{ID} {
1038 yyextra->isImported = yytext[1]=='m';
1039 if (yyextra->macroExpansion)
1040 BEGIN(IncludeID);
1041 }
1042<Command>("include"|"import"){B}*[<"] {
1043 yyextra->isImported = yytext[1]=='m';
1044 char c[2];
1045 c[0]=yytext[yyleng-1];c[1]='\0';
1046 yyextra->incName=c;
1047 BEGIN(Include);
1048 }
1049<Command>("cmake")?"define"{B}+ {
1050 yyextra->potentialDefine +=
substitute(yytext,
"cmake",
" ");
1051
1052 yyextra->yyColNr+=(int)yyleng;
1053 BEGIN(DefName);
1054 }
QCString substitute(const QCString &s, const QCString &src, const QCString &dst)
substitute all occurrences of src in s by dst
1055<Command>"cmakedefine01"{B}+ {
1056 yyextra->potentialDefine +=
substitute(yytext,
"cmakedefine01",
" define ");
1057
1058 yyextra->yyColNr+=(int)yyleng;
1059 BEGIN(CmakeDefName01);
1060 }
1061<Command>"ifdef"/{B}*"(" {
1063 yyextra->guardExpr.clear();
1064 BEGIN(DefinedExpr2);
1065 }
static void incrLevel(yyscan_t yyscanner)
1066<Command>"ifdef"/{B}+ {
1067
1069 yyextra->guardExpr.clear();
1070 BEGIN(DefinedExpr1);
1071 }
1072<Command>"ifndef"/{B}*"(" {
1074 yyextra->guardExpr="! ";
1075 BEGIN(DefinedExpr2);
1076 }
1077<Command>"ifndef"/{B}+ {
1079 yyextra->guardExpr="! ";
1080 BEGIN(DefinedExpr1);
1081 }
1082<Command>"if"/[ \t(!] {
1084 yyextra->guardExpr.clear();
1085 BEGIN(Guard);
1086 }
1087<Command>("elif"|"else"{B}*"if")/[ \t(!] {
1089 {
1090 yyextra->guardExpr.clear();
1091 BEGIN(Guard);
1092 }
1093 else
1094 {
1095 yyextra->ifcount=0;
1096 BEGIN(SkipCPPBlock);
1097 }
1098 }
static bool otherCaseDone(yyscan_t yyscanner)
1099<Command>"else"/[^a-z_A-Z0-9\x80-\xFF] {
1101 {
1102 yyextra->ifcount=0;
1103 BEGIN(SkipCPPBlock);
1104 }
1105 else
1106 {
1108 }
1109 }
static void setCaseDone(yyscan_t yyscanner, bool value)
1110<Command>"undef"{B}+ {
1111 BEGIN(UndefName);
1112 }
1113<Command>("elif"|"else"{B}*"if")/[ \t(!] {
1115 {
1116 yyextra->guardExpr.clear();
1117 BEGIN(Guard);
1118 }
1119 }
1120<Command>"endif"/[^a-z_A-Z0-9\x80-\xFF] {
1121
1123 }
static void decrLevel(yyscan_t yyscanner)
1124<Command,IgnoreLine>\n {
1126 BEGIN(Start);
1127 yyextra->yyLineNr++;
1128 }
1129<Command>"pragma"{B}+"once" {
1130 yyextra->expectGuard =
FALSE;
1131 if (yyextra->pragmaSet.find(yyextra->fileName.str())!=yyextra->pragmaSet.end())
1132 {
1134 BEGIN(PragmaOnce);
1135 }
1136 else
1137 {
1138 yyextra->pragmaSet.insert(yyextra->fileName.data());
1139 }
1140 }
1141<PragmaOnce>. {}
1142<PragmaOnce>\n {}
1143<PragmaOnce><<EOF>> {
1144 yyextra->expectGuard =
FALSE;
1145 BEGIN(Start);
1146 }
1147<Command>{ID} { // unknown directive
1148 BEGIN(IgnoreLine);
1149 }
1150<IgnoreLine>\\[\r]?\n {
1152 yyextra->yyLineNr++;
1153 }
1154<IgnoreLine>.
1155<Command>. { yyextra->potentialDefine += yytext[0]=='\t' ? '\t' : ' ';
1156 yyextra->yyColNr+=(int)yyleng;
1157 }
1158<UndefName>{ID} {
1161
1163 )
1164 {
1165
1167 }
1168 BEGIN(Start);
1169 }
1170<Guard>\\[\r]?\n {
1172 yyextra->guardExpr+=' ';
1173 yyextra->yyLineNr++;
1174 }
1175<Guard>"defined"/{B}*"(" {
1176 BEGIN(DefinedExpr2);
1177 }
1178<Guard>"defined"/{B}+ {
1179 BEGIN(DefinedExpr1);
1180 }
1181<Guard>"true"/{B}|{B}*[\r]?\n { yyextra->guardExpr+="1L"; }
1182<Guard>"false"/{B}|{B}*[\r]?\n { yyextra->guardExpr+="0L"; }
1183<Guard>"not"/{B} { yyextra->guardExpr+='!'; }
1184<Guard>"not_eq"/{B} { yyextra->guardExpr+="!="; }
1185<Guard>"and"/{B} { yyextra->guardExpr+="&&"; }
1186<Guard>"or"/{B} { yyextra->guardExpr+="||"; }
1187<Guard>"bitand"/{B} { yyextra->guardExpr+="&"; }
1188<Guard>"bitor"/{B} { yyextra->guardExpr+="|"; }
1189<Guard>"xor"/{B} { yyextra->guardExpr+="^"; }
1190<Guard>"compl"/{B} { yyextra->guardExpr+="~"; }
1191<Guard>{ID} { yyextra->guardExpr+=yytext; }
1192<Guard>"@" { yyextra->guardExpr+="@@"; }
1193<Guard>. { yyextra->guardExpr+=*yytext; }
1194<Guard>\n {
1195 unput(*yytext);
1196
1197
1200 if (guard)
1201 {
1202 BEGIN(Start);
1203 }
1204 else
1205 {
1206 yyextra->ifcount=0;
1207 BEGIN(SkipCPPBlock);
1208 }
1209 }
static bool computeExpression(yyscan_t yyscanner, const QCString &expr)
1210<DefinedExpr1,DefinedExpr2>\\\n { yyextra->yyLineNr++; outputChar(yyscanner,'\n'); }
1211<DefinedExpr1>{ID} {
1212 if (
isDefined(yyscanner,yytext) || yyextra->guardName==yytext)
1213 yyextra->guardExpr+=" 1L ";
1214 else
1215 yyextra->guardExpr+=" 0L ";
1216 yyextra->lastGuardName=yytext;
1217 BEGIN(Guard);
1218 }
1219<DefinedExpr2>{ID} {
1220 if (
isDefined(yyscanner,yytext) || yyextra->guardName==yytext)
1221 yyextra->guardExpr+=" 1L ";
1222 else
1223 yyextra->guardExpr+=" 0L ";
1224 yyextra->lastGuardName=yytext;
1225 }
1226<DefinedExpr1,DefinedExpr2>\n { // should not happen, handle anyway
1227 yyextra->yyLineNr++;
1228 yyextra->ifcount=0;
1229 BEGIN(SkipCPPBlock);
1230 }
1231<DefinedExpr2>")" {
1232 BEGIN(Guard);
1233 }
1234<DefinedExpr1,DefinedExpr2>.
1235<SkipCPPBlock>^{B}*"#" { BEGIN(SkipCommand); }
1236<SkipCPPBlock>^{Bopt}/[^#] { BEGIN(SkipLine); }
1237<SkipCPPBlock>\n { yyextra->yyLineNr++; outputChar(yyscanner,'\n'); }
1238<SkipCPPBlock>.
1239<SkipCommand>"if"(("n")?("def"))?/[ \t(!] {
1241 yyextra->ifcount++;
1242
1243 }
1244<SkipCommand>"else" {
1245
1247 {
1249
1250 BEGIN(Start);
1251 }
1252 }
1253<SkipCommand>("elif"|"else"{B}*"if")/[ \t(!] {
1254 if (yyextra->ifcount==0)
1255 {
1257 {
1258 yyextra->guardExpr.clear();
1259 yyextra->lastGuardName.clear();
1260 BEGIN(Guard);
1261 }
1262 else
1263 {
1264 BEGIN(SkipCPPBlock);
1265 }
1266 }
1267 }
1268<SkipCommand>"endif" {
1269 yyextra->expectGuard =
FALSE;
1271 if (--yyextra->ifcount<0)
1272 {
1273
1274 BEGIN(Start);
1275 }
1276 }
1277<SkipCommand>\n {
1279 yyextra->yyLineNr++;
1280 BEGIN(SkipCPPBlock);
1281 }
1282<SkipCommand>{ID} { // unknown directive
1283 BEGIN(SkipLine);
1284 }
1285<SkipCommand>.
1286<SkipLine>[^'"/\n]+
1287<SkipLine>{CHARLIT} { }
1288<SkipLine>\" {
1289 BEGIN(SkipString);
1290 }
1291<SkipLine>.
1292<SkipString>{CPPC}/[^\n]* {
1293 }
1294<SkipLine,SkipCommand,SkipCPPBlock>{CPPC}[^\n]* {
1295 yyextra->lastCPPContext=YY_START;
1296 BEGIN(RemoveCPPComment);
1297 }
1298<SkipString>{CCS}/[^\n]* {
1299 }
1300<SkipLine,SkipCommand,SkipCPPBlock>{CCS}/[^\n]* {
1301 yyextra->lastCContext=YY_START;
1302 BEGIN(RemoveCComment);
1303 }
1304<SkipLine>\n {
1306 yyextra->yyLineNr++;
1307 BEGIN(SkipCPPBlock);
1308 }
1309<SkipString>[^"\\\n]+ { }
1310<SkipString>\\. { }
1311<SkipString>\" {
1312 BEGIN(SkipLine);
1313 }
1314<SkipString>. { }
1315<IncludeID>{ID}{Bopt}/"(" {
1316 yyextra->nospaces=
TRUE;
1317 yyextra->roundCount=0;
1318 yyextra->defArgsStr=yytext;
1319 yyextra->findDefArgContext = IncludeID;
1320 BEGIN(FindDefineArgs);
1321 }
1322<IncludeID>{ID} {
1323 yyextra->nospaces=
TRUE;
1325 BEGIN(Start);
1326 }
1327<Include>[^\">\n]+[\">] {
1328 yyextra->incName+=yytext;
1329 if (yyextra->isImported)
1330 {
1331 BEGIN(EndImport);
1332 }
1333 else
1334 {
1336 BEGIN(Start);
1337 }
1338 }
1339<EndImport>{ENDIMPORTopt}/\n {
1341 BEGIN(Start);
1342 }
1343<EndImport>\\[\r]?"\n" {
1345 yyextra->yyLineNr++;
1346 }
1347<EndImport>. {
1348 }
1349<DefName>{ID}/("\\\n")*"(" { // define with argument
1350
1351 yyextra->argMap.clear();
1352 yyextra->defArgs = 0;
1353 yyextra->defArgsStr.clear();
1354 yyextra->defText.clear();
1355 yyextra->defLitText.clear();
1356 yyextra->defName = yytext;
1357 yyextra->defVarArgs =
FALSE;
1358 yyextra->defExtraSpacing.clear();
1359 yyextra->defContinue = false;
1360 BEGIN(DefineArg);
1361 }
1362<DefName>{ID}{B}+"1"/[ \r\t\n] { // special case: define with 1 -> can be "guard"
1363
1364 yyextra->argMap.clear();
1365 yyextra->defArgs = -1;
1366 yyextra->defArgsStr.clear();
1368 yyextra->defVarArgs =
FALSE;
1369
1370
1371 if (yyextra->curlyCount>0 || yyextra->defName!=yyextra->lastGuardName || !yyextra->expectGuard)
1372 {
1373 QCString def = yyextra->potentialDefine +
1374 yyextra->defName ;
1376 outputSpaces(yyscanner,yytext+yyextra->defName.length());
1377 yyextra->quoteArg=
FALSE;
1378 yyextra->insideComment=
FALSE;
1379 yyextra->lastGuardName.clear();
1380 yyextra->defText="1";
1381 yyextra->defLitText="1";
1382 BEGIN(DefineText);
1383 }
1384 else
1385 {
1386
1387 yyextra->defText.clear();
1388 yyextra->defLitText.clear();
1389 BEGIN(Start);
1390 }
1391 yyextra->expectGuard=
FALSE;
1392 }
static void outputSpaces(yyscan_t yyscanner, char *s)
1393<DefName,CmakeDefName01>{ID}/{B}*"\n" { // empty define
1394 yyextra->argMap.clear();
1395 yyextra->defArgs = -1;
1396 yyextra->defName = yytext;
1397 yyextra->defArgsStr.clear();
1398 yyextra->defText.clear();
1399 yyextra->defLitText.clear();
1400 yyextra->defVarArgs =
FALSE;
1401
1402
1403 if (yyextra->curlyCount>0 || yyextra->defName!=yyextra->lastGuardName || !yyextra->expectGuard)
1404 {
1405 QCString def = yyextra->potentialDefine + yyextra->defName;
1407 yyextra->quoteArg=
FALSE;
1408 yyextra->insideComment=
FALSE;
1409 if (YY_START == CmakeDefName01) yyextra->defText = "0";
1410 else if (yyextra->insideCS) yyextra->defText="1";
1411 BEGIN(DefineText);
1412 }
1413 else
1414 {
1415
1416 yyextra->guardName = yytext;
1417 yyextra->lastGuardName.clear();
1418 BEGIN(Start);
1419 }
1420 yyextra->expectGuard=
FALSE;
1421 }
1422<DefName>{ID}/{B}* { // define with content
1423
1424 yyextra->argMap.clear();
1425 yyextra->defArgs = -1;
1426 yyextra->defArgsStr.clear();
1427 yyextra->defText.clear();
1428 yyextra->defLitText.clear();
1429 yyextra->defName = yytext;
1430 yyextra->defVarArgs =
FALSE;
1431 QCString def = yyextra->potentialDefine +
1432 yyextra->defName +
1433 yyextra->defArgsStr ;
1435 yyextra->quoteArg=
FALSE;
1436 yyextra->insideComment=
FALSE;
1437 BEGIN(DefineText);
1438 }
1439<DefineArg>"\\\n" {
1440 yyextra->defExtraSpacing+="\n";
1441 yyextra->defContinue = true;
1442 yyextra->yyLineNr++;
1443 }
1444<DefineArg>{B}* { yyextra->defExtraSpacing+=yytext; }
1445<DefineArg>","{B}* { yyextra->defArgsStr+=yytext; }
1446<DefineArg>"("{B}* { yyextra->defArgsStr+=yytext; }
1447<DefineArg>{B}*")"{B}* {
1449 yyextra->defArgsStr+=yytext;
1450 QCString def = yyextra->potentialDefine +
1451 yyextra->defName +
1452 yyextra->defArgsStr +
1453 yyextra->defExtraSpacing ;
1455 yyextra->quoteArg=
FALSE;
1456 yyextra->insideComment=
FALSE;
1457 BEGIN(DefineText);
1458 }
static void extraSpacing(yyscan_t yyscanner)
1459<DefineArg>"..." { // Variadic macro
1460 yyextra->defVarArgs =
TRUE;
1461 yyextra->defArgsStr+=yytext;
1462 yyextra->argMap.emplace(std::string("__VA_ARGS__"),yyextra->defArgs);
1463 yyextra->defArgs++;
1464 }
1465<DefineArg>{ID}{B}*("..."?) {
1466
1468 yyextra->defVarArgs = yytext[yyleng-1]=='.';
1469 if (yyextra->defVarArgs)
1470 {
1472 }
1474 yyextra->defArgsStr+=yytext;
1475 yyextra->argMap.emplace(
toStdString(argName),yyextra->defArgs);
1476 yyextra->defArgs++;
1478 }
1479
1480<DefineText>"/ **"|"/ *!" {
1481 yyextra->defText+=yytext;
1482 yyextra->defLitText+=yytext;
1483 yyextra->insideComment=
TRUE;
1484 }
1485<DefineText>"* /" {
1486 yyextra->defText+=yytext;
1487 yyextra->defLitText+=yytext;
1488 yyextra->insideComment=
FALSE;
1489 }
1490 */
1491<DefineText>{CCS}[!*]? {
1492 yyextra->defText+=yytext;
1493 yyextra->defLitText+=yytext;
1494 yyextra->lastCContext=YY_START;
1495 yyextra->commentCount=1;
1496 BEGIN(CopyCComment);
1497 }
1498<DefineText>{CPPC}[!/]? {
1500 yyextra->lastCPPContext=YY_START;
1501 yyextra->defLitText+=' ';
1502 BEGIN(SkipCPPComment);
1503 }
1504<SkipCComment>[/]?{CCE} {
1505 if (yytext[0]==
'/')
outputChar(yyscanner,
'/');
1507 if (--yyextra->commentCount<=0)
1508 {
1509 if (yyextra->lastCContext==Start)
1510
1511
1512 {
1513 YY_CURRENT_BUFFER->yy_at_bol=1;
1514 }
1515 BEGIN(yyextra->lastCContext);
1516 }
1517 }
1518<SkipCComment>{CPPC}("/")* {
1520 }
1521<SkipCComment>{CCS} {
1523
1524 }
1525<SkipCond>{CMD}{CMD} { }
1526<SkipCond>^({B}*"*"+)?{B}{0,3}"~~~"[~]* {
1528 if (!markdownSupport || !yyextra->isSpecialComment)
1529 {
1530 REJECT;
1531 }
1532 else
1533 {
1534 yyextra->fenceChar='~';
1536 BEGIN(SkipCondVerbatim);
1537 }
1538 }
static yy_size_t getFenceSize(char *txt, yy_size_t leng)
1539<SkipCond>^({B}*"*"+)?{B}{0,3}"```"[`]* {
1541 if (!markdownSupport || !yyextra->isSpecialComment)
1542 {
1543 REJECT;
1544 }
1545 else
1546 {
1547 yyextra->fenceChar='`';
1549 BEGIN(SkipCondVerbatim);
1550 }
1551 }
1552<SkipCComment>^({B}*"*"+)?{B}{0,3}"~~~"[~]* {
1554 if (!markdownSupport || !yyextra->isSpecialComment)
1555 {
1556 REJECT;
1557 }
1558 else
1559 {
1561 yyextra->fenceChar='~';
1563 BEGIN(SkipVerbatim);
1564 }
1565 }
1566<SkipCComment>^({B}*"*"+)?{B}{0,3}"```"[`]* {
1568 if (!markdownSupport || !yyextra->isSpecialComment)
1569 {
1570 REJECT;
1571 }
1572 else
1573 {
1575 yyextra->fenceChar='`';
1577 BEGIN(SkipVerbatim);
1578 }
1579 }
1580<SkipCComment>{CMD}{VERBATIM_LINE} |
1581<SkipCComment>{CMD}{LITERAL_BLOCK} { // escaped command
1584 }
1585<SkipCComment>{VERBATIM_LINE}.*/\n { // normal command
1587 }
1588<SkipCComment>{LITERAL_BLOCK} { // normal block command
1591 if (yyextra->isSpecialComment)
1592 {
1594 BEGIN(SkipVerbatim);
1595 }
1596 }
static void determineBlockName(yyscan_t yyscanner)
1597<SkipCond>{CMD}{CMD}"cond"[ \t]+ {}// escaped cond command
1598<SkipCond>{CMD}"cond"/\n |
1599<SkipCond>{CMD}"cond"[ \t]+ { // cond command in a skipped cond section, this section has to be skipped as well
1600
1602 }
static void startCondSection(yyscan_t yyscanner, const QCString §Id)
1603<SkipCComment>"{"[ \t]*"@code"/[ \t\n] {
1605 yyextra->javaBlock=1;
1606 BEGIN(JavaDocVerbatimCode);
1607 }
1608<SkipCComment>"{"[ \t]*"@literal"/[ \t\n] {
1610 yyextra->javaBlock=1;
1611 BEGIN(JavaDocVerbatimCode);
1612 }
1613<SkipCComment,SkipCPPComment>{CMD}{CMD}"cond"[ \t\n]+ { // escaped cond command
1615 }
1616<SkipCPPComment>{CMD}"cond"[ \t]+ { // conditional section
1617 yyextra->ccomment=
TRUE;
1618 yyextra->condCtx=YY_START;
1619 BEGIN(CondLineCpp);
1620 }
1621<SkipCComment>{CMD}"cond"[ \t]+ { // conditional section
1622 yyextra->ccomment=
FALSE;
1623 yyextra->condCtx=YY_START;
1624 BEGIN(CondLineC);
1625 }
1626<CondLineC,CondLineCpp>[!()&| \ta-z_A-Z0-9\x80-\xFF.\-]+ {
1628 if (yyextra->skip)
1629 {
1630 if (YY_START==CondLineC)
1631 {
1632
1634 yyextra->ccomment=
TRUE;
1635 }
1636 else
1637 {
1638 yyextra->ccomment=
FALSE;
1639 }
1640 BEGIN(SkipCond);
1641 }
1642 else
1643 {
1644 BEGIN(yyextra->condCtx);
1645 }
1646 }
1647<CondLineC,CondLineCpp>. { // non-guard character
1648 unput(*yytext);
1650 if (yyextra->skip)
1651 {
1652 if (YY_START==CondLineC)
1653 {
1654
1656 yyextra->ccomment=
TRUE;
1657 }
1658 else
1659 {
1660 yyextra->ccomment=
FALSE;
1661 }
1662 BEGIN(SkipCond);
1663 }
1664 else
1665 {
1666 BEGIN(yyextra->condCtx);
1667 }
1668 }
1669<SkipCComment,SkipCPPComment>{CMD}"cond"{WSopt}/\n { // no guard
1670 if (YY_START==SkipCComment)
1671 {
1672 yyextra->ccomment=
TRUE;
1673
1675 }
1676 else
1677 {
1678 yyextra->ccomment=
FALSE;
1679 }
1680 yyextra->condCtx=YY_START;
1682 BEGIN(SkipCond);
1683 }
1684<SkipCond>\n { yyextra->yyLineNr++; outputChar(yyscanner,'\n'); }
1685<SkipCond>{VERBATIM_LINE}.*/\n { }
1686<SkipCond>{LITERAL_BLOCK} {
1688 yyextra->yyLineNr+=numNLs;
1689 for (
int i = 0; i < numNLs; i++)
outputChar(yyscanner,
'\n');
1691 BEGIN(SkipCondVerbatim);
1692 }
1693
1694<SkipCond>. { }
1695<SkipCond>[^\/\!*\\@\n]+ { }
1696<SkipCond>{CPPC}[/!] { yyextra->ccomment=FALSE; }
1697<SkipCond>{CCS}[*!] { yyextra->ccomment=TRUE; }
1698<SkipCond,SkipCComment,SkipCPPComment>{CMD}{CMD}"endcond"/[^a-z_A-Z0-9\x80-\xFF] {
1699 if (!yyextra->skip)
1700 {
1702 }
1703 }
1704<SkipCond>{CMD}"endcond"/[^a-z_A-Z0-9\x80-\xFF] {
1705 bool oldSkip = yyextra->skip;
1707 if (oldSkip && !yyextra->skip)
1708 {
1709 if (yyextra->ccomment)
1710 {
1712 }
1713 BEGIN(yyextra->condCtx);
1714 }
1715 }
static void endCondSection(yyscan_t yyscanner)
1716<SkipCComment,SkipCPPComment>{CMD}"endcond"/[^a-z_A-Z0-9\x80-\xFF] {
1717 bool oldSkip = yyextra->skip;
1719 if (oldSkip && !yyextra->skip)
1720 {
1721 BEGIN(yyextra->condCtx);
1722 }
1723 }
1724<SkipCondVerbatim>{LITERAL_BLOCK_END} { /* end of verbatim block */
1725 if (yytext[1]=='f' && yyextra->blockName==&yytext[2])
1726 {
1727 BEGIN(SkipCond);
1728 }
1729 else if (&yytext[4]==yyextra->blockName)
1730 {
1731 BEGIN(SkipCond);
1732 }
1733 }
1734<SkipVerbatim>{LITERAL_BLOCK_END} { /* end of verbatim block */
1736 if (yytext[1]=='f' && yyextra->blockName==&yytext[2])
1737 {
1738 BEGIN(SkipCComment);
1739 }
1740 else if (&yytext[4]==yyextra->blockName)
1741 {
1742 BEGIN(SkipCComment);
1743 }
1744 }
1745<SkipCondVerbatim>^({B}*"*"+)?{B}{0,3}"~~~"[~]* {
1746 if (yyextra->fenceSize==
getFenceSize(yytext,yyleng) && yyextra->fenceChar==
'~')
1747 {
1748 BEGIN(SkipCond);
1749 }
1750 }
1751<SkipCondVerbatim>^({B}*"*"+)?{B}{0,3}"```"[`]* {
1752 if (yyextra->fenceSize==
getFenceSize(yytext,yyleng) && yyextra->fenceChar==
'`')
1753 {
1754 BEGIN(SkipCond);
1755 }
1756 }
1757<SkipVerbatim>^({B}*"*"+)?{B}{0,3}"~~~"[~]* {
1759 if (yyextra->fenceSize==
getFenceSize(yytext,yyleng) && yyextra->fenceChar==
'~')
1760 {
1761 BEGIN(SkipCComment);
1762 }
1763 }
1764<SkipVerbatim>^({B}*"*"+)?{B}{0,3}"```"[`]* {
1766 if (yyextra->fenceSize==
getFenceSize(yytext,yyleng) && yyextra->fenceChar==
'`')
1767 {
1768 BEGIN(SkipCComment);
1769 }
1770 }
1771<SkipCondVerbatim>{CCE}|{CCS} { }
1772<SkipVerbatim>{CCE}|{CCS} {
1774 }
1775<JavaDocVerbatimCode>"{" {
1776 if (yyextra->javaBlock==0)
1777 {
1778 REJECT;
1779 }
1780 else
1781 {
1782 yyextra->javaBlock++;
1784 }
1785 }
1786<JavaDocVerbatimCode>"}" {
1787 if (yyextra->javaBlock==0)
1788 {
1789 REJECT;
1790 }
1791 else
1792 {
1793 yyextra->javaBlock--;
1794 if (yyextra->javaBlock==0)
1795 {
1797 BEGIN(SkipCComment);
1798 }
1799 else
1800 {
1802 }
1803 }
1804 }
1805<JavaDocVerbatimCode>\n { /* new line in verbatim block */
1807 }
1808<JavaDocVerbatimCode>. { /* any other character */
1810 }
1811<SkipCondVerbatim>[^{*\\@\x06~`\n\/]+ { }
1812<SkipCComment,SkipVerbatim>[^{*\\@\x06~`\n\/]+ {
1814 }
1815<SkipCComment,SkipVerbatim,SkipCondVerbatim>\n {
1816 yyextra->yyLineNr++;
1818 }
1819<SkipCondVerbatim>. { }
1820<SkipCComment,SkipVerbatim>. {
1822 }
1823<CopyCComment>[^*a-z_A-Z\x80-\xFF\n]*[^*a-z_A-Z\x80-\xFF\\\n] {
1824 yyextra->defLitText+=yytext;
1825 yyextra->defText+=
escapeAt(yytext);
1826 }
static QCString escapeAt(const QCString &text)
1827<CopyCComment>\\[\r]?\n {
1828 yyextra->defLitText+=yytext;
1829 yyextra->defText+=" ";
1830 yyextra->yyLineNr++;
1831 yyextra->yyMLines++;
1832 }
1833<CopyCComment>{CCE} {
1834 yyextra->defLitText+=yytext;
1835 yyextra->defText+=yytext;
1836 BEGIN(yyextra->lastCContext);
1837 }
1838<CopyCComment>\n {
1839 yyextra->yyLineNr++;
1840 yyextra->defLitText+=yytext;
1841 yyextra->defText+=' ';
1842 }
1843<RemoveCComment>{CCE}{B}*"#" { // see bug 594021 for a usecase for this rule
1844 if (yyextra->lastCContext==SkipCPPBlock)
1845 {
1846 BEGIN(SkipCommand);
1847 }
1848 else
1849 {
1850 REJECT;
1851 }
1852 }
1853<RemoveCComment>{CCE} { BEGIN(yyextra->lastCContext); }
1854<RemoveCComment>{CPPC}
1855<RemoveCComment>{CCS}
1856<RemoveCComment>[^*\x06\n]+
1857<RemoveCComment>\n { yyextra->yyLineNr++; outputChar(yyscanner,'\n'); }
1858<RemoveCComment>.
1859<SkipCPPComment>[^\n\/\\@]+ {
1861 }
1862<SkipCPPComment,RemoveCPPComment>\n {
1863 unput(*yytext);
1864 BEGIN(yyextra->lastCPPContext);
1865 }
1866<SkipCPPComment>{CCS} {
1868 }
1869<SkipCPPComment>{CPPC} {
1871 }
1872<SkipCPPComment>[^\x06\@\\\n]+ {
1874 }
1875<SkipCPPComment>. {
1877 }
1878<RemoveCPPComment>{CCS}
1879<RemoveCPPComment>{CPPC}
1880<RemoveCPPComment>[^\x06\n]+
1881<RemoveCPPComment>.
1882<DefineText>"__VA_OPT__("{B}*"##" {
1883 warn(yyextra->fileName,yyextra->yyLineNr,
1884 "'##' may not appear at the beginning of a __VA_OPT__()",
1885 yyextra->defName,yyextra->defLitText.stripWhiteSpace());
1886 yyextra->defText+="__VA_OPT__(";
1887 yyextra->defLitText+="__VA_OPT__(";
1888 }
1889<DefineText>"#"/"__VA_OPT__" {
1890 yyextra->defText+=yytext;
1891 yyextra->defLitText+=yytext;
1892 }
1893<DefineText>"#"/{IDSTART} {
1895 yyextra->quoteArg=
TRUE;
1896 yyextra->idStart=true;
1897 yyextra->defLitText+=yytext;
1898 }
1899<DefineText,CopyCComment>{ID} {
1900 yyextra->defLitText+=yytext;
1901 if (YY_START == DefineText)
outputSpaces(yyscanner,yytext);
1902 if (yyextra->quoteArg)
1903 {
1904 yyextra->defText+="\"";
1905 }
1906 if (yyextra->defArgs>0)
1907 {
1908 auto it = yyextra->argMap.find(yytext);
1909 if (it!=yyextra->argMap.end())
1910 {
1911 int n = it->second;
1912 yyextra->defText+='@';
1914 }
1915 else
1916 {
1917 if (yyextra->idStart)
1918 {
1919 warn(yyextra->fileName,yyextra->yyLineNr,
1920 "'#' is not followed by a macro parameter '{}': '{}'",
1921 yyextra->defName,yyextra->defLitText.stripWhiteSpace());
1922 }
1923 yyextra->defText+=yytext;
1924 }
1925 }
1926 else
1927 {
1928 yyextra->defText+=yytext;
1929 }
1930 if (yyextra->quoteArg)
1931 {
1932 yyextra->defText+="\"";
1933 }
1934 yyextra->quoteArg=
FALSE;
1935 yyextra->idStart=false;
1936 }
1937<CopyCComment>. {
1938 yyextra->defLitText+=yytext;
1939 yyextra->defText+=yytext;
1940 }
1941<DefineText>\\[\r]?\n {
1942 yyextra->defLitText+=yytext;
1945 yyextra->defText += ' ';
1946 yyextra->yyLineNr++;
1947 yyextra->yyMLines++;
1948 }
1949<DefineText>\n {
1951 yyextra->defText = yyextra->defText.stripWhiteSpace();
1952 if (yyextra->defText.startsWith("##"))
1953 {
1954 warn(yyextra->fileName,yyextra->yyLineNr,
1955 "'##' cannot occur at the beginning of a macro definition '{}': '{}'",
1956 yyextra->defName,yyextra->defLitText.stripWhiteSpace());
1957 }
1958 else if (yyextra->defText.endsWith("##"))
1959 {
1960 warn(yyextra->fileName,yyextra->yyLineNr,
1961 "'##' cannot occur at the end of a macro definition '{}': '{}'",
1962 yyextra->defName,yyextra->defLitText.stripWhiteSpace());
1963 }
1964 else if (yyextra->defText.endsWith("#"))
1965 {
1966 warn(yyextra->fileName,yyextra->yyLineNr,
1967 "expected formal parameter after # in macro definition '{}': '{}'",
1968 yyextra->defName,yyextra->defLitText.stripWhiteSpace());
1969 }
1971 {
1973 yyextra->defLitText=yyextra->defLitText.left(yyextra->defLitText.length()-
comment.length()-1);
1974 }
1976 yyextra->defLitText+=yytext;
1978
1979 if (yyextra->includeStack.empty() || yyextra->curlyCount>0)
1980 {
1982 }
1983 def=
isDefined(yyscanner,yyextra->defName);
1984 if (def==0)
1985 {
1986
1988 }
1989 else if (def )
1990
1991 {
1992
1993
1995 {
1997 def->
name = yyextra->defName;
1999 def->
nargs = yyextra->defArgs;
2001 def->
lineNr = yyextra->yyLineNr-yyextra->yyMLines;
2003 }
2004 else
2005 {
2006 if (def->
fileName != yyextra->fileName && !yyextra->expandOnlyPredef)
addDefine(yyscanner);
2007
2008 }
2009 }
2010 yyextra->argMap.clear();
2011 yyextra->yyLineNr++;
2012 yyextra->yyColNr=1;
2013 yyextra->lastGuardName.clear();
2014 BEGIN(Start);
2015 }
static void addMacroDefinition(yyscan_t yyscanner)
static void addDefine(yyscan_t yyscanner)
static QCString extractTrailingComment(const QCString &s)
2016<DefineText>{B}* { outputString(yyscanner,yytext);
2017 yyextra->defText += ' ';
2018 yyextra->defLitText+=yytext;
2019 }
2020<DefineText>{B}*"##"{B}* { outputString(yyscanner,substitute(yytext,"##"," "));
2021 yyextra->defText += "##";
2022 yyextra->defLitText+=yytext;
2023 }
2024<DefineText>"@" { outputString(yyscanner,substitute(yytext,"@@"," "));
2025 yyextra->defText += "@@";
2026 yyextra->defLitText+=yytext;
2027 }
2028<DefineText>\" {
2030 yyextra->defText += *yytext;
2031 yyextra->defLitText+=yytext;
2032 if (!yyextra->insideComment)
2033 {
2034 BEGIN(SkipDoubleQuote);
2035 }
2036 }
2037<DefineText>{NUMBER} {
2039 yyextra->defText += yytext;
2040 yyextra->defLitText+=yytext;
2041 }
2042<DefineText>\' {
2044 yyextra->defText += *yytext;
2045 yyextra->defLitText+=yytext;
2046 if (!yyextra->insideComment)
2047 {
2048 BEGIN(SkipSingleQuote);
2049 }
2050 }
2051<SkipDoubleQuote>{CPPC}[/]? { outputSpaces(yyscanner,yytext);
2052 yyextra->defText += yytext;
2053 yyextra->defLitText+=yytext;
2054 }
2055<SkipDoubleQuote>{CCS}[*]? { outputSpaces(yyscanner,yytext);
2056 yyextra->defText += yytext;
2057 yyextra->defLitText+=yytext;
2058 }
2059<SkipDoubleQuote>\" {
2061 yyextra->defText += *yytext;
2062 yyextra->defLitText+=yytext;
2063 BEGIN(DefineText);
2064 }
2065<SkipSingleQuote,SkipDoubleQuote>\\. {
2067 yyextra->defText += yytext;
2068 yyextra->defLitText+=yytext;
2069 }
2070<SkipSingleQuote>\' {
2072 yyextra->defText += *yytext;
2073 yyextra->defLitText+=yytext;
2074 BEGIN(DefineText);
2075 }
2076<SkipDoubleQuote,SkipSingleQuote>. { outputSpace(yyscanner,yytext[0]);
2077 yyextra->defText += *yytext;
2078 yyextra->defLitText += *yytext;
2079 }
2080<DefineText>. { outputSpace(yyscanner,yytext[0]);
2081 yyextra->defText += *yytext;
2082 yyextra->defLitText += *yytext;
2083 }
2084<<EOF>> {
2085 TRACE(
"End of include file");
2086
2087 if (yyextra->includeStack.empty())
2088 {
2089 TRACE(
"Terminating scanner");
2091 }
2092 else
2093 {
2094 QCString toFileName = yyextra->fileName;
2095 const std::unique_ptr<FileState> &fs=yyextra->includeStack.back();
2096
2097 YY_BUFFER_STATE oldBuf = YY_CURRENT_BUFFER;
2098 yy_switch_to_buffer( fs->bufState, yyscanner );
2099 yy_delete_buffer( oldBuf, yyscanner );
2100 yyextra->yyLineNr = fs->lineNr;
2101
2102 yyextra->inputBuf = fs->oldFileBuf;
2103 yyextra->inputBufPos = fs->oldFileBufPos;
2104 yyextra->curlyCount = fs->curlyCount;
2106 TRACE(
"switching to {}",yyextra->fileName);
2107
2108
2109
2111 lineStr.sprintf(
"# %d \"%s\" 2",yyextra->yyLineNr,
qPrint(yyextra->fileName));
2113
2114 yyextra->includeStack.pop_back();
2115
2116 {
2118
2119
2120
2121
2123 {
2124
2127 }
2128 else
2129 {
2131 {
2133 }
2134 }
2135 }
2136
2137 for (const auto &kv : yyextra->localDefines)
2138 {
2139 auto pair = yyextra->contextDefines.insert(kv);
2140 if (!pair.second)
2141 {
2142 yyextra->contextDefines.erase(pair.first);
2143 yyextra->contextDefines.insert(kv);
2144 }
2145 }
2146 yyextra->localDefines.clear();
2147 }
2148 }
2149<*>{CCS}/{CCE} |
2150<*>{CCS}[*!]? {
2151 if (YY_START==SkipVerbatim || YY_START == SkipCondVerbatim || YY_START==SkipCond || YY_START==IDLquote || YY_START == PragmaOnce)
2152 {
2153 REJECT;
2154 }
2155 else
2156 {
2158 yyextra->lastCContext=YY_START;
2159 yyextra->commentCount=1;
2160 if (yyleng==3)
2161 {
2162 yyextra->isSpecialComment = true;
2163 yyextra->lastGuardName.clear();
2164 }
2165 else
2166 {
2167 yyextra->isSpecialComment = false;
2168 }
2169 BEGIN(SkipCComment);
2170 }
2171 }
2172<*>{CPPC}[/!]? {
2173 if (YY_START==SkipVerbatim || YY_START == SkipCondVerbatim || YY_START==SkipCond ||
getLanguageFromFileName(yyextra->fileName)==SrcLangExt::Fortran || YY_START==IDLquote || YY_START == PragmaOnce)
2174 {
2175 REJECT;
2176 }
2177 else if (YY_START==RulesRoundDouble)
2178 {
2179 REJECT;
2180 }
2181 else
2182 {
2184 yyextra->lastCPPContext=YY_START;
2185 if (yyleng==3)
2186 {
2187 yyextra->isSpecialComment = true;
2188 yyextra->lastGuardName.clear();
2189 }
2190 else
2191 {
2192 yyextra->isSpecialComment = false;
2193 }
2194 BEGIN(SkipCPPComment);
2195 }
2196 }
2197<*>\n {
2199 yyextra->yyLineNr++;
2200 }
2201<*>. {
2202 yyextra->expectGuard =
FALSE;
2204 }
2205
2206%%