13%option never-interactive
16%option extra-type="struct preYY_state *"
20#define YY_TYPEDEF_YY_SCANNER_T
66#define YY_NO_UNISTD_H 1
107typedef std::map< std::string, Define >
DefineMap;
130 for (
auto &[name,define] : fromMap)
148 if (dpf && includeStack.find(incFile)==includeStack.end())
150 includeStack.insert(incFile);
157 toMap.emplace(name,define);
171 void addInclude(
const std::string &fromFileName,
const std::string &toFileName)
177 it =
m_fileMap.emplace(fromFileName,std::make_unique<DefinesPerFile>(
this)).first;
179 auto &dpf = it->second;
180 dpf->addInclude(toFileName);
189 it =
m_fileMap.emplace(fileName,std::make_unique<DefinesPerFile>(
this)).first;
191 it->second->store(fromMap);
199 auto &dpf = it->second;
200 dpf->retrieve(toMap);
210 return it->second->stored();
220 return it!=
m_fileMap.end() ? it->second.get() :
nullptr;
223 std::unordered_map< std::string, std::unique_ptr<DefinesPerFile> >
m_fileMap;
342static yy_size_t
getFenceSize(
char *txt, yy_size_t leng);
347#define YY_INPUT(buf,result,max_size) result=yyread(yyscanner,buf,max_size);
350static inline const char *
getLexerFILE() {
return __FILE__;}
constant expression parser used for the C preprocessor
A class representing a macro definition.
Local class used to hold the defines for a single file.
void addInclude(const std::string &fileName)
DefinesPerFile(DefineManager *parent)
Creates an empty container for defines.
void retrieveRec(DefineMap &toMap, StringUnorderedSet &includeStack)
void store(const DefineMap &fromMap)
StringUnorderedSet m_includedFiles
void retrieve(DefineMap &toMap)
Class that manages the defines available while preprocessing files.
bool alreadyProcessed(const std::string &fileName) const
void addInclude(const std::string &fromFileName, const std::string &toFileName)
friend class DefinesPerFile
void store(const std::string &fileName, const DefineMap &fromMap)
std::unordered_map< std::string, std::unique_ptr< DefinesPerFile > > m_fileMap
void retrieve(const std::string &fileName, DefineMap &toMap)
DefinesPerFile * find(const std::string &fileName) const
Helper function to return the DefinesPerFile object for a given file name.
A model of a file symbol.
Container class representing a vector of objects with keys.
This is an alternative implementation of QCString.
static int yyread(yyscan_t yyscanner, char *buf, int max_size)
static const char * stateToString(int state)
static const char * getLexerFILE()
std::stack< bool > BoolStack
std::unordered_set< std::string > StringUnorderedSet
std::vector< std::string > StringVector
std::map< std::string, int > IntMap
std::vector< Define > DefineList
List of all macro definitions.
constexpr DocNodeVariant * parent(DocNodeVariant *n)
returns the parent node of a given node n or nullptr if the node has no parent.
Portable versions of functions that are platform dependent.
std::map< std::string, Define > DefineMap
A dictionary of managed Define objects.
static void setCaseDone(yyscan_t yyscanner, bool value)
static void addMacroDefinition(yyscan_t yyscanner)
static void decrLevel(yyscan_t yyscanner)
static void addDefine(yyscan_t yyscanner)
static void determineBlockName(yyscan_t yyscanner)
static void incrLevel(yyscan_t yyscanner)
static QCString expandMacro(yyscan_t yyscanner, const QCString &name)
static void outputSpaces(yyscan_t yyscanner, char *s)
static Define * isDefined(yyscan_t yyscanner, const QCString &name)
Returns a reference to a Define object given its name or 0 if the Define does not exist.
static void outputString(yyscan_t yyscanner, const QCString &s)
static void setFileName(yyscan_t yyscanner, const QCString &name)
static std::mutex g_globalDefineMutex
static void outputChar(yyscan_t yyscanner, char c)
static QCString extractTrailingComment(const QCString &s)
static char resolveTrigraph(char c)
static DefineManager g_defineManager
static yy_size_t getFenceSize(char *txt, yy_size_t leng)
static std::mutex g_updateGlobals
static bool otherCaseDone(yyscan_t yyscanner)
static void outputArray(yyscan_t yyscanner, const char *a, yy_size_t len)
static void extraSpacing(yyscan_t yyscanner)
static QCString escapeAt(const QCString &text)
static bool computeExpression(yyscan_t yyscanner, const QCString &expr)
static void outputSpace(yyscan_t yyscanner, char c)
static std::mutex g_debugMutex
Some helper functions for std::string.
const std::string * oldFileBuf
PreIncludeInfo(const QCString &fn, FileDef *srcFd, FileDef *dstFd, const QCString &iName, bool loc, bool imp)
preYY_CondCtx(const QCString &file, int line, const QCString &id, bool b)
StringUnorderedSet expanded
LinkedMap< PreIncludeInfo > includeRelations
StringUnorderedSet pragmaSet
ConstExpressionParser constExpParser
std::unordered_map< std::string, Define * > expandedDict
std::deque< std::unique_ptr< FileState > > includeStack
std::stack< std::unique_ptr< preYY_CondCtx > > condStack
const std::string * inputBuf
DefineList macroDefinitions
A bunch of utility functions.
357IDSTART [a-z_A-Z\x80-\xFF]
358ID {IDSTART}[a-z_A-Z0-9\x80-\xFF]*
362RAWBEGIN (u|U|L|u8)?R\"[^ \t\(\)\\]{0,16}"("
363RAWEND ")"[^ \t\(\)\\]{0,16}\"
364CHARLIT (("'"\\[0-7]{1,3}"'")|("'"\\."'")|("'"[^'\\\n]{1,4}"'"))
367FORMULA_START {CMD}("f{"|"f$"|"f["|"f(")
368FORMULA_END {CMD}("f}"|"f$"|"f]"|"f)")
369VERBATIM_START {CMD}("verbatim"|"iliteral"|"latexonly"|"htmlonly"|"xmlonly"|"docbookonly"|"rtfonly"|"manonly"|"dot"|"msc"|"startuml"|"code"("{"[^}]*"}")?){BN}+
370VERBATIM_END {CMD}("endverbatim"|"endiliteral"|"endlatexonly"|"endhtmlonly"|"endxmlonly"|"enddocbookonly"|"endrtfonly"|"endmanonly"|"enddot"|"endmsc"|"enduml"|"endcode")
371VERBATIM_LINE {CMD}"noop"{B}+
372LITERAL_BLOCK {FORMULA_START}|{VERBATIM_START}
373LITERAL_BLOCK_END {FORMULA_END}|{VERBATIM_END}
378RulesSharp "<"[^>\n]*">"
379RulesCurly "{"[^{}\n]*"}"
384EscapeRulesCharOpen "\\["|"\<"|"\\{"|"\\("|"\\\""|"\\ "|"\\\\"
385EscapeRulesCharClose "\\]"|"\>"|"\\}"|"\\)"
386EscapeRulesChar {EscapeRulesCharOpen}|{EscapeRulesCharClose}
402DECIMAL_INTEGER [1-9][0-9']*[0-9]?[uU]?[lL]?[lL]?
403HEXADECIMAL_INTEGER "0"[xX][0-9a-zA-Z']+[0-9a-zA-Z]?
404OCTAL_INTEGER "0"[0-7][0-7']+[0-7]?
405BINARY_INTEGER "0"[bB][01][01']*[01]?
406INTEGER_NUMBER {DECIMAL_INTEGER}|{HEXADECIMAL_INTEGER}|{OCTAL_INTEGER}|{BINARY_INTEGER}
410DIGIT_SEQ [0-9][0-9']*[0-9]?
411FRAC_CONST {DIGIT_SEQ}"."|{DIGIT_SEQ}?"."{DIGIT_SEQ}
412FP_EXP [eE][+-]?{DIGIT_SEQ}
413DEC_FP1 {FRAC_CONST}{FP_EXP}?{FP_SUF}?
414DEC_FP2 {DIGIT_SEQ}{FP_EXP}{FP_SUF}
416HEX_DIGIT_SEQ [0-9a-fA-F][0-9a-fA-F']*[0-9a-fA-F]?
417HEX_FRAC_CONST {HEX_DIGIT_SEQ}"."|{HEX_DIGIT_SEQ}?"."{HEX_DIGIT_SEQ}
418BIN_EXP [pP][+-]?{DIGIT_SEQ}
419HEX_FP1 "0"[xX]{HEX_FRAC_CONST}{BIN_EXP}{FP_SUF}?
420HEX_FP2 "0"[xX]{HEX_DIGIT_SEQ}{BIN_EXP}{FP_SUF}?
422FLOAT_DECIMAL {DEC_FP1}|{DEC_FP2}
423FLOAT_HEXADECIMAL {HEX_FP1}|{HEX_FP2}
424FLOAT_NUMBER {FLOAT_DECIMAL}|{FLOAT_HEXADECIMAL}
425NUMBER {INTEGER_NUMBER}|{FLOAT_NUMBER}
441%x CopyStringFtnDouble
458%x JavaDocVerbatimCode
492 yyextra->yyColNr+=(int)yyleng;
494 yyextra->potentialDefine=yytext;
497<Start>^("%top{"|"%{") {
SrcLangExt getLanguageFromFileName(const QCString &fileName, SrcLangExt defLang)
502<Start>^{Bopt}"cpp_quote"{Bopt}"("{Bopt}\" {
503 if (yyextra->insideIDL)
518<IDLquote>"\""{Bopt}")" {
532<Start>^{B}*[a-z_A-Z\x80-\xFF][a-z_A-Z0-9\x80-\xFF]+{B}*"("[^\)\n]*")"/{BN}{1,10}*[:{] {
534 for (i=(
int)yyleng-1;i>=0;i--)
540<Start>^{B}*[_A-Z][_A-Z0-9]+{B}*"("[^\(\)\n]*"("[^\)\n]*")"[^\)\n]*")"{B}*\n |
541<Start>^{B}*[_A-Z][_A-Z0-9]+{B}*"("[^\)\n]*")"{B}*\n |
542<Start>^{B}*[_A-Z][_A-Z0-9]+{B}*"("[^\(\)\n]*"("[^\)\n]*")"[^\)\n]*")"/{B}*("//"|"/\*") |
543<Start>^{B}*[_A-Z][_A-Z0-9]+{B}*"("[^\)\n]*")"/{B}*("//"|"/\*") {
546 int pos = name.find(
'(');
548 name=name.left(pos).stripWhiteSpace();
551 if (skipFuncMacros && !yyextra->insideFtn &&
552 name!=
"Q_PROPERTY" &&
554 (yyextra->includeStack.empty() || yyextra->curlyCount>0) &&
555 yyextra->macroExpansion &&
563 if (yytext[yyleng-1] ==
'\n')
572 for (i=(
int)yyleng-1;i>=0;i--)
#define Config_getBool(name)
579<CopyLine,LexCopyLine>"extern"{BN}*"\""[^\"]+"\""{BN}*("{")? {
581 yyextra->yyLineNr+=text.
contains(
'\n');
int contains(char c, bool cs=TRUE) const
584<CopyLine,LexCopyLine>{RAWBEGIN} {
587 BEGIN(CopyRawString);
QCString extractBeginRawStringDelimiter(const char *rawStart)
589<CopyLine,LexCopyLine>"{" {
590 if (yyextra->includeStack.empty())
592 yyextra->curlyCount++;
599<CopyLine,LexCopyLine>"}" {
600 if (yyextra->includeStack.empty() && yyextra->curlyCount>0)
602 yyextra->curlyCount--;
606<CopyLine,LexCopyLine>"'"\\[0-7]{1,3}"'" {
609<CopyLine,LexCopyLine>"'"\\."'" {
612<CopyLine,LexCopyLine>"'"."'" {
615<CopyLine,LexCopyLine>[$]?@\" {
618 BEGIN( CopyStringCs );
620<CopyLine,LexCopyLine>\" {
628 BEGIN( CopyStringFtnDouble );
631<CopyLine,LexCopyLine>\' {
634 BEGIN( CopyStringFtn );
636<CopyString>[^\"\\\r\n]{1,1000} {
639<CopyStringCs>[^\"\r\n]{1,1000} {
648<CopyString,CopyStringCs>\" {
652<CopyStringFtnDouble>[^\"\\\r\n]{1,1000} {
655<CopyStringFtnDouble>\\. {
658<CopyStringFtnDouble>\" {
662<CopyStringFtn>[^\'\\\r\n]{1,1000} {
672<CopyRawString>{RAWEND} {
QCString extractEndRawStringDelimiter(const char *rawEnd)
679<CopyRawString>[^)]{1,1000} {
685<CopyLine,LexCopyLine>{ID}/{BN}{0,80}"(" {
686 yyextra->expectGuard =
FALSE;
696 if ((yyextra->includeStack.empty() || yyextra->curlyCount>0) &&
697 yyextra->macroExpansion &&
703 yyextra->roundCount=0;
704 yyextra->defArgsStr=yytext;
714 yyextra->findDefArgContext = CopyLine;
715 BEGIN(FindDefineArgs);
723<CopyLine>{RulesDelim} {
725 yyextra->lexRulesPart = !yyextra->lexRulesPart;
729<CopyLine>{RulesSharp} {
730 if (!yyextra->lexRulesPart) REJECT;
731 if (yyextra->curlyCount) REJECT;
735<RulesPattern>{EscapeRulesChar} {
738<RulesPattern>{RulesCurly} {
741<RulesPattern>{StartDouble} {
743 yyextra->lastContext = YY_START;
746<RulesDouble,RulesRoundDouble>"\\\\" {
749<RulesDouble,RulesRoundDouble>"\\\"" {
754 BEGIN( yyextra->lastContext ) ;
756<RulesRoundDouble>"\"" {
760<RulesDouble,RulesRoundDouble>. {
763<RulesPattern>{StartSquare} {
765 yyextra->lastContext = YY_START;
768<RulesSquare,RulesRoundSquare>{CHARCE} {
771<RulesSquare,RulesRoundSquare>"\\[" |
772<RulesSquare,RulesRoundSquare>"\\]" {
779<RulesRoundSquare>"]" {
783<RulesSquare,RulesRoundSquare>"\\\\" {
786<RulesSquare,RulesRoundSquare>. {
789<RulesPattern>{StartRoundQuest} {
791 yyextra->lastContext = YY_START;
792 BEGIN(RulesRoundQuest);
794<RulesRoundQuest>{nl} {
797<RulesRoundQuest>[^)] {
800<RulesRoundQuest>")" {
802 BEGIN(yyextra->lastContext);
804<RulesPattern>{StartRound} {
805 yyextra->roundCount++;
807 yyextra->lastContext = YY_START;
810<RulesRound>{RulesCurly} {
813<RulesRound>{StartSquare} {
815 BEGIN(RulesRoundSquare);
817<RulesRound>{StartDouble} {
819 BEGIN(RulesRoundDouble);
821<RulesRound>{EscapeRulesChar} {
825 yyextra->roundCount++;
829 yyextra->roundCount--;
831 if (!yyextra->roundCount) BEGIN( yyextra->lastContext ) ;
850<CopyLine,LexCopyLine>{ID} {
852 if ((yyextra->includeStack.empty() || yyextra->curlyCount>0) &&
853 yyextra->macroExpansion &&
869<CopyLine,LexCopyLine>"\\"\r?/\n {
872<CopyLine,LexCopyLine>\\. {
875<CopyLine,LexCopyLine>. {
878<CopyLine,LexCopyLine>\n {
885 yyextra->defArgsStr+=
'(';
886 yyextra->roundCount++;
889 yyextra->defArgsStr+=
')';
890 yyextra->roundCount--;
891 if (yyextra->roundCount==0)
895 if (yyextra->findDefArgContext==CopyLine)
898 BEGIN(yyextra->findDefArgContext);
903 yyextra->nospaces=
FALSE;
913<FindDefineArgs>{CHARLIT} {
914 yyextra->defArgsStr+=yytext;
916<FindDefineArgs>{CCS}[*!]? {
917 yyextra->defArgsStr+=yytext;
918 BEGIN(ArgCopyCComment);
920<FindDefineArgs>{CPPC}[/!].*\n/{B}*{CPPC}[/!] {
925 yyextra->defArgsStr+=
QCString(
"/**< @brief ")+&yytext[4];
929 yyextra->defArgsStr+=
QCString(
"/** @brief ")+&yytext[3];
934 yyextra->defArgsStr+=
QCString(
"/**")+&yytext[3];
936 BEGIN(ArgCopyCppComment);
938<FindDefineArgs>{CPPC}[/!].*\n {
941 yyextra->defArgsStr+=
QCString(
"/**")+&yytext[3]+
" */";
947 yyextra->defArgsStr+=
QCString(
"/**< @brief ")+&yytext[4]+
" */";
951 yyextra->defArgsStr+=
QCString(
"/** @brief ")+&yytext[3]+
" */";
955<FindDefineArgs>{CPPC}.*\n {
956 yyextra->defArgsStr+=
QCString(
"/*")+&yytext[2]+
" */";
959 yyextra->defArgsStr+=*yytext;
964 yyextra->defArgsStr+=*yytext;
968 yyextra->defArgsStr+=
' ';
973 yyextra->defArgsStr+=
"@@";
976 yyextra->defArgsStr+=*yytext;
978<ArgCopyCComment>[^*\n]+ {
979 yyextra->defArgsStr+=yytext;
981<ArgCopyCComment>{CCE} {
982 yyextra->defArgsStr+=yytext;
983 BEGIN(FindDefineArgs);
986 yyextra->defArgsStr+=yytext;
990 yyextra->defArgsStr+=yytext;
992<ArgCopyCppComment>^{B}*
993<ArgCopyCppComment>{CPPC}[/!].*\n/{B}*{CPPC}[/!] {
994 const char *startContent = &yytext[3];
995 if (startContent[0]==
'<') startContent++;
996 yyextra->defArgsStr+=startContent;
998<ArgCopyCppComment>{CPPC}[/!].*\n {
999 const char *startContent = &yytext[3];
1000 if (startContent[0]==
'<') startContent++;
1001 yyextra->defArgsStr+=
QCString(startContent)+
" */";
1002 BEGIN(FindDefineArgs);
1004<ArgCopyCppComment>. {
1006 yyextra->defArgsStr+=
" */";
1007 BEGIN(FindDefineArgs);
1010 yyextra->defArgsStr+=*yytext;
1011 BEGIN(FindDefineArgs);
1015 yyextra->defArgsStr+=*yytext;
1016 BEGIN(FindDefineArgs);
1019<ReadString>{CPPC}|{CCS} {
1020 yyextra->defArgsStr+=yytext;
1022<ReadString>\\/\r?\n {
1025 yyextra->defArgsStr+=yytext;
1028 yyextra->defArgsStr+=*yytext;
1030<Command>("include"|"import"){B}+/{ID} {
1031 yyextra->isImported = yytext[1]==
'm';
1032 if (yyextra->macroExpansion)
1035<Command>("include"|"import"){B}*[<"] {
1036 yyextra->isImported = yytext[1]==
'm';
1038 c[0]=yytext[yyleng-1];c[1]=
'\0';
1042<Command>("cmake")?"define"{B}+ {
1043 yyextra->potentialDefine +=
substitute(yytext,
"cmake",
" ");
1045 yyextra->yyColNr+=(int)yyleng;
QCString substitute(const QCString &s, const QCString &src, const QCString &dst)
substitute all occurrences of src in s by dst
1048<Command>"cmakedefine01"{B}+ {
1049 yyextra->potentialDefine +=
substitute(yytext,
"cmakedefine01",
" define ");
1051 yyextra->yyColNr+=(int)yyleng;
1052 BEGIN(CmakeDefName01);
1054<Command>"ifdef"/{B}*"(" {
1056 yyextra->guardExpr.clear();
1057 BEGIN(DefinedExpr2);
1059<Command>"ifdef"/{B}+ {
1062 yyextra->guardExpr.clear();
1063 BEGIN(DefinedExpr1);
1065<Command>"ifndef"/{B}*"(" {
1067 yyextra->guardExpr=
"! ";
1068 BEGIN(DefinedExpr2);
1070<Command>"ifndef"/{B}+ {
1072 yyextra->guardExpr=
"! ";
1073 BEGIN(DefinedExpr1);
1075<Command>"if"/[ \t(!] {
1077 yyextra->guardExpr.clear();
1080<Command>("elif"|"else"{B}*"if")/[ \t(!] {
1083 yyextra->guardExpr.clear();
1089 BEGIN(SkipCPPBlock);
1092<Command>"else"/[^a-z_A-Z0-9\x80-\xFF] {
1096 BEGIN(SkipCPPBlock);
1103<Command>"undef"{B}+ {
1106<Command>("elif"|"else"{B}*"if")/[ \t(!] {
1109 yyextra->guardExpr.clear();
1113<Command>"endif"/[^a-z_A-Z0-9\x80-\xFF] {
1117<Command,IgnoreLine>\n {
1120 yyextra->yyLineNr++;
1122<Command>"pragma"{B}+"once" {
1123 yyextra->expectGuard =
FALSE;
1124 if (yyextra->pragmaSet.find(yyextra->fileName.str())!=yyextra->pragmaSet.end())
1131 yyextra->pragmaSet.insert(yyextra->fileName.data());
1136<PragmaOnce><<EOF>> {
1137 yyextra->expectGuard =
FALSE;
1143<IgnoreLine>\\[\r]?\n {
1145 yyextra->yyLineNr++;
1148<Command>. { yyextra->potentialDefine += yytext[0]==
'\t' ?
'\t' :
' ';
1149 yyextra->yyColNr+=(int)yyleng;
1165 yyextra->guardExpr+=
' ';
1166 yyextra->yyLineNr++;
1168<Guard>"defined"/{B}*"(" {
1169 BEGIN(DefinedExpr2);
1171<Guard>"defined"/{B}+ {
1172 BEGIN(DefinedExpr1);
1174<Guard>"true"/{B}|{B}*[\r]?\n { yyextra->guardExpr+=
"1L"; }
1175<Guard>"false"/{B}|{B}*[\r]?\n { yyextra->guardExpr+=
"0L"; }
1176<Guard>"not"/{B} { yyextra->guardExpr+=
'!'; }
1177<Guard>"not_eq"/{B} { yyextra->guardExpr+=
"!="; }
1178<Guard>"and"/{B} { yyextra->guardExpr+=
"&&"; }
1179<Guard>"or"/{B} { yyextra->guardExpr+=
"||"; }
1180<Guard>"bitand"/{B} { yyextra->guardExpr+=
"&"; }
1181<Guard>"bitor"/{B} { yyextra->guardExpr+=
"|"; }
1182<Guard>"xor"/{B} { yyextra->guardExpr+=
"^"; }
1183<Guard>"compl"/{B} { yyextra->guardExpr+=
"~"; }
1184<Guard>{ID} { yyextra->guardExpr+=yytext; }
1185<Guard>"@" { yyextra->guardExpr+=
"@@"; }
1186<Guard>. { yyextra->guardExpr+=*yytext; }
1200 BEGIN(SkipCPPBlock);
1203<DefinedExpr1,DefinedExpr2>\\\n { yyextra->yyLineNr++;
outputChar(yyscanner,
'\n'); }
1205 if (
isDefined(yyscanner,yytext) || yyextra->guardName==yytext)
1206 yyextra->guardExpr+=
" 1L ";
1208 yyextra->guardExpr+=
" 0L ";
1209 yyextra->lastGuardName=yytext;
1213 if (
isDefined(yyscanner,yytext) || yyextra->guardName==yytext)
1214 yyextra->guardExpr+=
" 1L ";
1216 yyextra->guardExpr+=
" 0L ";
1217 yyextra->lastGuardName=yytext;
1219<DefinedExpr1,DefinedExpr2>\n {
1220 yyextra->yyLineNr++;
1222 BEGIN(SkipCPPBlock);
1227<DefinedExpr1,DefinedExpr2>.
1228<SkipCPPBlock>^{B}*"#" { BEGIN(SkipCommand); }
1229<SkipCPPBlock>^{Bopt}/[^#] { BEGIN(SkipLine); }
1230<SkipCPPBlock>\n { yyextra->yyLineNr++;
outputChar(yyscanner,
'\n'); }
1232<SkipCommand>"if"(("n")?("def"))?/[ \t(!] {
1237<SkipCommand>"else" {
1246<SkipCommand>("elif"|"else"{B}*"if")/[ \t(!] {
1247 if (yyextra->ifcount==0)
1251 yyextra->guardExpr.clear();
1252 yyextra->lastGuardName.clear();
1257 BEGIN(SkipCPPBlock);
1261<SkipCommand>"endif" {
1262 yyextra->expectGuard =
FALSE;
1264 if (--yyextra->ifcount<0)
1272 yyextra->yyLineNr++;
1273 BEGIN(SkipCPPBlock);
1280<SkipLine>{CHARLIT} { }
1285<SkipString>{CPPC}/[^\n]* {
1287<SkipLine,SkipCommand,SkipCPPBlock>{CPPC}[^\n]* {
1288 yyextra->lastCPPContext=YY_START;
1289 BEGIN(RemoveCPPComment);
1291<SkipString>{CCS}/[^\n]* {
1293<SkipLine,SkipCommand,SkipCPPBlock>{CCS}/[^\n]* {
1294 yyextra->lastCContext=YY_START;
1295 BEGIN(RemoveCComment);
1299 yyextra->yyLineNr++;
1300 BEGIN(SkipCPPBlock);
1302<SkipString>[^"\\\n]+ { }
1308<IncludeID>{ID}{Bopt}/"(" {
1309 yyextra->nospaces=
TRUE;
1310 yyextra->roundCount=0;
1311 yyextra->defArgsStr=yytext;
1312 yyextra->findDefArgContext = IncludeID;
1313 BEGIN(FindDefineArgs);
1316 yyextra->nospaces=
TRUE;
1320<Include>[^\">\n]+[\">] {
1321 yyextra->incName+=yytext;
1322 if (yyextra->isImported)
1332<EndImport>{ENDIMPORTopt}/\n {
1336<EndImport>\\[\r]?"\n" {
1338 yyextra->yyLineNr++;
1342<DefName>{ID}/("\\\n")*"(" {
1344 yyextra->argMap.clear();
1345 yyextra->defArgs = 0;
1346 yyextra->defArgsStr.clear();
1347 yyextra->defText.clear();
1348 yyextra->defLitText.clear();
1349 yyextra->defName = yytext;
1350 yyextra->defVarArgs =
FALSE;
1351 yyextra->defExtraSpacing.clear();
1352 yyextra->defContinue =
false;
1355<DefName>{ID}{B}+"1"/[ \r\t\n] {
1357 yyextra->argMap.clear();
1358 yyextra->defArgs = -1;
1359 yyextra->defArgsStr.clear();
1361 yyextra->defVarArgs =
FALSE;
1364 if (yyextra->curlyCount>0 || yyextra->defName!=yyextra->lastGuardName || !yyextra->expectGuard)
1366 QCString def = yyextra->potentialDefine +
1369 outputSpaces(yyscanner,yytext+yyextra->defName.length());
1370 yyextra->quoteArg=
FALSE;
1371 yyextra->insideComment=
FALSE;
1372 yyextra->lastGuardName.clear();
1373 yyextra->defText=
"1";
1374 yyextra->defLitText=
"1";
1380 yyextra->defText.clear();
1381 yyextra->defLitText.clear();
1384 yyextra->expectGuard=
FALSE;
QCString stripWhiteSpace() const
returns a copy of this string with leading and trailing whitespace removed
QCString left(size_t len) const
1386<DefName,CmakeDefName01>{ID}/{B}*"\n" {
1387 yyextra->argMap.clear();
1388 yyextra->defArgs = -1;
1389 yyextra->defName = yytext;
1390 yyextra->defArgsStr.clear();
1391 yyextra->defText.clear();
1392 yyextra->defLitText.clear();
1393 yyextra->defVarArgs =
FALSE;
1396 if (yyextra->curlyCount>0 || yyextra->defName!=yyextra->lastGuardName || !yyextra->expectGuard)
1398 QCString def = yyextra->potentialDefine + yyextra->defName;
1400 yyextra->quoteArg=
FALSE;
1401 yyextra->insideComment=
FALSE;
1402 if (YY_START == CmakeDefName01) yyextra->defText =
"0";
1403 else if (yyextra->insideCS) yyextra->defText=
"1";
1409 yyextra->guardName = yytext;
1410 yyextra->lastGuardName.clear();
1413 yyextra->expectGuard=
FALSE;
1417 yyextra->argMap.clear();
1418 yyextra->defArgs = -1;
1419 yyextra->defArgsStr.clear();
1420 yyextra->defText.clear();
1421 yyextra->defLitText.clear();
1422 yyextra->defName = yytext;
1423 yyextra->defVarArgs =
FALSE;
1424 QCString def = yyextra->potentialDefine +
1426 yyextra->defArgsStr ;
1428 yyextra->quoteArg=
FALSE;
1429 yyextra->insideComment=
FALSE;
1433 yyextra->defExtraSpacing+=
"\n";
1434 yyextra->defContinue =
true;
1435 yyextra->yyLineNr++;
1437<DefineArg>{B}* { yyextra->defExtraSpacing+=yytext; }
1438<DefineArg>","{B}* { yyextra->defArgsStr+=yytext; }
1439<DefineArg>"("{B}* { yyextra->defArgsStr+=yytext; }
1440<DefineArg>{B}*")"{B}* {
1442 yyextra->defArgsStr+=yytext;
1443 QCString def = yyextra->potentialDefine +
1445 yyextra->defArgsStr +
1446 yyextra->defExtraSpacing ;
1448 yyextra->quoteArg=
FALSE;
1449 yyextra->insideComment=
FALSE;
1453 yyextra->defVarArgs =
TRUE;
1454 yyextra->defArgsStr+=yytext;
1455 yyextra->argMap.emplace(std::string(
"__VA_ARGS__"),yyextra->defArgs);
1458<DefineArg>{ID}{B}*("..."?) {
1461 yyextra->defVarArgs = yytext[yyleng-1]==
'.';
1462 if (yyextra->defVarArgs)
1467 yyextra->defArgsStr+=yytext;
1468 yyextra->argMap.emplace(
toStdString(argName),yyextra->defArgs);
size_t length() const
Returns the length of the string, not counting the 0-terminator.
std::string toStdString(const QCString &s)
1484<DefineText>{CCS}[!*]? {
1485 yyextra->defText+=yytext;
1486 yyextra->defLitText+=yytext;
1487 yyextra->lastCContext=YY_START;
1488 yyextra->commentCount=1;
1489 BEGIN(CopyCComment);
1491<DefineText>{CPPC}[!/]? {
1493 yyextra->lastCPPContext=YY_START;
1494 yyextra->defLitText+=
' ';
1495 BEGIN(SkipCPPComment);
1497<SkipCComment>[/]?{CCE} {
1498 if (yytext[0]==
'/')
outputChar(yyscanner,
'/');
1500 if (--yyextra->commentCount<=0)
1502 if (yyextra->lastCContext==Start)
1506 YY_CURRENT_BUFFER->yy_at_bol=1;
1508 BEGIN(yyextra->lastCContext);
1511<SkipCComment>{CPPC}("/")* {
1514<SkipCComment>{CCS} {
1518<SkipCond>{CMD}{CMD} { }
1519<SkipCond>^({B}*"*"+)?{B}{0,3}"~~~"[~]* {
1521 if (!markdownSupport || !yyextra->isSpecialComment)
1527 yyextra->fenceChar=
'~';
1529 BEGIN(SkipCondVerbatim);
1532<SkipCond>^({B}*"*"+)?{B}{0,3}"```"[`]* {
1534 if (!markdownSupport || !yyextra->isSpecialComment)
1540 yyextra->fenceChar=
'`';
1542 BEGIN(SkipCondVerbatim);
1545<SkipCComment>^({B}*"*"+)?{B}{0,3}"~~~"[~]* {
1547 if (!markdownSupport || !yyextra->isSpecialComment)
1554 yyextra->fenceChar=
'~';
1556 BEGIN(SkipVerbatim);
1559<SkipCComment>^({B}*"*"+)?{B}{0,3}"```"[`]* {
1561 if (!markdownSupport || !yyextra->isSpecialComment)
1568 yyextra->fenceChar=
'`';
1570 BEGIN(SkipVerbatim);
1573<SkipCComment>{CMD}{VERBATIM_LINE} |
1574<SkipCComment>{CMD}{LITERAL_BLOCK} {
1578<SkipCComment>{VERBATIM_LINE}.*/\n {
1581<SkipCComment>{LITERAL_BLOCK} {
1585 BEGIN(SkipVerbatim);
1587<SkipCond>{CMD}{CMD}"cond"[ \t]+ {}
1588<SkipCond>{CMD}"cond"/\n |
1589<SkipCond>{CMD}"cond"[ \t]+ {
1593<SkipCComment>"{"[ \t]*"@code"/[ \t\n] {
1595 yyextra->javaBlock=1;
1596 BEGIN(JavaDocVerbatimCode);
1598<SkipCComment>"{"[ \t]*"@literal"/[ \t\n] {
1600 yyextra->javaBlock=1;
1601 BEGIN(JavaDocVerbatimCode);
1603<SkipCComment,SkipCPPComment>{CMD}{CMD}"cond"[ \t\n]+ {
1606<SkipCPPComment>{CMD}"cond"[ \t]+ {
1607 yyextra->ccomment=
TRUE;
1608 yyextra->condCtx=YY_START;
1611<SkipCComment>{CMD}"cond"[ \t]+ {
1612 yyextra->ccomment=
FALSE;
1613 yyextra->condCtx=YY_START;
1616<CondLineC,CondLineCpp>[!()&| \ta-z_A-Z0-9\x80-\xFF.\-]+ {
1620 if (YY_START==CondLineC)
1624 yyextra->ccomment=
TRUE;
1628 yyextra->ccomment=
FALSE;
1634 BEGIN(yyextra->condCtx);
1637<CondLineC,CondLineCpp>. {
1642 if (YY_START==CondLineC)
1646 yyextra->ccomment=
TRUE;
1650 yyextra->ccomment=
FALSE;
1656 BEGIN(yyextra->condCtx);
1659<SkipCComment,SkipCPPComment>{CMD}"cond"{WSopt}/\n {
1660 if (YY_START==SkipCComment)
1662 yyextra->ccomment=
TRUE;
1668 yyextra->ccomment=
FALSE;
1670 yyextra->condCtx=YY_START;
1674<SkipCond>\n { yyextra->yyLineNr++;
outputChar(yyscanner,
'\n'); }
1675<SkipCond>{VERBATIM_LINE}.*/\n { }
1676<SkipCond>{LITERAL_BLOCK} {
1678 yyextra->yyLineNr+=numNLs;
1679 for (
int i = 0; i < numNLs; i++)
outputChar(yyscanner,
'\n');
1681 BEGIN(SkipCondVerbatim);
1685<SkipCond>[^\/\!*\\@\n]+ { }
1686<SkipCond>{CPPC}[/!] { yyextra->ccomment=
FALSE; }
1687<SkipCond>{CCS}[*!] { yyextra->ccomment=
TRUE; }
1688<SkipCond,SkipCComment,SkipCPPComment>{CMD}{CMD}"endcond"/[^a-z_A-Z0-9\x80-\xFF] {
1694<SkipCond>{CMD}"endcond"/[^a-z_A-Z0-9\x80-\xFF] {
1695 bool oldSkip = yyextra->skip;
1697 if (oldSkip && !yyextra->skip)
1699 if (yyextra->ccomment)
1703 BEGIN(yyextra->condCtx);
1706<SkipCComment,SkipCPPComment>{CMD}"endcond"/[^a-z_A-Z0-9\x80-\xFF] {
1707 bool oldSkip = yyextra->skip;
1709 if (oldSkip && !yyextra->skip)
1711 BEGIN(yyextra->condCtx);
1714<SkipCondVerbatim>{LITERAL_BLOCK_END} {
1715 if (yytext[1]==
'f' && yyextra->blockName==&yytext[2])
1719 else if (&yytext[4]==yyextra->blockName)
1724<SkipVerbatim>{LITERAL_BLOCK_END} {
1726 if (yytext[1]==
'f' && yyextra->blockName==&yytext[2])
1728 BEGIN(SkipCComment);
1730 else if (&yytext[4]==yyextra->blockName)
1732 BEGIN(SkipCComment);
1735<SkipCondVerbatim>^({B}*"*"+)?{B}{0,3}"~~~"[~]* {
1736 if (yyextra->fenceSize==
getFenceSize(yytext,yyleng) && yyextra->fenceChar==
'~')
1741<SkipCondVerbatim>^({B}*"*"+)?{B}{0,3}"```"[`]* {
1742 if (yyextra->fenceSize==
getFenceSize(yytext,yyleng) && yyextra->fenceChar==
'`')
1747<SkipVerbatim>^({B}*"*"+)?{B}{0,3}"~~~"[~]* {
1749 if (yyextra->fenceSize==
getFenceSize(yytext,yyleng) && yyextra->fenceChar==
'~')
1751 BEGIN(SkipCComment);
1754<SkipVerbatim>^({B}*"*"+)?{B}{0,3}"```"[`]* {
1756 if (yyextra->fenceSize==
getFenceSize(yytext,yyleng) && yyextra->fenceChar==
'`')
1758 BEGIN(SkipCComment);
1761<SkipCondVerbatim>{CCE}|{CCS} { }
1762<SkipVerbatim>{CCE}|{CCS} {
1765<JavaDocVerbatimCode>"{" {
1766 if (yyextra->javaBlock==0)
1772 yyextra->javaBlock++;
1776<JavaDocVerbatimCode>"}" {
1777 if (yyextra->javaBlock==0)
1783 yyextra->javaBlock--;
1784 if (yyextra->javaBlock==0)
1787 BEGIN(SkipCComment);
1795<JavaDocVerbatimCode>\n {
1798<JavaDocVerbatimCode>. {
1801<SkipCondVerbatim>[^{*\\@\x06~`\n\/]+ { }
1802<SkipCComment,SkipVerbatim>[^{*\\@\x06~`\n\/]+ {
1805<SkipCComment,SkipVerbatim,SkipCondVerbatim>\n {
1806 yyextra->yyLineNr++;
1809<SkipCondVerbatim>. { }
1810<SkipCComment,SkipVerbatim>. {
1813<CopyCComment>[^*a-z_A-Z\x80-\xFF\n]*[^*a-z_A-Z\x80-\xFF\\\n] {
1814 yyextra->defLitText+=yytext;
1815 yyextra->defText+=
escapeAt(yytext);
1817<CopyCComment>\\[\r]?\n {
1818 yyextra->defLitText+=yytext;
1819 yyextra->defText+=
" ";
1820 yyextra->yyLineNr++;
1821 yyextra->yyMLines++;
1823<CopyCComment>{CCE} {
1824 yyextra->defLitText+=yytext;
1825 yyextra->defText+=yytext;
1826 BEGIN(yyextra->lastCContext);
1829 yyextra->yyLineNr++;
1830 yyextra->defLitText+=yytext;
1831 yyextra->defText+=
' ';
1833<RemoveCComment>{CCE}{B}*"#" {
1834 if (yyextra->lastCContext==SkipCPPBlock)
1843<RemoveCComment>{CCE} { BEGIN(yyextra->lastCContext); }
1844<RemoveCComment>{CPPC}
1845<RemoveCComment>{CCS}
1846<RemoveCComment>[^*\x06\n]+
1847<RemoveCComment>\n { yyextra->yyLineNr++;
outputChar(yyscanner,
'\n'); }
1849<SkipCPPComment>[^\n\/\\@]+ {
1852<SkipCPPComment,RemoveCPPComment>\n {
1854 BEGIN(yyextra->lastCPPContext);
1856<SkipCPPComment>{CCS} {
1859<SkipCPPComment>{CPPC} {
1862<SkipCPPComment>[^\x06\@\\\n]+ {
1868<RemoveCPPComment>{CCS}
1869<RemoveCPPComment>{CPPC}
1870<RemoveCPPComment>[^\x06\n]+
1872<DefineText>"__VA_OPT__("{B}*"##" {
1873 warn(yyextra->fileName,yyextra->yyLineNr,
1874 "'##' may not appear at the beginning of a __VA_OPT__()",
1875 yyextra->defName,yyextra->defLitText.stripWhiteSpace());
1876 yyextra->defText+=
"__VA_OPT__(";
1877 yyextra->defLitText+=
"__VA_OPT__(";
#define warn(file, line, fmt,...)
1879<DefineText>"#"/"__VA_OPT__" {
1880 yyextra->defText+=yytext;
1881 yyextra->defLitText+=yytext;
1883<DefineText>"#"/{IDSTART} {
1885 yyextra->quoteArg=
TRUE;
1886 yyextra->idStart=
true;
1887 yyextra->defLitText+=yytext;
1889<DefineText,CopyCComment>{ID} {
1890 yyextra->defLitText+=yytext;
1891 if (YY_START == DefineText)
outputSpaces(yyscanner,yytext);
1892 if (yyextra->quoteArg)
1894 yyextra->defText+=
"\"";
1896 if (yyextra->defArgs>0)
1898 auto it = yyextra->argMap.find(yytext);
1899 if (it!=yyextra->argMap.end())
1902 yyextra->defText+=
'@';
1907 if (yyextra->idStart)
1909 warn(yyextra->fileName,yyextra->yyLineNr,
1910 "'#' is not followed by a macro parameter '{}': '{}'",
1911 yyextra->defName,yyextra->defLitText.stripWhiteSpace());
1913 yyextra->defText+=yytext;
1918 yyextra->defText+=yytext;
1920 if (yyextra->quoteArg)
1922 yyextra->defText+=
"\"";
1924 yyextra->quoteArg=
FALSE;
1925 yyextra->idStart=
false;
QCString & setNum(short n)
1928 yyextra->defLitText+=yytext;
1929 yyextra->defText+=yytext;
1931<DefineText>\\[\r]?\n {
1932 yyextra->defLitText+=yytext;
1935 yyextra->defText +=
' ';
1936 yyextra->yyLineNr++;
1937 yyextra->yyMLines++;
1941 yyextra->defText = yyextra->defText.stripWhiteSpace();
1942 if (yyextra->defText.startsWith(
"##"))
1944 warn(yyextra->fileName,yyextra->yyLineNr,
1945 "'##' cannot occur at the beginning of a macro definition '{}': '{}'",
1946 yyextra->defName,yyextra->defLitText.stripWhiteSpace());
1948 else if (yyextra->defText.endsWith(
"##"))
1950 warn(yyextra->fileName,yyextra->yyLineNr,
1951 "'##' cannot occur at the end of a macro definition '{}': '{}'",
1952 yyextra->defName,yyextra->defLitText.stripWhiteSpace());
1954 else if (yyextra->defText.endsWith(
"#"))
1956 warn(yyextra->fileName,yyextra->yyLineNr,
1957 "expected formal parameter after # in macro definition '{}': '{}'",
1958 yyextra->defName,yyextra->defLitText.stripWhiteSpace());
1963 yyextra->defLitText=yyextra->defLitText.left(yyextra->defLitText.length()-
comment.length()-1);
1966 yyextra->defLitText+=yytext;
1969 if (yyextra->includeStack.empty() || yyextra->curlyCount>0)
1973 def=
isDefined(yyscanner,yyextra->defName);
1987 def->
name = yyextra->defName;
1989 def->
nargs = yyextra->defArgs;
1991 def->
lineNr = yyextra->yyLineNr-yyextra->yyMLines;
1996 if (def->
fileName != yyextra->fileName && !yyextra->expandOnlyPredef)
addDefine(yyscanner);
2000 yyextra->argMap.clear();
2001 yyextra->yyLineNr++;
2003 yyextra->lastGuardName.clear();
2007 yyextra->defText +=
' ';
2008 yyextra->defLitText+=yytext;
2011 yyextra->defText +=
"##";
2012 yyextra->defLitText+=yytext;
2015 yyextra->defText +=
"@@";
2016 yyextra->defLitText+=yytext;
2020 yyextra->defText += *yytext;
2021 yyextra->defLitText+=yytext;
2022 if (!yyextra->insideComment)
2024 BEGIN(SkipDoubleQuote);
2027<DefineText>{NUMBER} {
2029 yyextra->defText += yytext;
2030 yyextra->defLitText+=yytext;
2034 yyextra->defText += *yytext;
2035 yyextra->defLitText+=yytext;
2036 if (!yyextra->insideComment)
2038 BEGIN(SkipSingleQuote);
2041<SkipDoubleQuote>{CPPC}[/]? {
outputSpaces(yyscanner,yytext);
2042 yyextra->defText += yytext;
2043 yyextra->defLitText+=yytext;
2045<SkipDoubleQuote>{CCS}[*]? {
outputSpaces(yyscanner,yytext);
2046 yyextra->defText += yytext;
2047 yyextra->defLitText+=yytext;
2049<SkipDoubleQuote>\" {
2051 yyextra->defText += *yytext;
2052 yyextra->defLitText+=yytext;
2055<SkipSingleQuote,SkipDoubleQuote>\\. {
2057 yyextra->defText += yytext;
2058 yyextra->defLitText+=yytext;
2060<SkipSingleQuote>\' {
2062 yyextra->defText += *yytext;
2063 yyextra->defLitText+=yytext;
2066<SkipDoubleQuote,SkipSingleQuote>. {
outputSpace(yyscanner,yytext[0]);
2067 yyextra->defText += *yytext;
2068 yyextra->defLitText += *yytext;
2071 yyextra->defText += *yytext;
2072 yyextra->defLitText += *yytext;
2075 TRACE(
"End of include file");
2077 if (yyextra->includeStack.empty())
2079 TRACE(
"Terminating scanner");
2084 QCString toFileName = yyextra->fileName;
2085 const std::unique_ptr<FileState> &fs=yyextra->includeStack.back();
2087 YY_BUFFER_STATE oldBuf = YY_CURRENT_BUFFER;
2088 yy_switch_to_buffer( fs->bufState, yyscanner );
2089 yy_delete_buffer( oldBuf, yyscanner );
2090 yyextra->yyLineNr = fs->lineNr;
2092 yyextra->inputBuf = fs->oldFileBuf;
2093 yyextra->inputBufPos = fs->oldFileBufPos;
2094 yyextra->curlyCount = fs->curlyCount;
2096 TRACE(
"switching to {}",yyextra->fileName);
2101 lineStr.sprintf(
"# %d \"%s\" 2",yyextra->yyLineNr,
qPrint(yyextra->fileName));
2104 yyextra->includeStack.pop_back();
2127 for (
const auto &kv : yyextra->localDefines)
2129 auto pair = yyextra->contextDefines.insert(kv);
2132 yyextra->contextDefines.erase(pair.first);
2133 yyextra->contextDefines.insert(kv);
2136 yyextra->localDefines.clear();
static bool isFlagSet(const DebugMask mask)
static void print(DebugMask mask, int prio, fmt::format_string< Args... > fmt, Args &&... args)
const std::string & str() const
const char * qPrint(const char *s)
2141 if (YY_START==SkipVerbatim || YY_START == SkipCondVerbatim || YY_START==SkipCond || YY_START==IDLquote || YY_START == PragmaOnce)
2148 yyextra->lastCContext=YY_START;
2149 yyextra->commentCount=1;
2152 yyextra->isSpecialComment =
true;
2153 yyextra->lastGuardName.clear();
2157 yyextra->isSpecialComment =
false;
2159 BEGIN(SkipCComment);
2163 if (YY_START==SkipVerbatim || YY_START == SkipCondVerbatim || YY_START==SkipCond ||
getLanguageFromFileName(yyextra->fileName)==SrcLangExt::Fortran || YY_START==IDLquote || YY_START == PragmaOnce)
2167 else if (YY_START==RulesRoundDouble)
2174 yyextra->lastCPPContext=YY_START;
2177 yyextra->isSpecialComment =
true;
2178 yyextra->lastGuardName.clear();
2182 yyextra->isSpecialComment =
false;
2184 BEGIN(SkipCPPComment);
2189 yyextra->yyLineNr++;
2192 yyextra->expectGuard =
FALSE;
2202 YY_EXTRA_TYPE state = preYYget_extra(yyscanner);
2203 int bytesInBuf =
static_cast<int>(state->inputBuf->size())-state->inputBufPos;
2204 int bytesToCopy = std::min(max_size,bytesInBuf);
2205 memcpy(buf,state->inputBuf->data()+state->inputBufPos,bytesToCopy);
2206 state->inputBufPos+=bytesToCopy;
2210static yy_size_t
getFenceSize(
char *txt, yy_size_t leng)
2212 yy_size_t fenceSize = 0;
2213 for (
size_t i = 0; i < leng; i++)
2215 if (txt[i] !=
' ' && txt[i] !=
'*' && txt[i] !=
'\t')
break;
2218 return leng-fenceSize;
2223 YY_EXTRA_TYPE state = preYYget_extra(yyscanner);
2226 state->fileName=fi.absFilePath();
2228 if (state->yyFileDef==
nullptr)
2234 if (state->yyFileDef && state->yyFileDef->isReference()) state->yyFileDef=
nullptr;
2239 state->isSource = section.isHeader() || section.isSource();
2244 YY_EXTRA_TYPE state = preYYget_extra(yyscanner);
2245 state->levelGuard.push(
false);
2251 YY_EXTRA_TYPE state = preYYget_extra(yyscanner);
2253 if (!state->levelGuard.empty())
2255 state->levelGuard.pop();
2259 warn(state->fileName,state->yyLineNr,
"More #endif's than #if's found.");
2265 YY_EXTRA_TYPE state = preYYget_extra(yyscanner);
2266 if (state->levelGuard.empty())
2268 warn(state->fileName,state->yyLineNr,
"Found an #else without a preceding #if.");
2273 return state->levelGuard.top();
2279 YY_EXTRA_TYPE state = preYYget_extra(yyscanner);
2280 state->levelGuard.top()=value;
2286 YY_EXTRA_TYPE state = preYYget_extra(yyscanner);
2287 alreadyProcessed =
FALSE;
2288 std::unique_ptr<FileState> fs;
2291 if (fi.exists() && fi.isFile())
2296 QCString absName = fi.absFilePath();
2299 if (state->curlyCount==0)
2304 alreadyProcessed =
TRUE;
2311 alreadyProcessed = std::any_of(
2312 state->includeStack.begin(),
2313 state->includeStack.end(),
2314 [absName](
const std::unique_ptr<FileState> &lfs)
2315 { return lfs->fileName==absName; }
2318 if (alreadyProcessed)
2325 fs = std::make_unique<FileState>();
2334 fs->oldFileBuf = state->inputBuf;
2335 fs->oldFileBufPos = state->inputBufPos;
2341static std::unique_ptr<FileState>
findFile(
yyscan_t yyscanner,
const QCString &fileName,
bool localInclude,
bool &alreadyProcessed)
2343 YY_EXTRA_TYPE state = preYYget_extra(yyscanner);
2354 else if (alreadyProcessed)
2359 if (localInclude && !state->fileName.isEmpty())
2361 FileInfo fi(state->fileName.str());
2372 else if (alreadyProcessed)
2378 if (state->pathList.empty())
2382 for (
auto path : state->pathList)
2384 QCString absName = path+
"/"+fileName;
2394 else if (alreadyProcessed)
2427 if (i>=0 && s[i]==
'*')
2430 while (i>0 && !(s[i-1]==
'/' && s[i]==
'*')) i--;
2437 return ((s[i+1]==
'*' || s[i+1]==
'!') && s[i+2]==
'<') ? &s[i-1] :
"";
2469 bool inString=
FALSE;
2474 if (!inString && !inChar)
2476 while (i<s.
length() && !inString && !inChar)
2497 while (i<s.
length() && inChar)
2518 while (i<s.
length() && inString)
2547 std::string e = expr.
str();
2548 static const reg::Ex r(R
"(\s*##\s*)");
2557 const auto &match = *it;
2558 size_t n = match.position();
2559 size_t l = match.length();
2561 if (n+l+1<e.length() && e[
static_cast<int>(n+l)]==
'@' && expr[
static_cast<int>(n+l+1)]==
'-')
2568 e=e.substr(0,n)+e.substr(n+l);
2569 int k=
static_cast<int>(n)-1;
2570 while (k>=0 &&
isId(e[k])) k--;
2571 if (k>0 && e[k]==
'-' && e[k-1]==
'@')
2574 e=e.substr(0,k-1)+e.substr(k+1);
2592 struct yyguts_t * yyg = (
struct yyguts_t*)yyscanner;
2600 while ((cc=
getNextChar(yyscanner,expr,rest,pos))!=EOF && cc!=0)
2616 int &cc, uint32_t &j,
int &len)
2618 bool changed =
false;
2623 while ((cc=
getCurrentChar(yyscanner,expr,rest,j))!=EOF && cc!=
'\n' && isspace(cc))
2631 int prevChar =
'\0';
2633 if ((cc=
getCurrentChar(yyscanner,expr,rest,j))!=EOF && cc ==
'*')
2635 while ((cc=
getNextChar(yyscanner,expr,rest,j))!=EOF && cc!=0)
2637 if (cc ==
'/' && prevChar ==
'*')
break;
2640 if (cc != EOF) changed =
true;
2653 int vl =
static_cast<int>(vaStr.
length());
2654 while ((vo = vaStr.
find(
"__VA_OPT__(",vp))!=-1)
2656 bool hasHash = vo>0 && vaStr.
at(vo-1)==
'#';
2659 result+=vaStr.
mid(vp,vo-vp-1);
2664 result+=vaStr.
mid(vp,vo-vp);
2668 while (bc>0 && ve<vl)
2670 if (vaStr[ve]==
')') bc--;
2671 else if (vaStr[ve]==
'(') bc++;
2675 if (bc==0 && hasOptionalArgs)
2687 result+=vaStr.
mid(vp);
2719 std::map<std::string,std::string> argTable;
2722 int argCountNonEmpty=0;
2728 while ((cc=
getNextChar(yyscanner,expr,rest,j))!=EOF && cc!=0)
2736 while (!done && (argCount<def->nargs || def->
varArgs) &&
2737 ((cc=
getNextChar(yyscanner,expr,rest,j))!=EOF && cc!=0)
2746 while ((cc=
getNextChar(yyscanner,expr,rest,j))!=EOF && cc!=0)
2750 if (c==
'\'' || c==
'\"')
2772 else if (c==
')' || c==
',')
2785 argKey.
sprintf(
"@%d",argCount++);
2786 if (c==
',' || !arg.
isEmpty()) argCountNonEmpty++;
2800 while (!found && (cc=
getNextChar(yyscanner,expr,rest,j))!=EOF && cc!=0)
2807 if ((cc=
getNextChar(yyscanner,expr,rest,j))==EOF || cc==0)
break;
2817 while (!found && (cc=
getNextChar(yyscanner,expr,rest,j))!=EOF && cc!=0)
2824 if ((cc=
getNextChar(yyscanner,expr,rest,j))==EOF || cc==0)
break;
2832 char prevChar =
'\0';
2836 while ((cc=
getNextChar(yyscanner,expr,rest,j))!=EOF && cc!=0)
2840 if (c ==
'/' && prevChar ==
'*')
break;
2853 if (argCount==def->
nargs ||
2864 bool inString=
FALSE;
2874 else if (d.
at(k+1)==
'-')
2885 if (l>=0 && d.
at(l)==
'"') l--;
2886 while (l>=0 && d.
at(l)==
' ') l--;
2887 if (l>0 && d.
at(l)==
'#' && d.
at(l-1)==
'#') hash=
TRUE;
2890 while (k<d.
length() && d.
at(k)>=
'0' && d.
at(k)<=
'9') key+=d.
at(k++);
2895 if (l<(
int)d.
length() && d.
at(l)==
'"') l++;
2896 while (l<(
int)d.
length() && d.
at(l)==
' ') l++;
2897 if (l<(
int)d.
length()-1 && d.
at(l)==
'#' && d.
at(l+1)==
'#') hash=
TRUE;
2900 auto it = argTable.find(key.
str());
2901 if (it!=argTable.end())
2921 if (hash && substArg.
isEmpty())
2932 if (!inString && d.
at(k)==
'\"')
2936 else if (k>2 && inString && d.
at(k)==
'\"' && (d.
at(k-1)!=
'\\' || d.
at(k-2)==
'\\'))
2960 while (p<(
int)expr.
length())
2962 char c=expr.
at(p++);
2967 else if (isalpha(c) || c==
'_')
2977 if (p<(
int)expr.
length()) c=expr.
at(p);
2978 while (p<(
int)expr.
length() && (c!=
'"' || (pc==
'\\' && ppc!=
'\\')))
2986 if (p<(
int)expr.
length()) ++p;
2992 if (p<(
int)expr.
length())
2998 while (p<(
int)expr.
length() && !(pc==
'*' && c==
'/'))
3011#define MAX_EXPANSION_DEPTH 50
3015 YY_EXTRA_TYPE state = preYYget_extra(yyscanner);
3016 if (!state->nospaces)
3019 char ccPrev = pos==0 || (int)expr.
length()<pos ? state->prevChar : expr.
at(pos-1);
3020 QCString leftSpace = ccPrev!=
':' && ccPrev!=
' ' ?
" " :
"";
3025 uint32_t j=(uint32_t)resultExpr.
length();
3026 while ((ccNext=
getNextChar(yyscanner,resultExpr,
nullptr,j))!=EOF && ccNext==
' ') { }
3027 if (ccNext != EOF)
unputChar(yyscanner,resultExpr,
nullptr,j,(
char)ccNext);
3031 ccNext=restExpr.
at(0);
3034 QCString rightSpace = ccNext!=
':' && ccNext!=
' ' ?
" " :
"";
3037 resultExpr=leftSpace+resultExpr+rightSpace;
3047 struct yyguts_t * yyg = (
struct yyguts_t*)yyscanner;
3048 YY_EXTRA_TYPE state = preYYget_extra(yyscanner);
3055 if (state->expanded.find(expr.
str())!=state->expanded.end() &&
3063 state->expanded.insert(expr.
str());
3067 bool definedTest=
FALSE;
3068 int i=pos, l=0, p=0, len=0;
3073 bool replaced=
FALSE;
3074 macroName=expr.
mid(p,l);
3076 if (p<2 || !(expr.
at(p-2)==
'@' && expr.
at(p-1)==
'-'))
3078 if (state->expandedDict.find(macroName.
str())==state->expandedDict.end())
3080 bool expanded=
false;
3084 if (yyextra->expandOnlyPredef && def && !def->
isPredefined) def=
nullptr;
3085 if (macroName==
"defined")
3090 else if (definedTest)
3092 if (def) expMacro =
" 1 ";
else expMacro =
" 0 ";
3097 else if (def && def->
nargs==-1)
3106 else if (def && def->
nargs>=0)
3124 state->expandedDict.emplace(
toStdString(macroName),def);
3126 state->expandedDict.erase(
toStdString(macroName));
3135 expr=expr.
left(p)+resultExpr+restExpr;
3191 if (inputStr==
nullptr)
return inputStr;
3192 char term = *inputStr;
3193 if (
term!=
'\'' &&
term!=
'"')
return inputStr;
3198 while ((c=*inputStr))
3227 static const std::vector<std::string> signs = {
"signed",
"unsigned" };
3228 struct TypeInfo { std::string name;
size_t size; };
3229 static const std::vector<TypeInfo> types = {
3230 {
"short int",
sizeof(
short int) },
3231 {
"long long int",
sizeof(
long long int) },
3232 {
"long int",
sizeof(
long int) },
3233 {
"long long",
sizeof(
long long) },
3234 {
"long double",
sizeof(
long double) },
3235 {
"int",
sizeof(int) },
3236 {
"short",
sizeof(short) },
3237 {
"bool",
sizeof(bool) },
3238 {
"long",
sizeof(long) },
3239 {
"char",
sizeof(char) },
3240 {
"float",
sizeof(float) },
3241 {
"double",
sizeof(double) },
3247 auto process_cast_or_sizeof = [](
const char *p) -> std::pair<const char *,size_t>
3250 while (*q==
' ' || *q==
'\t') q++;
3252 size_t size =
sizeof(int);
3253 for (
const auto &sgn : signs)
3255 if (
qstrncmp(q,sgn.c_str(),sgn.length())==0) { q+=sgn.length(); found=
true; }
3257 if (!found || *q==
' ' || *q==
'\t' || *q==
')')
3259 while (*q==
' ' || *q==
'\t') q++;
3260 for (
const auto &t : types)
3262 if (
qstrncmp(q,t.name.c_str(),t.name.length())==0)
3264 q += t.name.length();
3269 while (*q==
' ' || *q==
'\t') q++;
3270 if (*q==
')')
return std::make_pair(++q,size);
3272 return std::make_pair(
nullptr,0);
3277 const char *p=s.
data();
3287 const char *q = process_cast_or_sizeof(p+1).first;
3297 const char *q = p+6;
3298 while (*q==
' ' || *q==
'\t') q++;
3301 auto r = process_cast_or_sizeof(q+1);
3318 else if (*(p+1)==
'E')
3324 else if (isdigit(c))
3334 else if (c==
'd' && !inNum)
3345 while ((c=*p) &&
isId(c)) p++;
3348 else if ((isalpha(c) || c==
'_') && !inNum)
3352 while ((c=*p) &&
isId(c)) p++;
3353 while ((c=*p) && isspace((uint8_t)c)) p++;
3360 if (c==
'(') count++;
3364 if (count==0)
break;
3372 while (*p && !(pc==
'*' && c==
'/'))
3389 while (*p && !(pc==
'*' && c==
'/'))
3406 char lc=(char)tolower(c);
3423 const char *p=s.
data();
3448 while (*p && !(pc==
'*' && c==
'/'))
3450 if (*p==
'@' && *(p+1)==
'@')
3493 YY_EXTRA_TYPE state = preYYget_extra(yyscanner);
3497 state->expanded.clear();
3503 return state->constExpParser.parse(state->fileName.data(),state->yyLineNr,e.
str(),ee.
str());
3512 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
3513 YY_EXTRA_TYPE state = preYYget_extra(yyscanner);
3514 state->prevChar = yyscanner->yytext_r > YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ? *(yyscanner->yytext_r-1) : 0;
3516 state->expanded.
clear();
3526 YY_EXTRA_TYPE state = preYYget_extra(yyscanner);
3528 def.
name = state->defName;
3530 def.
nargs = state->defArgs;
3532 def.
fileDef = state->yyFileDef;
3533 def.
lineNr = state->yyLineNr-state->yyMLines;
3535 def.
varArgs = state->defVarArgs;
3545 auto it = state->localDefines.find(def.
name.
str());
3546 if (it!=state->localDefines.end())
3548 state->localDefines.erase(it);
3550 state->localDefines.emplace(def.
name.
str(),def);
3555 YY_EXTRA_TYPE state = preYYget_extra(yyscanner);
3556 if (state->skip)
return;
3561 define.
lineNr = state->yyLineNr - state->yyMLines;
3563 define.
name = state->defName;
3564 define.
args = state->defArgsStr;
3565 define.
fileDef = state->inputFileDef;
3567 QCString litText = state->defLitText;
3568 int l=litText.
find(
'\n');
3578 const char *p=litText.
data()+k;
3580 while ((c=*p++) && (c==
' ' || c==
'\t')) k++;
3584 if (litTextStripped.
contains(
'\n')>=1)
3593 state->macroDefinitions.push_back(define);
3599 YY_EXTRA_TYPE state = preYYget_extra(yyscanner);
3600 if (state->includeStack.empty() || state->curlyCount>0) (*state->outputBuf)+=c;
3605 YY_EXTRA_TYPE state = preYYget_extra(yyscanner);
3606 if (state->includeStack.empty() || state->curlyCount>0) (*state->outputBuf)+=std::string_view(a,len);
3611 YY_EXTRA_TYPE state = preYYget_extra(yyscanner);
3612 if (state->includeStack.empty() || state->curlyCount>0) (*state->outputBuf)+=a.
str();
3634 struct yyguts_t * yyg = (
struct yyguts_t*)yyscanner;
3635 if (!yyextra->defContinue)
return;
3636 for (
int i=0; i< (int)yyleng; i++)
3638 if (yytext[i] ==
'\t')
3639 yyextra->defExtraSpacing+=
'\t';
3641 yyextra->defExtraSpacing+=
' ';
3647 struct yyguts_t * yyg = (
struct yyguts_t*)yyscanner;
3648 yyextra->fenceSize=0;
3650 if (yytext[1]==
'f' && ((c=yytext[2])==
'[' || c==
'{' || c==
'(' || c==
'$'))
3654 case '[': yyextra->blockName=
"]";
break;
3655 case '{': yyextra->blockName=
"}";
break;
3656 case '(': yyextra->blockName=
")";
break;
3657 case '$': yyextra->blockName=
"$";
break;
3660 yyextra->blockName=yyextra->blockName.stripWhiteSpace();
3667 yyextra->blockName=
"uml";
3671 int i = bn.
find(
'{');
3673 yyextra->blockName=bn;
3681 YY_EXTRA_TYPE state = preYYget_extra(yyscanner);
3686 (inc.
at(i)==
' ' || inc.
at(i)==
'"' || inc.
at(i)==
'<')
3691 bool localInclude = s>0 && inc.
at(s-1)==
'"';
3694 while (i<inc.
length() && inc.
at(i)!=
'"' && inc.
at(i)!=
'>') i++;
3696 if (s<inc.
length() && i>s)
3706 QCString oldFileName = state->fileName;
3707 FileDef *oldFileDef = state->yyFileDef;
3708 int oldLineNr = state->yyLineNr;
3714 std::unique_ptr<FileState> fs;
3715 bool alreadyProcessed =
FALSE;
3717 fs=
findFile(yyscanner,absIncFileName,localInclude,alreadyProcessed);
3728 for (i=0;i<state->includeStack.size();i++)
3735 if (state->includeStack.empty() && oldFileDef)
3737 PreIncludeInfo *ii = state->includeRelations.find(absIncFileName);
3742 state->includeRelations.add(
3745 ambig ?
nullptr : incFd,
3753 struct yyguts_t * yyg = (
struct yyguts_t*)yyscanner;
3754 fs->bufState = YY_CURRENT_BUFFER;
3755 fs->lineNr = oldLineNr;
3756 fs->fileName = oldFileName;
3757 fs->curlyCount = state->curlyCount;
3759 fs->lexRulesPart = state->lexRulesPart;
3760 state->lexRulesPart =
false;
3763 state->includeStack.push_back(std::move(fs));
3769 lineStr.sprintf(
"# 1 \"%s\" 1\n",
qPrint(state->fileName));
3773 state->expectGuard=
TRUE;
3774 state->inputBuf = &fs_ptr->
fileBuf;
3775 state->inputBufPos=0;
3776 yy_switch_to_buffer(yy_create_buffer(0,
YY_BUF_SIZE, yyscanner),yyscanner);
3780 if (alreadyProcessed)
3788 if (state->includeStack.empty() && oldFileDef)
3790 PreIncludeInfo *ii = state->includeRelations.find(absIncFileName);
3795 ii = state->includeRelations.add(absIncFileName,
3797 ambig ?
nullptr : incFd,
3807 for (i=0;i<state->includeStack.size();i++)
3811 if (alreadyProcessed)
3821 if (localInclude && !state->includeStack.empty() && state->curlyCount>0 && !alreadyProcessed)
3823 warn(state->fileName,state->yyLineNr,
"include file {} not found, perhaps you forgot to add its directory to INCLUDE_PATH?",incFileName);
3833 YY_EXTRA_TYPE state = preYYget_extra(yyscanner);
3836 bool expResult = prs.
parse(state->fileName.data(),state->yyLineNr,sectId.
data());
3837 state->condStack.emplace(std::make_unique<preYY_CondCtx>(state->fileName,state->yyLineNr,sectId,state->skip));
3847 YY_EXTRA_TYPE state = preYYget_extra(yyscanner);
3848 if (state->condStack.empty())
3850 warn(state->fileName,state->yyLineNr,
"the \\endcond does not have a corresponding \\cond in this file");
3855 const std::unique_ptr<preYY_CondCtx> &ctx = state->condStack.top();
3856 state->skip=ctx->skip;
3857 state->condStack.pop();
3864 YY_EXTRA_TYPE state = preYYget_extra(yyscanner);
3865 while (!state->condStack.empty())
3867 state->condStack.pop();
3878 const char *p=text.
data();
3881 if (c==
'@') result+=
"@@";
else result+=c;
3891 case '=':
return '#';
3892 case '/':
return '\\';
3893 case '\'':
return '^';
3894 case '(':
return '[';
3895 case ')':
return ']';
3896 case '!':
return '|';
3897 case '<':
return '{';
3898 case '>':
return '}';
3899 case '-':
return '~';
3913 return expr.
at(pos++);
3915 else if (rest && !rest->
isEmpty())
3924 int cc=yyinput(yyscanner);
3936 return expr.
at(pos);
3938 else if (rest && !rest->
isEmpty())
3946 int cc=yyinput(yyscanner);
3963 char cs[2];cs[0]=c;cs[1]=
'\0';
3979 YY_EXTRA_TYPE state = preYYget_extra(yyscanner);
3982 auto findDefine = [&undef,&name](
DefineMap &map)
3985 auto it = map.
find(name.
str());
3998 Define *def = findDefine(state->localDefines);
3999 if (def==
nullptr && !undef)
4001 def = findDefine(state->contextDefines);
4008 YY_EXTRA_TYPE state = preYYget_extra(yyscanner);
4012 for (
const auto &ds : predefList)
4014 size_t i_equals=ds.find(
'=');
4015 size_t i_obrace=ds.find(
'(');
4016 size_t i_cbrace=ds.find(
')');
4017 bool nonRecursive = i_equals!=std::string::npos && i_equals>0 && ds[i_equals-1]==
':';
4019 if ((i_obrace==0) || (i_equals==0) || (i_equals==1 && ds[i_equals-1]==
':'))
4024 if (i_obrace<i_equals && i_cbrace<i_equals &&
4025 i_obrace!=std::string::npos && i_cbrace!=std::string::npos &&
4029 static const reg::Ex reId(R
"(\a\w*)");
4030 std::map<std::string,int> argMap;
4031 std::string args = ds.substr(i_obrace+1,i_cbrace-i_obrace-1);
4032 bool hasVarArgs = args.find(
"...")!=std::string::npos;
4038 for (; arg_it!=arg_end; ++arg_it)
4040 argMap.emplace(arg_it->str(),count++);
4044 argMap.emplace(
"__VA_ARGS__",count++);
4048 std::string definition;
4049 std::string in=ds.substr(i_equals+1);
4055 for (; re_it!=re_end; ++re_it)
4057 const auto &
match = *re_it;
4058 size_t pi =
match.position();
4059 size_t l =
match.length();
4060 if (pi>i) definition+=in.substr(i,pi-i);
4062 auto it = argMap.find(
match.str());
4063 if (it!=argMap.end())
4065 int argIndex = it->second;
4067 marker.
sprintf(
" @%d ",argIndex);
4068 definition+=marker.
str();
4072 definition+=
match.str();
4076 definition+=in.substr(i);
4079 std::string dname = ds.substr(0,i_obrace);
4088 def.
fileDef = state->yyFileDef;
4091 state->contextDefines.emplace(def.
name.
str(),def);
4097 else if (!ds.empty())
4101 if (i_equals==std::string::npos)
4108 int ine=
static_cast<int>(i_equals) - (nonRecursive ? 1 : 0);
4109 def.
name = ds.substr(0,ine);
4117 def.
fileDef = state->yyFileDef;
4119 state->contextDefines.emplace(def.
name.
str(),def);
4135 YY_EXTRA_TYPE state = preYYget_extra(
p->yyscanner);
4137 if (fi.isDir()) state->pathList.push_back(fi.absFilePath());
4142 preYYlex_init_extra(&
p->state,&
p->yyscanner);
4148 preYYlex_destroy(
p->yyscanner);
4155 YY_EXTRA_TYPE state = preYYget_extra(
p->yyscanner);
4156 struct yyguts_t *yyg = (
struct yyguts_t*)
p->yyscanner;
4169 state->curlyCount=0;
4170 state->lexRulesPart=
false;
4171 state->nospaces=
FALSE;
4172 state->inputBuf=&input;
4173 state->inputBufPos=0;
4174 state->outputBuf=&output;
4175 state->includeStack.clear();
4176 state->expandedDict.clear();
4177 state->contextDefines.clear();
4178 state->pragmaSet.clear();
4179 while (!state->condStack.empty()) state->condStack.pop();
4183 state->inputFileDef = state->yyFileDef;
4188 state->yyLineNr = 1;
4194 state->expectGuard =
guessSection(fileName).isHeader();
4195 state->guardName.clear();
4196 state->lastGuardName.clear();
4197 state->guardExpr.clear();
4199 preYYlex(yyscanner);
4201 while (!state->condStack.empty())
4203 const std::unique_ptr<preYY_CondCtx> &ctx = state->condStack.top();
4205 if (ctx->sectionId!=
" ") sectionInfo.
sprintf(
" with label '%s' ",
qPrint(ctx->sectionId.stripWhiteSpace()));
4206 warn(ctx->fileName,ctx->lineNr,
"Conditional section{}does not have "
4207 "a corresponding \\endcond command within this file.",sectionInfo);
4208 state->condStack.pop();
4213 if (!state->levelGuard.empty())
4215 warn(state->fileName,state->yyLineNr,
"More #if's than #endif's found (might be in an included file).");
4222 std::string contents;
4230 bool startOfLine =
true;
4231 size_t content_size = output.size() +
4234 contents.reserve(content_size);
4236 while (pos<output.size())
4241 snprintf(lineNrStr,15,
"%05d ",line++);
4242 contents+=lineNrStr;
4244 contents += output[pos];
4245 startOfLine = output[pos]==
'\n';
4250 if (!contents.empty() && contents[contents.length()-1]!=
'\n')
4255 if (yyextra->contextDefines.size()>0)
4259 for (
auto &kv : yyextra->contextDefines)
4263 for (
auto &kv : yyextra->localDefines)
4277 for (
const auto &inc : state->includeRelations)
4279 auto toKind = [](
bool local,
bool imported) ->
IncludeKind
4295 if (inc->fromFileDef)
4297 inc->fromFileDef->addIncludeDependency(inc->toFileDef,inc->includeName,toKind(inc->local,inc->imported));
4299 if (inc->toFileDef && inc->fromFileDef)
4301 inc->toFileDef->addIncludedByDependency(inc->fromFileDef,inc->fromFileDef->docName(),toKind(inc->local,inc->imported));
Copyright (C) 1997-2015 by Dimitri van Heesch.
bool parse(const QCString &fileName, int lineNr, const QCString &expr)
Copyright (C) 1997-2015 by Dimitri van Heesch.
static StringUnorderedSet expandAsDefinedSet
static FileNameLinkedMap * inputNameLinkedMap
static DefinesPerFileList macroDefinitions
static FileNameLinkedMap * includeNameLinkedMap
Wrapper class for the Entry type.
virtual QCString absFilePath() const =0
Minimal replacement for QFileInfo.
void processFile(const QCString &fileName, const std::string &input, std::string &output)
void addSearchDir(const QCString &dir)
std::unique_ptr< Private > p
int find(char c, int index=0, bool cs=TRUE) const
QCString & prepend(const char *s)
QCString mid(size_t index, size_t len=static_cast< size_t >(-1)) const
bool endsWith(const char *s) const
char & at(size_t i)
Returns a reference to the character at index i.
bool isEmpty() const
Returns TRUE iff the string is empty.
QCString right(size_t len) const
QCString & sprintf(const char *format,...)
const char * data() const
Returns a pointer to the contents of the string in the form of a 0-terminated C string.
Class representing a regular expression.
Class to iterate through matches.
#define Config_getList(name)
static FILE * findFile(const QCString &fileName)
DirIterator end(const DirIterator &) noexcept
#define AUTO_TRACE_ADD(...)
bool isAbsolutePath(const QCString &fileName)
bool match(std::string_view str, Match &match, const Ex &re)
Matches a given string str for a match against regular expression re.
static QCString stringize(const QCString &s)
static int getCurrentChar(yyscan_t yyscanner, const QCString &expr, QCString *rest, uint32_t pos)
static bool expandExpression(yyscan_t yyscanner, QCString &expr, QCString *rest, int pos, int level)
#define MAX_EXPANSION_DEPTH
static int getNextChar(yyscan_t yyscanner, const QCString &expr, QCString *rest, uint32_t &pos)
static QCString removeIdsAndMarkers(const QCString &s)
static void initPredefined(yyscan_t yyscanner, const QCString &fileName)
static void addSeparatorsIfNeeded(yyscan_t yyscanner, const QCString &expr, QCString &resultExpr, QCString &restExpr, int pos)
static int getNextId(const QCString &expr, int p, int *l)
static void returnCharToStream(yyscan_t yyscanner, char c)
static void addTillEndOfString(yyscan_t yyscanner, const QCString &expr, QCString *rest, uint32_t &pos, char term, QCString &arg)
static void forceEndCondSection(yyscan_t yyscanner)
static QCString expandVAOpt(const QCString &vaStr, bool hasOptionalArgs)
static std::unique_ptr< FileState > checkAndOpenFile(yyscan_t yyscanner, const QCString &fileName, bool &alreadyProcessed)
static const char * processUntilMatchingTerminator(const char *inputStr, QCString &result)
Process string or character literal.
static void unputChar(yyscan_t yyscanner, const QCString &expr, QCString *rest, uint32_t &pos, char c)
static void processConcatOperators(QCString &expr)
static QCString removeMarkers(const QCString &s)
static bool replaceFunctionMacro(yyscan_t yyscanner, const QCString &expr, QCString *rest, int pos, int &len, const Define *def, QCString &result, int level)
static void skipCommentMacroName(yyscan_t yyscanner, const QCString &expr, QCString *rest, int &cc, uint32_t &j, int &len)
int qstrncmp(const char *str1, const char *str2, size_t len)
void addTerminalCharIfMissing(std::string &s, char c)
bool literal_at(const char *data, const char(&str)[N])
returns TRUE iff data points to a substring that matches string literal str
bool readInputFile(const QCString &fileName, std::string &contents, bool filter, bool isSourceCode)
read a file name fileName and optionally filter and transcode it
bool patternMatch(const FileInfo &fi, const StringVector &patList)
QCString determineAbsoluteIncludeName(const QCString &curFile, const QCString &incFileName)
EntryType guessSection(const QCString &name)
FileDef * findFileDef(const FileNameLinkedMap *fnMap, const QCString &n, bool &ambig)