460 {
462 }
static char resolveTrigraph(char c)
463<Start>^{B}*"#" {
464 yyextra->yyColNr+=(int)yyleng;
465 yyextra->yyMLines=0;
466 yyextra->potentialDefine=yytext;
467 BEGIN(Command);
468 }
469<Start>^("%top{"|"%{") {
472 BEGIN(LexCopyLine);
473 }
static void outputArray(yyscan_t yyscanner, const char *a, yy_size_t len)
474<Start>^{Bopt}"cpp_quote"{Bopt}"("{Bopt}\" {
475 if (yyextra->insideIDL)
476 {
477 BEGIN(IDLquote);
478 }
479 else
480 {
481 REJECT;
482 }
483 }
484<IDLquote>"\\\\" {
486 }
487<IDLquote>"\\\"" {
489 }
490<IDLquote>"\""{Bopt}")" {
491 BEGIN(Start);
492 }
493<IDLquote>\n {
495 yyextra->yyLineNr++;
496 }
497<IDLquote>. {
499 }
500<Start>^{Bopt}/[^#] {
502 BEGIN(CopyLine);
503 }
504<Start>^{B}*[a-z_A-Z\x80-\xFF][a-z_A-Z0-9\x80-\xFF]+{B}*"("[^\)\n]*")"/{BN}{1,10}*[:{] { // constructors?
505 int i;
506 for (i=(int)yyleng-1;i>=0;i--)
507 {
508 unput(yytext[i]);
509 }
510 BEGIN(CopyLine);
511 }
512<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
513<Start>^{B}*[_A-Z][_A-Z0-9]+{B}*"("[^\)\n]*")"{B}*\n | // function like macro
514<Start>^{B}*[_A-Z][_A-Z0-9]+{B}*"("[^\(\)\n]*"("[^\)\n]*")"[^\)\n]*")"/{B}*("//"|"/\*") | // function list macro with one (...) argument followed by comment
515<Start>^{B}*[_A-Z][_A-Z0-9]+{B}*"("[^\)\n]*")"/{B}*("//"|"/\*") { // function like macro followed by comment
518 int pos = name.find('(');
519 if (pos<0) pos=0;
520 name=name.left(pos).stripWhiteSpace();
#define Config_getBool(name)
521
523 if (skipFuncMacros && !yyextra->insideFtn &&
524 name!="Q_PROPERTY" &&
525 !(
526 (yyextra->includeStack.empty() || yyextra->curlyCount>0) &&
527 yyextra->macroExpansion &&
529
531 )
532 )
533 {
534
535 if (yytext[yyleng-1] == '\n')
536 {
538 yyextra->yyLineNr++;
539 }
540 }
541 else
542 {
543 int i;
544 for (i=(int)yyleng-1;i>=0;i--)
545 {
546 unput(yytext[i]);
547 }
548 BEGIN(CopyLine);
549 }
550 }
551<CopyLine,LexCopyLine>"extern"{BN}*"\""[^\"]+"\""{BN}*("{")? {
553 yyextra->yyLineNr+=text.
contains(
'\n');
555 }
556<CopyLine,LexCopyLine>{RAWBEGIN} {
557 yyextra->delimiter = yytext+2;
558 yyextra->delimiter=yyextra->delimiter.left(yyextra->delimiter.length()-1);
560 BEGIN(CopyRawString);
561 }
562<CopyLine,LexCopyLine>"{" { // count brackets inside the main file
563 if (yyextra->includeStack.empty())
564 {
565 yyextra->curlyCount++;
566 }
568 }
569<LexCopyLine>^"%}" {
571 }
572<CopyLine,LexCopyLine>"}" { // count brackets inside the main file
573 if (yyextra->includeStack.empty() && yyextra->curlyCount>0)
574 {
575 yyextra->curlyCount--;
576 }
578 }
579<CopyLine,LexCopyLine>"'"\\[0-7]{1,3}"'" {
581 }
582<CopyLine,LexCopyLine>"'"\\."'" {
584 }
585<CopyLine,LexCopyLine>"'"."'" {
587 }
588<CopyLine,LexCopyLine>[$]?@\" {
591 BEGIN( CopyStringCs );
592 }
593<CopyLine,LexCopyLine>\" {
596 {
597 BEGIN( CopyString );
598 }
599 else
600 {
601 BEGIN( CopyStringFtnDouble );
602 }
603 }
604<CopyLine,LexCopyLine>\' {
607 BEGIN( CopyStringFtn );
608 }
609<CopyString>[^\"\\\r\n]+ {
611 }
612<CopyStringCs>[^\"\r\n]+ {
614 }
615<CopyStringCs>\"\" {
617 }
618<CopyString>\\. {
620 }
621<CopyString,CopyStringCs>\" {
623 BEGIN( CopyLine );
624 }
625<CopyStringFtnDouble>[^\"\\\r\n]+ {
627 }
628<CopyStringFtnDouble>\\. {
630 }
631<CopyStringFtnDouble>\" {
633 BEGIN( CopyLine );
634 }
635<CopyStringFtn>[^\'\\\r\n]+ {
637 }
638<CopyStringFtn>\\. {
640 }
641<CopyStringFtn>\' {
643 BEGIN( CopyLine );
644 }
645<CopyRawString>{RAWEND} {
648 delimiter=delimiter.
left(delimiter.
length()-1);
649 if (delimiter==yyextra->delimiter)
650 {
651 BEGIN( CopyLine );
652 }
653 }
654<CopyRawString>[^)]+ {
656 }
657<CopyRawString>. {
659 }
660<CopyLine,LexCopyLine>{ID}/{BN}{0,80}"(" {
661 yyextra->expectGuard =
FALSE;
663
664
665
666
667
668
669
670
671 if ((yyextra->includeStack.empty() || yyextra->curlyCount>0) &&
672 yyextra->macroExpansion &&
675 )
676 {
677
678 yyextra->roundCount=0;
679 yyextra->defArgsStr=yytext;
681 {
686 }
687 else
688 {
689 yyextra->findDefArgContext = CopyLine;
690 BEGIN(FindDefineArgs);
691 }
692 }
693 else
694 {
696 }
697 }
static QCString expandMacro(yyscan_t yyscanner, const QCString &name)
698<CopyLine>{RulesDelim} {
700 yyextra->lexRulesPart = !yyextra->lexRulesPart;
702 }
703
704<CopyLine>{RulesSharp} {
705 if (!yyextra->lexRulesPart) REJECT;
706 if (yyextra->curlyCount) REJECT;
708 BEGIN(RulesPattern);
709 }
710<RulesPattern>{EscapeRulesChar} {
712 }
713<RulesPattern>{RulesCurly} {
715 }
716<RulesPattern>{StartDouble} {
718 yyextra->lastContext = YY_START;
719 BEGIN(RulesDouble);
720 }
721<RulesDouble,RulesRoundDouble>"\\\\" {
723 }
724<RulesDouble,RulesRoundDouble>"\\\"" {
726 }
727<RulesDouble>"\"" {
729 BEGIN( yyextra->lastContext ) ;
730 }
731<RulesRoundDouble>"\"" {
733 BEGIN(RulesRound) ;
734 }
735<RulesDouble,RulesRoundDouble>. {
737 }
738<RulesPattern>{StartSquare} {
740 yyextra->lastContext = YY_START;
741 BEGIN(RulesSquare);
742 }
743<RulesSquare,RulesRoundSquare>{CHARCE} {
745 }
746<RulesSquare,RulesRoundSquare>"\\[" |
747<RulesSquare,RulesRoundSquare>"\\]" {
749 }
750<RulesSquare>"]" {
752 BEGIN(RulesPattern);
753 }
754<RulesRoundSquare>"]" {
756 BEGIN(RulesRound) ;
757 }
758<RulesSquare,RulesRoundSquare>"\\\\" {
760 }
761<RulesSquare,RulesRoundSquare>. {
763 }
764<RulesPattern>{StartRoundQuest} {
766 yyextra->lastContext = YY_START;
767 BEGIN(RulesRoundQuest);
768 }
769<RulesRoundQuest>{nl} {
771 }
772<RulesRoundQuest>[^)] {
774 }
775<RulesRoundQuest>")" {
777 BEGIN(yyextra->lastContext);
778 }
779<RulesPattern>{StartRound} {
780 yyextra->roundCount++;
782 yyextra->lastContext = YY_START;
783 BEGIN(RulesRound);
784 }
785<RulesRound>{RulesCurly} {
787 }
788<RulesRound>{StartSquare} {
790 BEGIN(RulesRoundSquare);
791 }
792<RulesRound>{StartDouble} {
794 BEGIN(RulesRoundDouble);
795 }
796<RulesRound>{EscapeRulesChar} {
798 }
799<RulesRound>"(" {
800 yyextra->roundCount++;
802 }
803<RulesRound>")" {
804 yyextra->roundCount--;
806 if (!yyextra->roundCount) BEGIN( yyextra->lastContext ) ;
807 }
808<RulesRound>{nl} {
810 }
811<RulesRound>{B} {
813 }
814<RulesRound>. {
816 }
817<RulesPattern>{B} {
819 BEGIN(CopyLine);
820 }
821<RulesPattern>. {
823 }
824
825<CopyLine,LexCopyLine>{ID} {
827 if ((yyextra->includeStack.empty() || yyextra->curlyCount>0) &&
828 yyextra->macroExpansion &&
832 )
833 {
838 }
839 else
840 {
842 }
843 }
844<CopyLine,LexCopyLine>"\\"\r?/\n { // strip line continuation characters
846 }
847<CopyLine,LexCopyLine>\\. {
849 }
850<CopyLine,LexCopyLine>. {
852 }
853<CopyLine,LexCopyLine>\n {
855 BEGIN(Start);
856 yyextra->yyLineNr++;
857 yyextra->yyColNr=1;
858 }
859<FindDefineArgs>"(" {
860 yyextra->defArgsStr+='(';
861 yyextra->roundCount++;
862 }
863<FindDefineArgs>")" {
864 yyextra->defArgsStr+=')';
865 yyextra->roundCount--;
866 if (yyextra->roundCount==0)
867 {
869
870 if (yyextra->findDefArgContext==CopyLine)
871 {
873 BEGIN(yyextra->findDefArgContext);
874 }
875 else
876 {
878 yyextra->nospaces=
FALSE;
879 BEGIN(Start);
880 }
881 }
882 }
883
static void readIncludeFile(yyscan_t yyscanner, const QCString &inc)
884<FindDefineArgs>")"{B}*"(" {
885 yyextra->defArgsStr+=yytext;
886 }
887 */
888<FindDefineArgs>{CHARLIT} {
889 yyextra->defArgsStr+=yytext;
890 }
891<FindDefineArgs>{CCS}[*]? {
892 yyextra->defArgsStr+=yytext;
893 BEGIN(ArgCopyCComment);
894 }
895<FindDefineArgs>{CPPC}[/!].*\n/{B}*{CPPC}[/!] { // replace multi line C++ style comment by C style comment
896 yyextra->defArgsStr+=
QCString(
"/**")+&yytext[3];
897 BEGIN(ArgCopyCppComment);
898 }
899<FindDefineArgs>{CPPC}[/!].*\n { // replace C++ single line style comment by C style comment
900 yyextra->defArgsStr+=
QCString(
"/**")+&yytext[3]+
" */";
901 }
902<FindDefineArgs>\" {
903 yyextra->defArgsStr+=*yytext;
904 BEGIN(ReadString);
905 }
906<FindDefineArgs>' {
908 yyextra->defArgsStr+=*yytext;
909 BEGIN(ReadString);
910 }
911<FindDefineArgs>\n {
912 yyextra->defArgsStr+=' ';
913 yyextra->yyLineNr++;
915 }
916<FindDefineArgs>"@" {
917 yyextra->defArgsStr+="@@";
918 }
919<FindDefineArgs>. {
920 yyextra->defArgsStr+=*yytext;
921 }
922<ArgCopyCComment>[^*\n]+ {
923 yyextra->defArgsStr+=yytext;
924 }
925<ArgCopyCComment>{CCE} {
926 yyextra->defArgsStr+=yytext;
927 BEGIN(FindDefineArgs);
928 }
929<ArgCopyCComment>\n {
930 yyextra->defArgsStr+=' ';
931 yyextra->yyLineNr++;
933 }
934<ArgCopyCComment>. {
935 yyextra->defArgsStr+=yytext;
936 }
937<ArgCopyCppComment>^{B}*
938<ArgCopyCppComment>{CPPC}[/!].*\n/{B}*{CPPC}[/!] { // replace multi line C++ style comment by C style comment
939 const char *startContent = &yytext[3];
940 if (startContent[0]=='<') startContent++;
941 yyextra->defArgsStr+=startContent;
942 }
943<ArgCopyCppComment>{CPPC}[/!].*\n { // replace C++ multie line style comment by C style comment
944 const char *startContent = &yytext[3];
945 if (startContent[0]=='<') startContent++;
946 yyextra->defArgsStr+=
QCString(startContent)+
" */";
947 BEGIN(FindDefineArgs);
948 }
949<ArgCopyCppComment>. { // unexpected character
950 unput(*yytext);
951 yyextra->defArgsStr+=" */";
952 BEGIN(FindDefineArgs);
953 }
954<ReadString>"\"" {
955 yyextra->defArgsStr+=*yytext;
956 BEGIN(FindDefineArgs);
957 }
958<ReadString>"'" {
960 yyextra->defArgsStr+=*yytext;
961 BEGIN(FindDefineArgs);
962 }
963
964<ReadString>{CPPC}|{CCS} {
965 yyextra->defArgsStr+=yytext;
966 }
967<ReadString>\\/\r?\n { // line continuation
968 }
969<ReadString>\\. {
970 yyextra->defArgsStr+=yytext;
971 }
972<ReadString>. {
973 yyextra->defArgsStr+=*yytext;
974 }
975<Command>("include"|"import"){B}+/{ID} {
976 yyextra->isImported = yytext[1]=='m';
977 if (yyextra->macroExpansion)
978 BEGIN(IncludeID);
979 }
980<Command>("include"|"import"){B}*[<"] {
981 yyextra->isImported = yytext[1]=='m';
982 char c[2];
983 c[0]=yytext[yyleng-1];c[1]='\0';
984 yyextra->incName=c;
985 BEGIN(Include);
986 }
987<Command>("cmake")?"define"{B}+ {
988 yyextra->potentialDefine +=
substitute(yytext,
"cmake",
" ");
989
990 yyextra->yyColNr+=(int)yyleng;
991 BEGIN(DefName);
992 }
QCString substitute(const QCString &s, const QCString &src, const QCString &dst)
substitute all occurrences of src in s by dst
993<Command>"cmakedefine01"{B}+ {
994 yyextra->potentialDefine +=
substitute(yytext,
"cmakedefine01",
" define ");
995
996 yyextra->yyColNr+=(int)yyleng;
997 BEGIN(CmakeDefName01);
998 }
999<Command>"ifdef"/{B}*"(" {
1001 yyextra->guardExpr.clear();
1002 BEGIN(DefinedExpr2);
1003 }
static void incrLevel(yyscan_t yyscanner)
1004<Command>"ifdef"/{B}+ {
1005
1007 yyextra->guardExpr.clear();
1008 BEGIN(DefinedExpr1);
1009 }
1010<Command>"ifndef"/{B}*"(" {
1012 yyextra->guardExpr="! ";
1013 BEGIN(DefinedExpr2);
1014 }
1015<Command>"ifndef"/{B}+ {
1017 yyextra->guardExpr="! ";
1018 BEGIN(DefinedExpr1);
1019 }
1020<Command>"if"/[ \t(!] {
1022 yyextra->guardExpr.clear();
1023 BEGIN(Guard);
1024 }
1025<Command>("elif"|"else"{B}*"if")/[ \t(!] {
1027 {
1028 yyextra->guardExpr.clear();
1029 BEGIN(Guard);
1030 }
1031 else
1032 {
1033 yyextra->ifcount=0;
1034 BEGIN(SkipCPPBlock);
1035 }
1036 }
static bool otherCaseDone(yyscan_t yyscanner)
1037<Command>"else"/[^a-z_A-Z0-9\x80-\xFF] {
1039 {
1040 yyextra->ifcount=0;
1041 BEGIN(SkipCPPBlock);
1042 }
1043 else
1044 {
1046 }
1047 }
static void setCaseDone(yyscan_t yyscanner, bool value)
1048<Command>"undef"{B}+ {
1049 BEGIN(UndefName);
1050 }
1051<Command>("elif"|"else"{B}*"if")/[ \t(!] {
1053 {
1054 yyextra->guardExpr.clear();
1055 BEGIN(Guard);
1056 }
1057 }
1058<Command>"endif"/[^a-z_A-Z0-9\x80-\xFF] {
1059
1061 }
static void decrLevel(yyscan_t yyscanner)
1062<Command,IgnoreLine>\n {
1064 BEGIN(Start);
1065 yyextra->yyLineNr++;
1066 }
1067<Command>"pragma"{B}+"once" {
1068 yyextra->expectGuard =
FALSE;
1069 if (yyextra->pragmaSet.find(yyextra->fileName.str())!=yyextra->pragmaSet.end())
1070 {
1072 BEGIN(PragmaOnce);
1073 }
1074 else
1075 {
1076 yyextra->pragmaSet.insert(yyextra->fileName.data());
1077 }
1078 }
1079<PragmaOnce>. {}
1080<PragmaOnce>\n {}
1081<PragmaOnce><<EOF>> {
1082 yyextra->expectGuard =
FALSE;
1083 BEGIN(Start);
1084 }
1085<Command>{ID} { // unknown directive
1086 BEGIN(IgnoreLine);
1087 }
1088<IgnoreLine>\\[\r]?\n {
1090 yyextra->yyLineNr++;
1091 }
1092<IgnoreLine>.
1093<Command>. { yyextra->potentialDefine += yytext[0]=='\t' ? '\t' : ' ';
1094 yyextra->yyColNr+=(int)yyleng;
1095 }
1096<UndefName>{ID} {
1099
1101 )
1102 {
1103
1105 }
1106 BEGIN(Start);
1107 }
1108<Guard>\\[\r]?\n {
1110 yyextra->guardExpr+=' ';
1111 yyextra->yyLineNr++;
1112 }
1113<Guard>"defined"/{B}*"(" {
1114 BEGIN(DefinedExpr2);
1115 }
1116<Guard>"defined"/{B}+ {
1117 BEGIN(DefinedExpr1);
1118 }
1119<Guard>"true"/{B}|{B}*[\r]?\n { yyextra->guardExpr+="1L"; }
1120<Guard>"false"/{B}|{B}*[\r]?\n { yyextra->guardExpr+="0L"; }
1121<Guard>"not"/{B} { yyextra->guardExpr+='!'; }
1122<Guard>"not_eq"/{B} { yyextra->guardExpr+="!="; }
1123<Guard>"and"/{B} { yyextra->guardExpr+="&&"; }
1124<Guard>"or"/{B} { yyextra->guardExpr+="||"; }
1125<Guard>"bitand"/{B} { yyextra->guardExpr+="&"; }
1126<Guard>"bitor"/{B} { yyextra->guardExpr+="|"; }
1127<Guard>"xor"/{B} { yyextra->guardExpr+="^"; }
1128<Guard>"compl"/{B} { yyextra->guardExpr+="~"; }
1129<Guard>{ID} { yyextra->guardExpr+=yytext; }
1130<Guard>"@" { yyextra->guardExpr+="@@"; }
1131<Guard>. { yyextra->guardExpr+=*yytext; }
1132<Guard>\n {
1133 unput(*yytext);
1134
1135
1138 if (guard)
1139 {
1140 BEGIN(Start);
1141 }
1142 else
1143 {
1144 yyextra->ifcount=0;
1145 BEGIN(SkipCPPBlock);
1146 }
1147 }
static bool computeExpression(yyscan_t yyscanner, const QCString &expr)
1148<DefinedExpr1,DefinedExpr2>\\\n { yyextra->yyLineNr++; outputChar(yyscanner,'\n'); }
1149<DefinedExpr1>{ID} {
1150 if (
isDefined(yyscanner,yytext) || yyextra->guardName==yytext)
1151 yyextra->guardExpr+=" 1L ";
1152 else
1153 yyextra->guardExpr+=" 0L ";
1154 yyextra->lastGuardName=yytext;
1155 BEGIN(Guard);
1156 }
1157<DefinedExpr2>{ID} {
1158 if (
isDefined(yyscanner,yytext) || yyextra->guardName==yytext)
1159 yyextra->guardExpr+=" 1L ";
1160 else
1161 yyextra->guardExpr+=" 0L ";
1162 yyextra->lastGuardName=yytext;
1163 }
1164<DefinedExpr1,DefinedExpr2>\n { // should not happen, handle anyway
1165 yyextra->yyLineNr++;
1166 yyextra->ifcount=0;
1167 BEGIN(SkipCPPBlock);
1168 }
1169<DefinedExpr2>")" {
1170 BEGIN(Guard);
1171 }
1172<DefinedExpr1,DefinedExpr2>.
1173<SkipCPPBlock>^{B}*"#" { BEGIN(SkipCommand); }
1174<SkipCPPBlock>^{Bopt}/[^#] { BEGIN(SkipLine); }
1175<SkipCPPBlock>\n { yyextra->yyLineNr++; outputChar(yyscanner,'\n'); }
1176<SkipCPPBlock>.
1177<SkipCommand>"if"(("n")?("def"))?/[ \t(!] {
1179 yyextra->ifcount++;
1180
1181 }
1182<SkipCommand>"else" {
1183
1185 {
1187
1188 BEGIN(Start);
1189 }
1190 }
1191<SkipCommand>("elif"|"else"{B}*"if")/[ \t(!] {
1192 if (yyextra->ifcount==0)
1193 {
1195 {
1196 yyextra->guardExpr.clear();
1197 yyextra->lastGuardName.clear();
1198 BEGIN(Guard);
1199 }
1200 else
1201 {
1202 BEGIN(SkipCPPBlock);
1203 }
1204 }
1205 }
1206<SkipCommand>"endif" {
1207 yyextra->expectGuard =
FALSE;
1209 if (--yyextra->ifcount<0)
1210 {
1211
1212 BEGIN(Start);
1213 }
1214 }
1215<SkipCommand>\n {
1217 yyextra->yyLineNr++;
1218 BEGIN(SkipCPPBlock);
1219 }
1220<SkipCommand>{ID} { // unknown directive
1221 BEGIN(SkipLine);
1222 }
1223<SkipCommand>.
1224<SkipLine>[^'"/\n]+
1225<SkipLine>{CHARLIT} { }
1226<SkipLine>\" {
1227 BEGIN(SkipString);
1228 }
1229<SkipLine>.
1230<SkipString>{CPPC}/[^\n]* {
1231 }
1232<SkipLine,SkipCommand,SkipCPPBlock>{CPPC}[^\n]* {
1233 yyextra->lastCPPContext=YY_START;
1234 BEGIN(RemoveCPPComment);
1235 }
1236<SkipString>{CCS}/[^\n]* {
1237 }
1238<SkipLine,SkipCommand,SkipCPPBlock>{CCS}/[^\n]* {
1239 yyextra->lastCContext=YY_START;
1240 BEGIN(RemoveCComment);
1241 }
1242<SkipLine>\n {
1244 yyextra->yyLineNr++;
1245 BEGIN(SkipCPPBlock);
1246 }
1247<SkipString>[^"\\\n]+ { }
1248<SkipString>\\. { }
1249<SkipString>\" {
1250 BEGIN(SkipLine);
1251 }
1252<SkipString>. { }
1253<IncludeID>{ID}{Bopt}/"(" {
1254 yyextra->nospaces=
TRUE;
1255 yyextra->roundCount=0;
1256 yyextra->defArgsStr=yytext;
1257 yyextra->findDefArgContext = IncludeID;
1258 BEGIN(FindDefineArgs);
1259 }
1260<IncludeID>{ID} {
1261 yyextra->nospaces=
TRUE;
1263 BEGIN(Start);
1264 }
1265<Include>[^\">\n]+[\">] {
1266 yyextra->incName+=yytext;
1267 if (yyextra->isImported)
1268 {
1269 BEGIN(EndImport);
1270 }
1271 else
1272 {
1274 BEGIN(Start);
1275 }
1276 }
1277<EndImport>{ENDIMPORTopt}/\n {
1279 BEGIN(Start);
1280 }
1281<EndImport>\\[\r]?"\n" {
1283 yyextra->yyLineNr++;
1284 }
1285<EndImport>. {
1286 }
1287<DefName>{ID}/("\\\n")*"(" { // define with argument
1288
1289 yyextra->argMap.clear();
1290 yyextra->defArgs = 0;
1291 yyextra->defArgsStr.clear();
1292 yyextra->defText.clear();
1293 yyextra->defLitText.clear();
1294 yyextra->defName = yytext;
1295 yyextra->defVarArgs =
FALSE;
1296 yyextra->defExtraSpacing.clear();
1297 yyextra->defContinue = false;
1298 BEGIN(DefineArg);
1299 }
1300<DefName>{ID}{B}+"1"/[ \r\t\n] { // special case: define with 1 -> can be "guard"
1301
1302 yyextra->argMap.clear();
1303 yyextra->defArgs = -1;
1304 yyextra->defArgsStr.clear();
1306 yyextra->defVarArgs =
FALSE;
1307
1308
1309 if (yyextra->curlyCount>0 || yyextra->defName!=yyextra->lastGuardName || !yyextra->expectGuard)
1310 {
1311 QCString def = yyextra->potentialDefine +
1312 yyextra->defName ;
1314 outputSpaces(yyscanner,yytext+yyextra->defName.length());
1315 yyextra->quoteArg=
FALSE;
1316 yyextra->insideComment=
FALSE;
1317 yyextra->lastGuardName.clear();
1318 yyextra->defText="1";
1319 yyextra->defLitText="1";
1320 BEGIN(DefineText);
1321 }
1322 else
1323 {
1324
1325 yyextra->defText.clear();
1326 yyextra->defLitText.clear();
1327 BEGIN(Start);
1328 }
1329 yyextra->expectGuard=
FALSE;
1330 }
static void outputSpaces(yyscan_t yyscanner, char *s)
1331<DefName,CmakeDefName01>{ID}/{B}*"\n" { // empty define
1332 yyextra->argMap.clear();
1333 yyextra->defArgs = -1;
1334 yyextra->defName = yytext;
1335 yyextra->defArgsStr.clear();
1336 yyextra->defText.clear();
1337 yyextra->defLitText.clear();
1338 yyextra->defVarArgs =
FALSE;
1339
1340
1341 if (yyextra->curlyCount>0 || yyextra->defName!=yyextra->lastGuardName || !yyextra->expectGuard)
1342 {
1343 QCString def = yyextra->potentialDefine + yyextra->defName;
1345 yyextra->quoteArg=
FALSE;
1346 yyextra->insideComment=
FALSE;
1347 if (YY_START == CmakeDefName01) yyextra->defText = "0";
1348 else if (yyextra->insideCS) yyextra->defText="1";
1349 BEGIN(DefineText);
1350 }
1351 else
1352 {
1353
1354 yyextra->guardName = yytext;
1355 yyextra->lastGuardName.clear();
1356 BEGIN(Start);
1357 }
1358 yyextra->expectGuard=
FALSE;
1359 }
1360<DefName>{ID}/{B}* { // define with content
1361
1362 yyextra->argMap.clear();
1363 yyextra->defArgs = -1;
1364 yyextra->defArgsStr.clear();
1365 yyextra->defText.clear();
1366 yyextra->defLitText.clear();
1367 yyextra->defName = yytext;
1368 yyextra->defVarArgs =
FALSE;
1369 QCString def = yyextra->potentialDefine +
1370 yyextra->defName +
1371 yyextra->defArgsStr ;
1373 yyextra->quoteArg=
FALSE;
1374 yyextra->insideComment=
FALSE;
1375 BEGIN(DefineText);
1376 }
1377<DefineArg>"\\\n" {
1378 yyextra->defExtraSpacing+="\n";
1379 yyextra->defContinue = true;
1380 yyextra->yyLineNr++;
1381 }
1382<DefineArg>{B}* { yyextra->defExtraSpacing+=yytext; }
1383<DefineArg>","{B}* { yyextra->defArgsStr+=yytext; }
1384<DefineArg>"("{B}* { yyextra->defArgsStr+=yytext; }
1385<DefineArg>{B}*")"{B}* {
1387 yyextra->defArgsStr+=yytext;
1388 QCString def = yyextra->potentialDefine +
1389 yyextra->defName +
1390 yyextra->defArgsStr +
1391 yyextra->defExtraSpacing ;
1393 yyextra->quoteArg=
FALSE;
1394 yyextra->insideComment=
FALSE;
1395 BEGIN(DefineText);
1396 }
static void extraSpacing(yyscan_t yyscanner)
1397<DefineArg>"..." { // Variadic macro
1398 yyextra->defVarArgs =
TRUE;
1399 yyextra->defArgsStr+=yytext;
1400 yyextra->argMap.emplace(std::string("__VA_ARGS__"),yyextra->defArgs);
1401 yyextra->defArgs++;
1402 }
1403<DefineArg>{ID}{B}*("..."?) {
1404
1406 yyextra->defVarArgs = yytext[yyleng-1]=='.';
1407 if (yyextra->defVarArgs)
1408 {
1410 }
1412 yyextra->defArgsStr+=yytext;
1413 yyextra->argMap.emplace(
toStdString(argName),yyextra->defArgs);
1414 yyextra->defArgs++;
1416 }
1417
1418<DefineText>"/ **"|"/ *!" {
1419 yyextra->defText+=yytext;
1420 yyextra->defLitText+=yytext;
1421 yyextra->insideComment=
TRUE;
1422 }
1423<DefineText>"* /" {
1424 yyextra->defText+=yytext;
1425 yyextra->defLitText+=yytext;
1426 yyextra->insideComment=
FALSE;
1427 }
1428 */
1429<DefineText>{CCS}[!*]? {
1430 yyextra->defText+=yytext;
1431 yyextra->defLitText+=yytext;
1432 yyextra->lastCContext=YY_START;
1433 yyextra->commentCount=1;
1434 BEGIN(CopyCComment);
1435 }
1436<DefineText>{CPPC}[!/]? {
1438 yyextra->lastCPPContext=YY_START;
1439 yyextra->defLitText+=' ';
1440 BEGIN(SkipCPPComment);
1441 }
1442<SkipCComment>[/]?{CCE} {
1443 if (yytext[0]==
'/')
outputChar(yyscanner,
'/');
1445 if (--yyextra->commentCount<=0)
1446 {
1447 if (yyextra->lastCContext==Start)
1448
1449
1450 {
1451 YY_CURRENT_BUFFER->yy_at_bol=1;
1452 }
1453 BEGIN(yyextra->lastCContext);
1454 }
1455 }
1456<SkipCComment>{CPPC}("/")* {
1458 }
1459<SkipCComment>{CCS} {
1461
1462 }
1463<SkipCond>[\\@][\\@] { }
1464<SkipCond>^({B}*"*"+)?{B}{0,3}"~~~"[~]* {
1466 if (!markdownSupport || !yyextra->isSpecialComment)
1467 {
1468 REJECT;
1469 }
1470 else
1471 {
1472 yyextra->fenceChar='~';
1474 BEGIN(SkipCondVerbatim);
1475 }
1476 }
static yy_size_t getFenceSize(char *txt, yy_size_t leng)
1477<SkipCond>^({B}*"*"+)?{B}{0,3}"```"[`]* {
1479 if (!markdownSupport || !yyextra->isSpecialComment)
1480 {
1481 REJECT;
1482 }
1483 else
1484 {
1485 yyextra->fenceChar='`';
1487 BEGIN(SkipCondVerbatim);
1488 }
1489 }
1490<SkipCComment>^({B}*"*"+)?{B}{0,3}"~~~"[~]* {
1492 if (!markdownSupport || !yyextra->isSpecialComment)
1493 {
1494 REJECT;
1495 }
1496 else
1497 {
1499 yyextra->fenceChar='~';
1501 BEGIN(SkipVerbatim);
1502 }
1503 }
1504<SkipCComment>^({B}*"*"+)?{B}{0,3}"```"[`]* {
1506 if (!markdownSupport || !yyextra->isSpecialComment)
1507 {
1508 REJECT;
1509 }
1510 else
1511 {
1513 yyextra->fenceChar='`';
1515 BEGIN(SkipVerbatim);
1516 }
1517 }
1518<SkipCComment>[\\@]{VERBATIM_LINE} |
1519<SkipCComment>[\\@]{LITERAL_BLOCK} { // escaped command
1522 }
1523<SkipCComment>{VERBATIM_LINE}.*/\n { // normal command
1525 }
1526<SkipCComment>{LITERAL_BLOCK} { // normal block command
1530 BEGIN(SkipVerbatim);
1531 }
static void determineBlockName(yyscan_t yyscanner)
1532<SkipCond>[\\@][\\@]"cond"[ \t]+ {}// escaped cond command
1533<SkipCond>[\\@]"cond"/\n |
1534<SkipCond>[\\@]"cond"[ \t]+ { // cond command in a skipped cond section, this section has to be skipped as well
1535
1537 }
static void startCondSection(yyscan_t yyscanner, const QCString §Id)
1538<SkipCComment>"{"[ \t]*"@code"/[ \t\n] {
1540 yyextra->javaBlock=1;
1541 BEGIN(JavaDocVerbatimCode);
1542 }
1543<SkipCComment>"{"[ \t]*"@literal"/[ \t\n] {
1545 yyextra->javaBlock=1;
1546 BEGIN(JavaDocVerbatimCode);
1547 }
1548<SkipCComment,SkipCPPComment>[\\@][\\@]"cond"[ \t\n]+ { // escaped cond command
1550 }
1551<SkipCPPComment>[\\@]"cond"[ \t]+ { // conditional section
1552 yyextra->ccomment=
TRUE;
1553 yyextra->condCtx=YY_START;
1554 BEGIN(CondLineCpp);
1555 }
1556<SkipCComment>[\\@]"cond"[ \t]+ { // conditional section
1557 yyextra->ccomment=
FALSE;
1558 yyextra->condCtx=YY_START;
1559 BEGIN(CondLineC);
1560 }
1561<CondLineC,CondLineCpp>[!()&| \ta-z_A-Z0-9\x80-\xFF.\-]+ {
1563 if (yyextra->skip)
1564 {
1565 if (YY_START==CondLineC)
1566 {
1567
1569 yyextra->ccomment=
TRUE;
1570 }
1571 else
1572 {
1573 yyextra->ccomment=
FALSE;
1574 }
1575 BEGIN(SkipCond);
1576 }
1577 else
1578 {
1579 BEGIN(yyextra->condCtx);
1580 }
1581 }
1582<CondLineC,CondLineCpp>. { // non-guard character
1583 unput(*yytext);
1585 if (yyextra->skip)
1586 {
1587 if (YY_START==CondLineC)
1588 {
1589
1591 yyextra->ccomment=
TRUE;
1592 }
1593 else
1594 {
1595 yyextra->ccomment=
FALSE;
1596 }
1597 BEGIN(SkipCond);
1598 }
1599 else
1600 {
1601 BEGIN(yyextra->condCtx);
1602 }
1603 }
1604<SkipCComment,SkipCPPComment>[\\@]"cond"{WSopt}/\n { // no guard
1605 if (YY_START==SkipCComment)
1606 {
1607 yyextra->ccomment=
TRUE;
1608
1610 }
1611 else
1612 {
1613 yyextra->ccomment=
FALSE;
1614 }
1615 yyextra->condCtx=YY_START;
1617 BEGIN(SkipCond);
1618 }
1619<SkipCond>\n { yyextra->yyLineNr++; outputChar(yyscanner,'\n'); }
1620<SkipCond>{VERBATIM_LINE}.*/\n { }
1621<SkipCond>{LITERAL_BLOCK} {
1623 yyextra->yyLineNr+=numNLs;
1624 for (
int i = 0; i < numNLs; i++)
outputChar(yyscanner,
'\n');
1626 BEGIN(SkipCondVerbatim);
1627 }
1628
1629<SkipCond>. { }
1630<SkipCond>[^\/\!*\\@\n]+ { }
1631<SkipCond>{CPPC}[/!] { yyextra->ccomment=FALSE; }
1632<SkipCond>{CCS}[*!] { yyextra->ccomment=TRUE; }
1633<SkipCond,SkipCComment,SkipCPPComment>[\\@][\\@]"endcond"/[^a-z_A-Z0-9\x80-\xFF] {
1634 if (!yyextra->skip)
1635 {
1637 }
1638 }
1639<SkipCond>[\\@]"endcond"/[^a-z_A-Z0-9\x80-\xFF] {
1640 bool oldSkip = yyextra->skip;
1642 if (oldSkip && !yyextra->skip)
1643 {
1644 if (yyextra->ccomment)
1645 {
1647 }
1648 BEGIN(yyextra->condCtx);
1649 }
1650 }
static void endCondSection(yyscan_t yyscanner)
1651<SkipCComment,SkipCPPComment>[\\@]"endcond"/[^a-z_A-Z0-9\x80-\xFF] {
1652 bool oldSkip = yyextra->skip;
1654 if (oldSkip && !yyextra->skip)
1655 {
1656 BEGIN(yyextra->condCtx);
1657 }
1658 }
1659<SkipCondVerbatim>{LITERAL_BLOCK_END} { /* end of verbatim block */
1660 if (yytext[1]=='f' && yyextra->blockName==&yytext[2])
1661 {
1662 BEGIN(SkipCond);
1663 }
1664 else if (&yytext[4]==yyextra->blockName)
1665 {
1666 BEGIN(SkipCond);
1667 }
1668 }
1669<SkipVerbatim>{LITERAL_BLOCK_END} { /* end of verbatim block */
1671 if (yytext[1]=='f' && yyextra->blockName==&yytext[2])
1672 {
1673 BEGIN(SkipCComment);
1674 }
1675 else if (&yytext[4]==yyextra->blockName)
1676 {
1677 BEGIN(SkipCComment);
1678 }
1679 }
1680<SkipCondVerbatim>^({B}*"*"+)?{B}{0,3}"~~~"[~]* {
1681 if (yyextra->fenceSize==
getFenceSize(yytext,yyleng) && yyextra->fenceChar==
'~')
1682 {
1683 BEGIN(SkipCond);
1684 }
1685 }
1686<SkipCondVerbatim>^({B}*"*"+)?{B}{0,3}"```"[`]* {
1687 if (yyextra->fenceSize==
getFenceSize(yytext,yyleng) && yyextra->fenceChar==
'`')
1688 {
1689 BEGIN(SkipCond);
1690 }
1691 }
1692<SkipVerbatim>^({B}*"*"+)?{B}{0,3}"~~~"[~]* {
1694 if (yyextra->fenceSize==
getFenceSize(yytext,yyleng) && yyextra->fenceChar==
'~')
1695 {
1696 BEGIN(SkipCComment);
1697 }
1698 }
1699<SkipVerbatim>^({B}*"*"+)?{B}{0,3}"```"[`]* {
1701 if (yyextra->fenceSize==
getFenceSize(yytext,yyleng) && yyextra->fenceChar==
'`')
1702 {
1703 BEGIN(SkipCComment);
1704 }
1705 }
1706<SkipCondVerbatim>{CCE}|{CCS} { }
1707<SkipVerbatim>{CCE}|{CCS} {
1709 }
1710<JavaDocVerbatimCode>"{" {
1711 if (yyextra->javaBlock==0)
1712 {
1713 REJECT;
1714 }
1715 else
1716 {
1717 yyextra->javaBlock++;
1719 }
1720 }
1721<JavaDocVerbatimCode>"}" {
1722 if (yyextra->javaBlock==0)
1723 {
1724 REJECT;
1725 }
1726 else
1727 {
1728 yyextra->javaBlock--;
1729 if (yyextra->javaBlock==0)
1730 {
1732 BEGIN(SkipCComment);
1733 }
1734 else
1735 {
1737 }
1738 }
1739 }
1740<JavaDocVerbatimCode>\n { /* new line in verbatim block */
1742 }
1743<JavaDocVerbatimCode>. { /* any other character */
1745 }
1746<SkipCondVerbatim>[^{*\\@\x06~`\n\/]+ { }
1747<SkipCComment,SkipVerbatim>[^{*\\@\x06~`\n\/]+ {
1749 }
1750<SkipCComment,SkipVerbatim,SkipCondVerbatim>\n {
1751 yyextra->yyLineNr++;
1753 }
1754<SkipCondVerbatim>. { }
1755<SkipCComment,SkipVerbatim>. {
1757 }
1758<CopyCComment>[^*a-z_A-Z\x80-\xFF\n]*[^*a-z_A-Z\x80-\xFF\\\n] {
1759 yyextra->defLitText+=yytext;
1760 yyextra->defText+=
escapeAt(yytext);
1761 }
static QCString escapeAt(const QCString &text)
1762<CopyCComment>\\[\r]?\n {
1763 yyextra->defLitText+=yytext;
1764 yyextra->defText+=" ";
1765 yyextra->yyLineNr++;
1766 yyextra->yyMLines++;
1767 }
1768<CopyCComment>{CCE} {
1769 yyextra->defLitText+=yytext;
1770 yyextra->defText+=yytext;
1771 BEGIN(yyextra->lastCContext);
1772 }
1773<CopyCComment>\n {
1774 yyextra->yyLineNr++;
1775 yyextra->defLitText+=yytext;
1776 yyextra->defText+=' ';
1777 }
1778<RemoveCComment>{CCE}{B}*"#" { // see bug 594021 for a usecase for this rule
1779 if (yyextra->lastCContext==SkipCPPBlock)
1780 {
1781 BEGIN(SkipCommand);
1782 }
1783 else
1784 {
1785 REJECT;
1786 }
1787 }
1788<RemoveCComment>{CCE} { BEGIN(yyextra->lastCContext); }
1789<RemoveCComment>{CPPC}
1790<RemoveCComment>{CCS}
1791<RemoveCComment>[^*\x06\n]+
1792<RemoveCComment>\n { yyextra->yyLineNr++; outputChar(yyscanner,'\n'); }
1793<RemoveCComment>.
1794<SkipCPPComment>[^\n\/\\@]+ {
1796 }
1797<SkipCPPComment,RemoveCPPComment>\n {
1798 unput(*yytext);
1799 BEGIN(yyextra->lastCPPContext);
1800 }
1801<SkipCPPComment>{CCS} {
1803 }
1804<SkipCPPComment>{CPPC} {
1806 }
1807<SkipCPPComment>[^\x06\@\\\n]+ {
1809 }
1810<SkipCPPComment>. {
1812 }
1813<RemoveCPPComment>{CCS}
1814<RemoveCPPComment>{CPPC}
1815<RemoveCPPComment>[^\x06\n]+
1816<RemoveCPPComment>.
1817<DefineText>"#"/{IDSTART} {
1819 yyextra->quoteArg=
TRUE;
1820 yyextra->idStart=true;
1821 yyextra->defLitText+=yytext;
1822 }
1823<DefineText,CopyCComment>{ID} {
1824 yyextra->defLitText+=yytext;
1825 if (YY_START == DefineText)
outputSpaces(yyscanner,yytext);
1826 if (yyextra->quoteArg)
1827 {
1828 yyextra->defText+="\"";
1829 }
1830 if (yyextra->defArgs>0)
1831 {
1832 auto it = yyextra->argMap.find(yytext);
1833 if (it!=yyextra->argMap.end())
1834 {
1835 int n = it->second;
1836 yyextra->defText+='@';
1838 }
1839 else
1840 {
1841 if (yyextra->idStart)
1842 {
1843 warn(yyextra->fileName,yyextra->yyLineNr,
1844 "'#' is not followed by a macro parameter '{}': '{}'",
1845 yyextra->defName,yyextra->defLitText.stripWhiteSpace());
1846 }
1847 yyextra->defText+=yytext;
1848 }
1849 }
1850 else
1851 {
1852 yyextra->defText+=yytext;
1853 }
1854 if (yyextra->quoteArg)
1855 {
1856 yyextra->defText+="\"";
1857 }
1858 yyextra->quoteArg=
FALSE;
1859 yyextra->idStart=false;
1860 }
1861<CopyCComment>. {
1862 yyextra->defLitText+=yytext;
1863 yyextra->defText+=yytext;
1864 }
1865<DefineText>\\[\r]?\n {
1866 yyextra->defLitText+=yytext;
1869 yyextra->defText += ' ';
1870 yyextra->yyLineNr++;
1871 yyextra->yyMLines++;
1872 }
1873<DefineText>\n {
1875 yyextra->defText = yyextra->defText.stripWhiteSpace();
1876 if (yyextra->defText.startsWith("##"))
1877 {
1878 warn(yyextra->fileName,yyextra->yyLineNr,
1879 "'##' cannot occur at the beginning of a macro definition '{}': '{}'",
1880 yyextra->defName,yyextra->defLitText.stripWhiteSpace());
1881 }
1882 else if (yyextra->defText.endsWith("##"))
1883 {
1884 warn(yyextra->fileName,yyextra->yyLineNr,
1885 "'##' cannot occur at the end of a macro definition '{}': '{}'",
1886 yyextra->defName,yyextra->defLitText.stripWhiteSpace());
1887 }
1888 else if (yyextra->defText.endsWith("#"))
1889 {
1890 warn(yyextra->fileName,yyextra->yyLineNr,
1891 "expected formal parameter after # in macro definition '{}': '{}'",
1892 yyextra->defName,yyextra->defLitText.stripWhiteSpace());
1893 }
1895 {
1897 yyextra->defLitText=yyextra->defLitText.left(yyextra->defLitText.length()-
comment.length()-1);
1898 }
1900 yyextra->defLitText+=yytext;
1902
1903 if (yyextra->includeStack.empty() || yyextra->curlyCount>0)
1904 {
1906 }
1907 def=
isDefined(yyscanner,yyextra->defName);
1908 if (def==0)
1909 {
1910
1912 }
1913 else if (def )
1914
1915 {
1916
1917
1919 {
1921 def->
name = yyextra->defName;
1923 def->
nargs = yyextra->defArgs;
1925 def->
lineNr = yyextra->yyLineNr-yyextra->yyMLines;
1927 }
1928 else
1929 {
1930 if (def->
fileName != yyextra->fileName && !yyextra->expandOnlyPredef)
addDefine(yyscanner);
1931
1932 }
1933 }
1934 yyextra->argMap.clear();
1935 yyextra->yyLineNr++;
1936 yyextra->yyColNr=1;
1937 yyextra->lastGuardName.clear();
1938 BEGIN(Start);
1939 }
static void addMacroDefinition(yyscan_t yyscanner)
static void addDefine(yyscan_t yyscanner)
static QCString extractTrailingComment(const QCString &s)
1940<DefineText>{B}* { outputString(yyscanner,yytext);
1941 yyextra->defText += ' ';
1942 yyextra->defLitText+=yytext;
1943 }
1944<DefineText>{B}*"##"{B}* { outputString(yyscanner,substitute(yytext,"##"," "));
1945 yyextra->defText += "##";
1946 yyextra->defLitText+=yytext;
1947 }
1948<DefineText>"@" { outputString(yyscanner,substitute(yytext,"@@"," "));
1949 yyextra->defText += "@@";
1950 yyextra->defLitText+=yytext;
1951 }
1952<DefineText>\" {
1954 yyextra->defText += *yytext;
1955 yyextra->defLitText+=yytext;
1956 if (!yyextra->insideComment)
1957 {
1958 BEGIN(SkipDoubleQuote);
1959 }
1960 }
1961<DefineText>\' {
1963 yyextra->defText += *yytext;
1964 yyextra->defLitText+=yytext;
1965 if (!yyextra->insideComment)
1966 {
1967 BEGIN(SkipSingleQuote);
1968 }
1969 }
1970<SkipDoubleQuote>{CPPC}[/]? { outputSpaces(yyscanner,yytext);
1971 yyextra->defText += yytext;
1972 yyextra->defLitText+=yytext;
1973 }
1974<SkipDoubleQuote>{CCS}[*]? { outputSpaces(yyscanner,yytext);
1975 yyextra->defText += yytext;
1976 yyextra->defLitText+=yytext;
1977 }
1978<SkipDoubleQuote>\" {
1980 yyextra->defText += *yytext;
1981 yyextra->defLitText+=yytext;
1982 BEGIN(DefineText);
1983 }
1984<SkipSingleQuote,SkipDoubleQuote>\\. {
1986 yyextra->defText += yytext;
1987 yyextra->defLitText+=yytext;
1988 }
1989<SkipSingleQuote>\' {
1991 yyextra->defText += *yytext;
1992 yyextra->defLitText+=yytext;
1993 BEGIN(DefineText);
1994 }
1995<SkipDoubleQuote,SkipSingleQuote>. { outputSpace(yyscanner,yytext[0]);
1996 yyextra->defText += *yytext;
1997 yyextra->defLitText += *yytext;
1998 }
1999<DefineText>. { outputSpace(yyscanner,yytext[0]);
2000 yyextra->defText += *yytext;
2001 yyextra->defLitText += *yytext;
2002 }
2003<<EOF>> {
2004 TRACE(
"End of include file");
2005
2006 if (yyextra->includeStack.empty())
2007 {
2008 TRACE(
"Terminating scanner");
2010 }
2011 else
2012 {
2013 QCString toFileName = yyextra->fileName;
2014 const std::unique_ptr<FileState> &fs=yyextra->includeStack.back();
2015
2016 YY_BUFFER_STATE oldBuf = YY_CURRENT_BUFFER;
2017 yy_switch_to_buffer( fs->bufState, yyscanner );
2018 yy_delete_buffer( oldBuf, yyscanner );
2019 yyextra->yyLineNr = fs->lineNr;
2020
2021 yyextra->inputBuf = fs->oldFileBuf;
2022 yyextra->inputBufPos = fs->oldFileBufPos;
2023 yyextra->curlyCount = fs->curlyCount;
2025 TRACE(
"switching to {}",yyextra->fileName);
2026
2027
2028
2030 lineStr.sprintf(
"# %d \"%s\" 2",yyextra->yyLineNr,
qPrint(yyextra->fileName));
2032
2033 yyextra->includeStack.pop_back();
2034
2035 {
2037
2038
2039
2040
2042 {
2043
2046 }
2047 else
2048 {
2050 {
2052 }
2053 }
2054 }
2055
2056 for (const auto &kv : yyextra->localDefines)
2057 {
2058 auto pair = yyextra->contextDefines.insert(kv);
2059 if (!pair.second)
2060 {
2061 yyextra->contextDefines.erase(pair.first);
2062 yyextra->contextDefines.insert(kv);
2063 }
2064 }
2065 yyextra->localDefines.clear();
2066 }
2067 }
2068<*>{CCS}/{CCE} |
2069<*>{CCS}[*!]? {
2070 if (YY_START==SkipVerbatim || YY_START == SkipCondVerbatim || YY_START==SkipCond || YY_START==IDLquote || YY_START == PragmaOnce)
2071 {
2072 REJECT;
2073 }
2074 else
2075 {
2077 yyextra->lastCContext=YY_START;
2078 yyextra->commentCount=1;
2079 if (yyleng==3)
2080 {
2081 yyextra->isSpecialComment = true;
2082 yyextra->lastGuardName.clear();
2083 }
2084 else
2085 {
2086 yyextra->isSpecialComment = false;
2087 }
2088 BEGIN(SkipCComment);
2089 }
2090 }
2091<*>{CPPC}[/!]? {
2093 {
2094 REJECT;
2095 }
2096 else if (YY_START==RulesRoundDouble)
2097 {
2098 REJECT;
2099 }
2100 else
2101 {
2103 yyextra->lastCPPContext=YY_START;
2104 if (yyleng==3)
2105 {
2106 yyextra->isSpecialComment = true;
2107 yyextra->lastGuardName.clear();
2108 }
2109 else
2110 {
2111 yyextra->isSpecialComment = false;
2112 }
2113 BEGIN(SkipCPPComment);
2114 }
2115 }
2116<*>\n {
2118 yyextra->yyLineNr++;
2119 }
2120<*>. {
2121 yyextra->expectGuard =
FALSE;
2123 }
2124
2125%%