13%option never-interactive
16%option extra-type="struct preYY_state *"
20#define YY_TYPEDEF_YY_SCANNER_T
64#define YY_NO_UNISTD_H 1
105typedef std::map< std::string, Define >
DefineMap;
128 for (
auto &[name,define] : fromMap)
146 if (dpf && includeStack.find(incFile)==includeStack.end())
148 includeStack.insert(incFile);
155 toMap.emplace(name,define);
169 void addInclude(
const std::string &fromFileName,
const std::string &toFileName)
175 it =
m_fileMap.emplace(fromFileName,std::make_unique<DefinesPerFile>(
this)).first;
177 auto &dpf = it->second;
178 dpf->addInclude(toFileName);
187 it =
m_fileMap.emplace(fileName,std::make_unique<DefinesPerFile>(
this)).first;
189 it->second->store(fromMap);
197 auto &dpf = it->second;
198 dpf->retrieve(toMap);
208 return it->second->stored();
218 return it!=
m_fileMap.end() ? it->second.get() :
nullptr;
221 std::unordered_map< std::string, std::unique_ptr<DefinesPerFile> >
m_fileMap;
341static yy_size_t
getFenceSize(
char *txt, yy_size_t leng);
346#define YY_INPUT(buf,result,max_size) result=yyread(yyscanner,buf,max_size);
349static 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 QCString expandStandardMacro(yyscan_t yyscanner, const QCString &name)
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.
356IDSTART [a-z_A-Z\x80-\xFF]
357ID {IDSTART}[a-z_A-Z0-9\x80-\xFF]*
361RAWBEGIN (u|U|L|u8)?R\"[^ \t\(\)\\]{0,16}"("
362RAWEND ")"[^ \t\(\)\\]{0,16}\"
363CHARLIT (("'"\\[0-7]{1,3}"'")|("'"\\."'")|("'"[^'\\\n]{1,4}"'"))
366FORMULA_START {CMD}("f{"|"f$"|"f["|"f(")
367FORMULA_END {CMD}("f}"|"f$"|"f]"|"f)")
368VERBATIM_START {CMD}("verbatim"|"iliteral"|"latexonly"|"htmlonly"|"xmlonly"|"docbookonly"|"rtfonly"|"manonly"|"dot"|"msc"|"startuml"|"code"("{"[^}]*"}")?){BN}+
369VERBATIM_END {CMD}("endverbatim"|"endiliteral"|"endlatexonly"|"endhtmlonly"|"endxmlonly"|"enddocbookonly"|"endrtfonly"|"endmanonly"|"enddot"|"endmsc"|"enduml"|"endcode")
370VERBATIM_LINE {CMD}"noop"{B}+
371LITERAL_BLOCK {FORMULA_START}|{VERBATIM_START}
372LITERAL_BLOCK_END {FORMULA_END}|{VERBATIM_END}
377RulesSharp "<"[^>\n]*">"
378RulesCurly "{"[^{}\n]*"}"
383EscapeRulesCharOpen "\\["|"\<"|"\\{"|"\\("|"\\\""|"\\ "|"\\\\"
384EscapeRulesCharClose "\\]"|"\>"|"\\}"|"\\)"
385EscapeRulesChar {EscapeRulesCharOpen}|{EscapeRulesCharClose}
401DECIMAL_INTEGER [1-9][0-9']*[0-9]?[uU]?[lL]?[lL]?
402HEXADECIMAL_INTEGER "0"[xX][0-9a-zA-Z']+[0-9a-zA-Z]?
403OCTAL_INTEGER "0"[0-7][0-7']+[0-7]?
404BINARY_INTEGER "0"[bB][01][01']*[01]?
405INTEGER_NUMBER {DECIMAL_INTEGER}|{HEXADECIMAL_INTEGER}|{OCTAL_INTEGER}|{BINARY_INTEGER}
409DIGIT_SEQ [0-9][0-9']*[0-9]?
410FRAC_CONST {DIGIT_SEQ}"."|{DIGIT_SEQ}?"."{DIGIT_SEQ}
411FP_EXP [eE][+-]?{DIGIT_SEQ}
412DEC_FP1 {FRAC_CONST}{FP_EXP}?{FP_SUF}?
413DEC_FP2 {DIGIT_SEQ}{FP_EXP}{FP_SUF}
415HEX_DIGIT_SEQ [0-9a-fA-F][0-9a-fA-F']*[0-9a-fA-F]?
416HEX_FRAC_CONST {HEX_DIGIT_SEQ}"."|{HEX_DIGIT_SEQ}?"."{HEX_DIGIT_SEQ}
417BIN_EXP [pP][+-]?{DIGIT_SEQ}
418HEX_FP1 "0"[xX]{HEX_FRAC_CONST}{BIN_EXP}{FP_SUF}?
419HEX_FP2 "0"[xX]{HEX_DIGIT_SEQ}{BIN_EXP}{FP_SUF}?
421FLOAT_DECIMAL {DEC_FP1}|{DEC_FP2}
422FLOAT_HEXADECIMAL {HEX_FP1}|{HEX_FP2}
423FLOAT_NUMBER {FLOAT_DECIMAL}|{FLOAT_HEXADECIMAL}
424NUMBER {INTEGER_NUMBER}|{FLOAT_NUMBER}
440%x CopyStringFtnDouble
457%x JavaDocVerbatimCode
491 yyextra->yyColNr+=(int)yyleng;
493 yyextra->potentialDefine=yytext;
496<Start>^("%top{"|"%{") {
SrcLangExt getLanguageFromFileName(const QCString &fileName, SrcLangExt defLang)
501<Start>^{Bopt}"cpp_quote"{Bopt}"("{Bopt}\" {
502 if (yyextra->insideIDL)
517<IDLquote>"\""{Bopt}")" {
531<Start>^{B}*[a-z_A-Z\x80-\xFF][a-z_A-Z0-9\x80-\xFF]+{B}*"("[^\)\n]*")"/{BN}{1,10}*[:{] {
533 for (i=(
int)yyleng-1;i>=0;i--)
539<Start>^{B}*[_A-Z][_A-Z0-9]+{B}*"("[^\(\)\n]*"("[^\)\n]*")"[^\)\n]*")"{B}*\n |
540<Start>^{B}*[_A-Z][_A-Z0-9]+{B}*"("[^\)\n]*")"{B}*\n |
541<Start>^{B}*[_A-Z][_A-Z0-9]+{B}*"("[^\(\)\n]*"("[^\)\n]*")"[^\)\n]*")"/{B}*("//"|"/\*") |
542<Start>^{B}*[_A-Z][_A-Z0-9]+{B}*"("[^\)\n]*")"/{B}*("//"|"/\*") {
545 int pos = name.find(
'(');
547 name=name.left(pos).stripWhiteSpace();
550 if (skipFuncMacros && !yyextra->insideFtn &&
551 name!=
"Q_PROPERTY" &&
553 (yyextra->includeStack.empty() || yyextra->curlyCount>0) &&
554 yyextra->macroExpansion &&
562 if (yytext[yyleng-1] ==
'\n')
571 for (i=(
int)yyleng-1;i>=0;i--)
#define Config_getBool(name)
578<CopyLine,LexCopyLine>"extern"{BN}*"\""[^\"]+"\""{BN}*("{")? {
580 yyextra->yyLineNr+=text.
contains(
'\n');
int contains(char c, bool cs=TRUE) const
583<CopyLine,LexCopyLine>{RAWBEGIN} {
586 BEGIN(CopyRawString);
QCString extractBeginRawStringDelimiter(const char *rawStart)
588<CopyLine,LexCopyLine>"{" {
589 if (yyextra->includeStack.empty())
591 yyextra->curlyCount++;
598<CopyLine,LexCopyLine>"}" {
599 if (yyextra->includeStack.empty() && yyextra->curlyCount>0)
601 yyextra->curlyCount--;
605<CopyLine,LexCopyLine>"'"\\[0-7]{1,3}"'" {
608<CopyLine,LexCopyLine>"'"\\."'" {
611<CopyLine,LexCopyLine>"'"."'" {
614<CopyLine,LexCopyLine>[$]?@\" {
617 BEGIN( CopyStringCs );
619<CopyLine,LexCopyLine>\" {
627 BEGIN( CopyStringFtnDouble );
630<CopyLine,LexCopyLine>\' {
633 BEGIN( CopyStringFtn );
635<CopyString>[^\"\\\r\n]{1,1000} {
638<CopyStringCs>[^\"\r\n]{1,1000} {
647<CopyString,CopyStringCs>\" {
651<CopyStringFtnDouble>[^\"\\\r\n]{1,1000} {
654<CopyStringFtnDouble>\\. {
657<CopyStringFtnDouble>\" {
661<CopyStringFtn>[^\'\\\r\n]{1,1000} {
671<CopyRawString>{RAWEND} {
QCString extractEndRawStringDelimiter(const char *rawEnd)
678<CopyRawString>[^)]{1,1000} {
684<CopyLine,LexCopyLine>{ID}/{BN}{0,80}"(" {
685 yyextra->expectGuard =
FALSE;
695 if ((yyextra->includeStack.empty() || yyextra->curlyCount>0) &&
696 yyextra->macroExpansion &&
702 yyextra->roundCount=0;
703 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} {
853 if ((yyextra->includeStack.empty() || yyextra->curlyCount>0) &&
854 yyextra->macroExpansion &&
874<CopyLine,LexCopyLine>"\\"\r?/\n {
877<CopyLine,LexCopyLine>\\. {
880<CopyLine,LexCopyLine>. {
883<CopyLine,LexCopyLine>\n {
890 yyextra->defArgsStr+=
'(';
891 yyextra->roundCount++;
894 yyextra->defArgsStr+=
')';
895 yyextra->roundCount--;
896 if (yyextra->roundCount==0)
900 if (yyextra->findDefArgContext==CopyLine)
903 BEGIN(yyextra->findDefArgContext);
908 yyextra->nospaces=
FALSE;
918<FindDefineArgs>{CHARLIT} {
919 yyextra->defArgsStr+=yytext;
921<FindDefineArgs>{CCS}[*!]? {
922 yyextra->defArgsStr+=yytext;
923 BEGIN(ArgCopyCComment);
925<FindDefineArgs>{CPPC}[/!].*\n/{B}*{CPPC}[/!] {
930 yyextra->defArgsStr+=
QCString(
"/**< @brief ")+&yytext[4];
934 yyextra->defArgsStr+=
QCString(
"/** @brief ")+&yytext[3];
939 yyextra->defArgsStr+=
QCString(
"/**")+&yytext[3];
941 BEGIN(ArgCopyCppComment);
943<FindDefineArgs>{CPPC}[/!].*\n {
946 yyextra->defArgsStr+=
QCString(
"/**")+&yytext[3]+
" */";
952 yyextra->defArgsStr+=
QCString(
"/**< @brief ")+&yytext[4]+
" */";
956 yyextra->defArgsStr+=
QCString(
"/** @brief ")+&yytext[3]+
" */";
960<FindDefineArgs>{CPPC}.*\n {
961 yyextra->defArgsStr+=
QCString(
"/*")+&yytext[2]+
" */";
964 yyextra->defArgsStr+=*yytext;
969 yyextra->defArgsStr+=*yytext;
973 yyextra->defArgsStr+=
' ';
978 yyextra->defArgsStr+=
"@@";
981 yyextra->defArgsStr+=*yytext;
983<ArgCopyCComment>[^*\n]+ {
984 yyextra->defArgsStr+=yytext;
986<ArgCopyCComment>{CCE} {
987 yyextra->defArgsStr+=yytext;
988 BEGIN(FindDefineArgs);
991 yyextra->defArgsStr+=yytext;
995 yyextra->defArgsStr+=yytext;
997<ArgCopyCppComment>^{B}*
998<ArgCopyCppComment>{CPPC}[/!].*\n/{B}*{CPPC}[/!] {
999 const char *startContent = &yytext[3];
1000 if (startContent[0]==
'<') startContent++;
1001 yyextra->defArgsStr+=startContent;
1003<ArgCopyCppComment>{CPPC}[/!].*\n {
1004 const char *startContent = &yytext[3];
1005 if (startContent[0]==
'<') startContent++;
1006 yyextra->defArgsStr+=
QCString(startContent)+
" */";
1007 BEGIN(FindDefineArgs);
1009<ArgCopyCppComment>. {
1011 yyextra->defArgsStr+=
" */";
1012 BEGIN(FindDefineArgs);
1015 yyextra->defArgsStr+=*yytext;
1016 BEGIN(FindDefineArgs);
1020 yyextra->defArgsStr+=*yytext;
1021 BEGIN(FindDefineArgs);
1024<ReadString>{CPPC}|{CCS} {
1025 yyextra->defArgsStr+=yytext;
1027<ReadString>\\/\r?\n {
1030 yyextra->defArgsStr+=yytext;
1033 yyextra->defArgsStr+=*yytext;
1035<Command>("include"|"import"){B}+/{ID} {
1036 yyextra->isImported = yytext[1]==
'm';
1037 if (yyextra->macroExpansion)
1040<Command>("include"|"import"){B}*[<"] {
1041 yyextra->isImported = yytext[1]==
'm';
1043 c[0]=yytext[yyleng-1];c[1]=
'\0';
1047<Command>("cmake")?"define"{B}+ {
1048 yyextra->potentialDefine +=
substitute(yytext,
"cmake",
" ");
1050 yyextra->yyColNr+=(int)yyleng;
QCString substitute(const QCString &s, const QCString &src, const QCString &dst)
substitute all occurrences of src in s by dst
1053<Command>"cmakedefine01"{B}+ {
1054 yyextra->potentialDefine +=
substitute(yytext,
"cmakedefine01",
" define ");
1056 yyextra->yyColNr+=(int)yyleng;
1057 BEGIN(CmakeDefName01);
1059<Command>"ifdef"/{B}*"(" {
1061 yyextra->guardExpr.clear();
1062 BEGIN(DefinedExpr2);
1064<Command>"ifdef"/{B}+ {
1067 yyextra->guardExpr.clear();
1068 BEGIN(DefinedExpr1);
1070<Command>"ifndef"/{B}*"(" {
1072 yyextra->guardExpr=
"! ";
1073 BEGIN(DefinedExpr2);
1075<Command>"ifndef"/{B}+ {
1077 yyextra->guardExpr=
"! ";
1078 BEGIN(DefinedExpr1);
1080<Command>"if"/[ \t(!] {
1082 yyextra->guardExpr.clear();
1085<Command>("elif"|"else"{B}*"if")/[ \t(!] {
1088 yyextra->guardExpr.clear();
1094 BEGIN(SkipCPPBlock);
1097<Command>"else"/[^a-z_A-Z0-9\x80-\xFF] {
1101 BEGIN(SkipCPPBlock);
1108<Command>"undef"{B}+ {
1111<Command>("elif"|"else"{B}*"if")/[ \t(!] {
1114 yyextra->guardExpr.clear();
1118<Command>"endif"/[^a-z_A-Z0-9\x80-\xFF] {
1122<Command,IgnoreLine>\n {
1125 yyextra->yyLineNr++;
1127<Command>"pragma"{B}+"once" {
1128 yyextra->expectGuard =
FALSE;
1129 if (yyextra->pragmaSet.find(yyextra->fileName.str())!=yyextra->pragmaSet.end())
1136 yyextra->pragmaSet.insert(yyextra->fileName.data());
1141<PragmaOnce><<EOF>> {
1142 yyextra->expectGuard =
FALSE;
1148<IgnoreLine>\\[\r]?\n {
1150 yyextra->yyLineNr++;
1153<Command>. { yyextra->potentialDefine += yytext[0]==
'\t' ?
'\t' :
' ';
1154 yyextra->yyColNr+=(int)yyleng;
1170 yyextra->guardExpr+=
' ';
1171 yyextra->yyLineNr++;
1173<Guard>"defined"/{B}*"(" {
1174 BEGIN(DefinedExpr2);
1176<Guard>"defined"/{B}+ {
1177 BEGIN(DefinedExpr1);
1179<Guard>"true"/{B}|{B}*[\r]?\n { yyextra->guardExpr+=
"1L"; }
1180<Guard>"false"/{B}|{B}*[\r]?\n { yyextra->guardExpr+=
"0L"; }
1181<Guard>"not"/{B} { yyextra->guardExpr+=
'!'; }
1182<Guard>"not_eq"/{B} { yyextra->guardExpr+=
"!="; }
1183<Guard>"and"/{B} { yyextra->guardExpr+=
"&&"; }
1184<Guard>"or"/{B} { yyextra->guardExpr+=
"||"; }
1185<Guard>"bitand"/{B} { yyextra->guardExpr+=
"&"; }
1186<Guard>"bitor"/{B} { yyextra->guardExpr+=
"|"; }
1187<Guard>"xor"/{B} { yyextra->guardExpr+=
"^"; }
1188<Guard>"compl"/{B} { yyextra->guardExpr+=
"~"; }
1189<Guard>{ID} { yyextra->guardExpr+=yytext; }
1190<Guard>"@" { yyextra->guardExpr+=
"@@"; }
1191<Guard>. { yyextra->guardExpr+=*yytext; }
1205 BEGIN(SkipCPPBlock);
1208<DefinedExpr1,DefinedExpr2>\\\n { yyextra->yyLineNr++;
outputChar(yyscanner,
'\n'); }
1210 if (
isDefined(yyscanner,yytext) || yyextra->guardName==yytext)
1211 yyextra->guardExpr+=
" 1L ";
1213 yyextra->guardExpr+=
" 0L ";
1214 yyextra->lastGuardName=yytext;
1218 if (
isDefined(yyscanner,yytext) || yyextra->guardName==yytext)
1219 yyextra->guardExpr+=
" 1L ";
1221 yyextra->guardExpr+=
" 0L ";
1222 yyextra->lastGuardName=yytext;
1224<DefinedExpr1,DefinedExpr2>\n {
1225 yyextra->yyLineNr++;
1227 BEGIN(SkipCPPBlock);
1232<DefinedExpr1,DefinedExpr2>.
1233<SkipCPPBlock>^{B}*"#" { BEGIN(SkipCommand); }
1234<SkipCPPBlock>^{Bopt}/[^#] { BEGIN(SkipLine); }
1235<SkipCPPBlock>\n { yyextra->yyLineNr++;
outputChar(yyscanner,
'\n'); }
1237<SkipCommand>"if"(("n")?("def"))?/[ \t(!] {
1242<SkipCommand>"else" {
1251<SkipCommand>("elif"|"else"{B}*"if")/[ \t(!] {
1252 if (yyextra->ifcount==0)
1256 yyextra->guardExpr.clear();
1257 yyextra->lastGuardName.clear();
1262 BEGIN(SkipCPPBlock);
1266<SkipCommand>"endif" {
1267 yyextra->expectGuard =
FALSE;
1269 if (--yyextra->ifcount<0)
1277 yyextra->yyLineNr++;
1278 BEGIN(SkipCPPBlock);
1285<SkipLine>{CHARLIT} { }
1290<SkipString>{CPPC}/[^\n]* {
1292<SkipLine,SkipCommand,SkipCPPBlock>{CPPC}[^\n]* {
1293 yyextra->lastCPPContext=YY_START;
1294 BEGIN(RemoveCPPComment);
1296<SkipString>{CCS}/[^\n]* {
1298<SkipLine,SkipCommand,SkipCPPBlock>{CCS}/[^\n]* {
1299 yyextra->lastCContext=YY_START;
1300 BEGIN(RemoveCComment);
1304 yyextra->yyLineNr++;
1305 BEGIN(SkipCPPBlock);
1307<SkipString>[^"\\\n]+ { }
1313<IncludeID>{ID}{Bopt}/"(" {
1314 yyextra->nospaces=
TRUE;
1315 yyextra->roundCount=0;
1316 yyextra->defArgsStr=yytext;
1317 yyextra->findDefArgContext = IncludeID;
1318 BEGIN(FindDefineArgs);
1321 yyextra->nospaces=
TRUE;
1325<Include>[^\">\n]+[\">] {
1326 yyextra->incName+=yytext;
1327 if (yyextra->isImported)
1337<EndImport>{ENDIMPORTopt}/\n {
1341<EndImport>\\[\r]?"\n" {
1343 yyextra->yyLineNr++;
1347<DefName>{ID}/("\\\n")*"(" {
1349 yyextra->argMap.clear();
1350 yyextra->defArgs = 0;
1351 yyextra->defArgsStr.clear();
1352 yyextra->defText.clear();
1353 yyextra->defLitText.clear();
1354 yyextra->defName = yytext;
1355 yyextra->defVarArgs =
FALSE;
1356 yyextra->defExtraSpacing.clear();
1357 yyextra->defContinue =
false;
1360<DefName>{ID}{B}+"1"/[ \r\t\n] {
1362 yyextra->argMap.clear();
1363 yyextra->defArgs = -1;
1364 yyextra->defArgsStr.clear();
1366 yyextra->defVarArgs =
FALSE;
1369 if (yyextra->curlyCount>0 || yyextra->defName!=yyextra->lastGuardName || !yyextra->expectGuard)
1371 QCString def = yyextra->potentialDefine +
1374 outputSpaces(yyscanner,yytext+yyextra->defName.length());
1375 yyextra->quoteArg=
FALSE;
1376 yyextra->insideComment=
FALSE;
1377 yyextra->lastGuardName.clear();
1378 yyextra->defText=
"1";
1379 yyextra->defLitText=
"1";
1385 yyextra->defText.clear();
1386 yyextra->defLitText.clear();
1389 yyextra->expectGuard=
FALSE;
QCString stripWhiteSpace() const
returns a copy of this string with leading and trailing whitespace removed
QCString left(size_t len) const
1391<DefName,CmakeDefName01>{ID}/{B}*"\n" {
1392 yyextra->argMap.clear();
1393 yyextra->defArgs = -1;
1394 yyextra->defName = yytext;
1395 yyextra->defArgsStr.clear();
1396 yyextra->defText.clear();
1397 yyextra->defLitText.clear();
1398 yyextra->defVarArgs =
FALSE;
1401 if (yyextra->curlyCount>0 || yyextra->defName!=yyextra->lastGuardName || !yyextra->expectGuard)
1403 QCString def = yyextra->potentialDefine + yyextra->defName;
1405 yyextra->quoteArg=
FALSE;
1406 yyextra->insideComment=
FALSE;
1407 if (YY_START == CmakeDefName01) yyextra->defText =
"0";
1408 else if (yyextra->insideCS) yyextra->defText=
"1";
1414 yyextra->guardName = yytext;
1415 yyextra->lastGuardName.clear();
1418 yyextra->expectGuard=
FALSE;
1422 yyextra->argMap.clear();
1423 yyextra->defArgs = -1;
1424 yyextra->defArgsStr.clear();
1425 yyextra->defText.clear();
1426 yyextra->defLitText.clear();
1427 yyextra->defName = yytext;
1428 yyextra->defVarArgs =
FALSE;
1429 QCString def = yyextra->potentialDefine +
1431 yyextra->defArgsStr ;
1433 yyextra->quoteArg=
FALSE;
1434 yyextra->insideComment=
FALSE;
1438 yyextra->defExtraSpacing+=
"\n";
1439 yyextra->defContinue =
true;
1440 yyextra->yyLineNr++;
1442<DefineArg>{B}* { yyextra->defExtraSpacing+=yytext; }
1443<DefineArg>","{B}* { yyextra->defArgsStr+=yytext; }
1444<DefineArg>"("{B}* { yyextra->defArgsStr+=yytext; }
1445<DefineArg>{B}*")"{B}* {
1447 yyextra->defArgsStr+=yytext;
1448 QCString def = yyextra->potentialDefine +
1450 yyextra->defArgsStr +
1451 yyextra->defExtraSpacing ;
1453 yyextra->quoteArg=
FALSE;
1454 yyextra->insideComment=
FALSE;
1458 yyextra->defVarArgs =
TRUE;
1459 yyextra->defArgsStr+=yytext;
1460 yyextra->argMap.emplace(std::string(
"__VA_ARGS__"),yyextra->defArgs);
1463<DefineArg>{ID}{B}*("..."?) {
1466 yyextra->defVarArgs = yytext[yyleng-1]==
'.';
1467 if (yyextra->defVarArgs)
1472 yyextra->defArgsStr+=yytext;
1473 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)
1489<DefineText>{CCS}[!*]? {
1490 yyextra->defText+=yytext;
1491 yyextra->defLitText+=yytext;
1492 yyextra->lastCContext=YY_START;
1493 yyextra->commentCount=1;
1494 BEGIN(CopyCComment);
1496<DefineText>{CPPC}[!/]? {
1498 yyextra->lastCPPContext=YY_START;
1499 yyextra->defLitText+=
' ';
1500 BEGIN(SkipCPPComment);
1502<SkipCComment>[/]?{CCE} {
1503 if (yytext[0]==
'/')
outputChar(yyscanner,
'/');
1505 if (--yyextra->commentCount<=0)
1507 if (yyextra->lastCContext==Start)
1511 YY_CURRENT_BUFFER->yy_at_bol=1;
1513 BEGIN(yyextra->lastCContext);
1516<SkipCComment>{CPPC}("/")* {
1519<SkipCComment>{CCS} {
1523<SkipCond>{CMD}{CMD} { }
1524<SkipCond>^({B}*"*"+)?{B}{0,3}"~~~"[~]* {
1526 if (!markdownSupport || !yyextra->isSpecialComment)
1532 yyextra->fenceChar=
'~';
1534 BEGIN(SkipCondVerbatim);
1537<SkipCond>^({B}*"*"+)?{B}{0,3}"```"[`]* {
1539 if (!markdownSupport || !yyextra->isSpecialComment)
1545 yyextra->fenceChar=
'`';
1547 BEGIN(SkipCondVerbatim);
1550<SkipCComment>^({B}*"*"+)?{B}{0,3}"~~~"[~]* {
1552 if (!markdownSupport || !yyextra->isSpecialComment)
1559 yyextra->fenceChar=
'~';
1561 BEGIN(SkipVerbatim);
1564<SkipCComment>^({B}*"*"+)?{B}{0,3}"```"[`]* {
1566 if (!markdownSupport || !yyextra->isSpecialComment)
1573 yyextra->fenceChar=
'`';
1575 BEGIN(SkipVerbatim);
1578<SkipCComment>{CMD}{VERBATIM_LINE} |
1579<SkipCComment>{CMD}{LITERAL_BLOCK} {
1583<SkipCComment>{VERBATIM_LINE}.*/\n {
1586<SkipCComment>{LITERAL_BLOCK} {
1589 if (yyextra->isSpecialComment)
1592 BEGIN(SkipVerbatim);
1595<SkipCond>{CMD}{CMD}"cond"[ \t]+ {}
1596<SkipCond>{CMD}"cond"/\n |
1597<SkipCond>{CMD}"cond"[ \t]+ {
1601<SkipCComment>"{"[ \t]*"@code"/[ \t\n] {
1603 yyextra->javaBlock=1;
1604 BEGIN(JavaDocVerbatimCode);
1606<SkipCComment>"{"[ \t]*"@literal"/[ \t\n] {
1608 yyextra->javaBlock=1;
1609 BEGIN(JavaDocVerbatimCode);
1611<SkipCComment,SkipCPPComment>{CMD}{CMD}"cond"[ \t\n]+ {
1614<SkipCPPComment>{CMD}"cond"[ \t]+ {
1615 yyextra->ccomment=
TRUE;
1616 yyextra->condCtx=YY_START;
1619<SkipCComment>{CMD}"cond"[ \t]+ {
1620 yyextra->ccomment=
FALSE;
1621 yyextra->condCtx=YY_START;
1624<CondLineC,CondLineCpp>[!()&| \ta-z_A-Z0-9\x80-\xFF.\-]+ {
1628 if (YY_START==CondLineC)
1632 yyextra->ccomment=
TRUE;
1636 yyextra->ccomment=
FALSE;
1642 BEGIN(yyextra->condCtx);
1645<CondLineC,CondLineCpp>. {
1650 if (YY_START==CondLineC)
1654 yyextra->ccomment=
TRUE;
1658 yyextra->ccomment=
FALSE;
1664 BEGIN(yyextra->condCtx);
1667<SkipCComment,SkipCPPComment>{CMD}"cond"{WSopt}/\n {
1668 if (YY_START==SkipCComment)
1670 yyextra->ccomment=
TRUE;
1676 yyextra->ccomment=
FALSE;
1678 yyextra->condCtx=YY_START;
1682<SkipCond>\n { yyextra->yyLineNr++;
outputChar(yyscanner,
'\n'); }
1683<SkipCond>{VERBATIM_LINE}.*/\n { }
1684<SkipCond>{LITERAL_BLOCK} {
1686 yyextra->yyLineNr+=numNLs;
1687 for (
int i = 0; i < numNLs; i++)
outputChar(yyscanner,
'\n');
1689 BEGIN(SkipCondVerbatim);
1693<SkipCond>[^\/\!*\\@\n]+ { }
1694<SkipCond>{CPPC}[/!] { yyextra->ccomment=
FALSE; }
1695<SkipCond>{CCS}[*!] { yyextra->ccomment=
TRUE; }
1696<SkipCond,SkipCComment,SkipCPPComment>{CMD}{CMD}"endcond"/[^a-z_A-Z0-9\x80-\xFF] {
1702<SkipCond>{CMD}"endcond"/[^a-z_A-Z0-9\x80-\xFF] {
1703 bool oldSkip = yyextra->skip;
1705 if (oldSkip && !yyextra->skip)
1707 if (yyextra->ccomment)
1711 BEGIN(yyextra->condCtx);
1714<SkipCComment,SkipCPPComment>{CMD}"endcond"/[^a-z_A-Z0-9\x80-\xFF] {
1715 bool oldSkip = yyextra->skip;
1717 if (oldSkip && !yyextra->skip)
1719 BEGIN(yyextra->condCtx);
1722<SkipCondVerbatim>{LITERAL_BLOCK_END} {
1723 if (yytext[1]==
'f' && yyextra->blockName==&yytext[2])
1727 else if (&yytext[4]==yyextra->blockName)
1732<SkipVerbatim>{LITERAL_BLOCK_END} {
1734 if (yytext[1]==
'f' && yyextra->blockName==&yytext[2])
1736 BEGIN(SkipCComment);
1738 else if (&yytext[4]==yyextra->blockName)
1740 BEGIN(SkipCComment);
1743<SkipCondVerbatim>^({B}*"*"+)?{B}{0,3}"~~~"[~]* {
1744 if (yyextra->fenceSize==
getFenceSize(yytext,yyleng) && yyextra->fenceChar==
'~')
1749<SkipCondVerbatim>^({B}*"*"+)?{B}{0,3}"```"[`]* {
1750 if (yyextra->fenceSize==
getFenceSize(yytext,yyleng) && yyextra->fenceChar==
'`')
1755<SkipVerbatim>^({B}*"*"+)?{B}{0,3}"~~~"[~]* {
1757 if (yyextra->fenceSize==
getFenceSize(yytext,yyleng) && yyextra->fenceChar==
'~')
1759 BEGIN(SkipCComment);
1762<SkipVerbatim>^({B}*"*"+)?{B}{0,3}"```"[`]* {
1764 if (yyextra->fenceSize==
getFenceSize(yytext,yyleng) && yyextra->fenceChar==
'`')
1766 BEGIN(SkipCComment);
1769<SkipCondVerbatim>{CCE}|{CCS} { }
1770<SkipVerbatim>{CCE}|{CCS} {
1773<JavaDocVerbatimCode>"{" {
1774 if (yyextra->javaBlock==0)
1780 yyextra->javaBlock++;
1784<JavaDocVerbatimCode>"}" {
1785 if (yyextra->javaBlock==0)
1791 yyextra->javaBlock--;
1792 if (yyextra->javaBlock==0)
1795 BEGIN(SkipCComment);
1803<JavaDocVerbatimCode>\n {
1806<JavaDocVerbatimCode>. {
1809<SkipCondVerbatim>[^{*\\@\x06~`\n\/]+ { }
1810<SkipCComment,SkipVerbatim>[^{*\\@\x06~`\n\/]+ {
1813<SkipCComment,SkipVerbatim,SkipCondVerbatim>\n {
1814 yyextra->yyLineNr++;
1817<SkipCondVerbatim>. { }
1818<SkipCComment,SkipVerbatim>. {
1821<CopyCComment>[^*a-z_A-Z\x80-\xFF\n]*[^*a-z_A-Z\x80-\xFF\\\n] {
1822 yyextra->defLitText+=yytext;
1823 yyextra->defText+=
escapeAt(yytext);
1825<CopyCComment>\\[\r]?\n {
1826 yyextra->defLitText+=yytext;
1827 yyextra->defText+=
" ";
1828 yyextra->yyLineNr++;
1829 yyextra->yyMLines++;
1831<CopyCComment>{CCE} {
1832 yyextra->defLitText+=yytext;
1833 yyextra->defText+=yytext;
1834 BEGIN(yyextra->lastCContext);
1837 yyextra->yyLineNr++;
1838 yyextra->defLitText+=yytext;
1839 yyextra->defText+=
' ';
1841<RemoveCComment>{CCE}{B}*"#" {
1842 if (yyextra->lastCContext==SkipCPPBlock)
1851<RemoveCComment>{CCE} { BEGIN(yyextra->lastCContext); }
1852<RemoveCComment>{CPPC}
1853<RemoveCComment>{CCS}
1854<RemoveCComment>[^*\x06\n]+
1855<RemoveCComment>\n { yyextra->yyLineNr++;
outputChar(yyscanner,
'\n'); }
1857<SkipCPPComment>[^\n\/\\@]+ {
1860<SkipCPPComment,RemoveCPPComment>\n {
1862 BEGIN(yyextra->lastCPPContext);
1864<SkipCPPComment>{CCS} {
1867<SkipCPPComment>{CPPC} {
1870<SkipCPPComment>[^\x06\@\\\n]+ {
1876<RemoveCPPComment>{CCS}
1877<RemoveCPPComment>{CPPC}
1878<RemoveCPPComment>[^\x06\n]+
1880<DefineText>"__VA_OPT__("{B}*"##" {
1881 warn(yyextra->fileName,yyextra->yyLineNr,
1882 "'##' may not appear at the beginning of a __VA_OPT__()",
1883 yyextra->defName,yyextra->defLitText.stripWhiteSpace());
1884 yyextra->defText+=
"__VA_OPT__(";
1885 yyextra->defLitText+=
"__VA_OPT__(";
#define warn(file, line, fmt,...)
1887<DefineText>"#"/"__VA_OPT__" {
1888 yyextra->defText+=yytext;
1889 yyextra->defLitText+=yytext;
1891<DefineText>"#"/{IDSTART} {
1893 yyextra->quoteArg=
TRUE;
1894 yyextra->idStart=
true;
1895 yyextra->defLitText+=yytext;
1897<DefineText,CopyCComment>{ID} {
1898 yyextra->defLitText+=yytext;
1899 if (YY_START == DefineText)
outputSpaces(yyscanner,yytext);
1900 if (yyextra->quoteArg)
1902 yyextra->defText+=
"\"";
1904 if (yyextra->defArgs>0)
1906 auto it = yyextra->argMap.find(yytext);
1907 if (it!=yyextra->argMap.end())
1910 yyextra->defText+=
'@';
1915 if (yyextra->idStart)
1917 warn(yyextra->fileName,yyextra->yyLineNr,
1918 "'#' is not followed by a macro parameter '{}': '{}'",
1919 yyextra->defName,yyextra->defLitText.stripWhiteSpace());
1921 yyextra->defText+=yytext;
1926 yyextra->defText+=yytext;
1928 if (yyextra->quoteArg)
1930 yyextra->defText+=
"\"";
1932 yyextra->quoteArg=
FALSE;
1933 yyextra->idStart=
false;
QCString & setNum(short n)
1936 yyextra->defLitText+=yytext;
1937 yyextra->defText+=yytext;
1939<DefineText>\\[\r]?\n {
1940 yyextra->defLitText+=yytext;
1943 yyextra->defText +=
' ';
1944 yyextra->yyLineNr++;
1945 yyextra->yyMLines++;
1949 yyextra->defText = yyextra->defText.stripWhiteSpace();
1950 if (yyextra->defText.startsWith(
"##"))
1952 warn(yyextra->fileName,yyextra->yyLineNr,
1953 "'##' cannot occur at the beginning of a macro definition '{}': '{}'",
1954 yyextra->defName,yyextra->defLitText.stripWhiteSpace());
1956 else if (yyextra->defText.endsWith(
"##"))
1958 warn(yyextra->fileName,yyextra->yyLineNr,
1959 "'##' cannot occur at the end of a macro definition '{}': '{}'",
1960 yyextra->defName,yyextra->defLitText.stripWhiteSpace());
1962 else if (yyextra->defText.endsWith(
"#"))
1964 warn(yyextra->fileName,yyextra->yyLineNr,
1965 "expected formal parameter after # in macro definition '{}': '{}'",
1966 yyextra->defName,yyextra->defLitText.stripWhiteSpace());
1971 yyextra->defLitText=yyextra->defLitText.left(yyextra->defLitText.length()-
comment.length()-1);
1974 yyextra->defLitText+=yytext;
1977 if (yyextra->includeStack.empty() || yyextra->curlyCount>0)
1981 def=
isDefined(yyscanner,yyextra->defName);
1995 def->
name = yyextra->defName;
1997 def->
nargs = yyextra->defArgs;
1999 def->
lineNr = yyextra->yyLineNr-yyextra->yyMLines;
2004 if (def->
fileName != yyextra->fileName && !yyextra->expandOnlyPredef)
addDefine(yyscanner);
2008 yyextra->argMap.clear();
2009 yyextra->yyLineNr++;
2011 yyextra->lastGuardName.clear();
2015 yyextra->defText +=
' ';
2016 yyextra->defLitText+=yytext;
2019 yyextra->defText +=
"##";
2020 yyextra->defLitText+=yytext;
2023 yyextra->defText +=
"@@";
2024 yyextra->defLitText+=yytext;
2028 yyextra->defText += *yytext;
2029 yyextra->defLitText+=yytext;
2030 if (!yyextra->insideComment)
2032 BEGIN(SkipDoubleQuote);
2035<DefineText>{NUMBER} {
2037 yyextra->defText += yytext;
2038 yyextra->defLitText+=yytext;
2042 yyextra->defText += *yytext;
2043 yyextra->defLitText+=yytext;
2044 if (!yyextra->insideComment)
2046 BEGIN(SkipSingleQuote);
2049<SkipDoubleQuote>{CPPC}[/]? {
outputSpaces(yyscanner,yytext);
2050 yyextra->defText += yytext;
2051 yyextra->defLitText+=yytext;
2053<SkipDoubleQuote>{CCS}[*]? {
outputSpaces(yyscanner,yytext);
2054 yyextra->defText += yytext;
2055 yyextra->defLitText+=yytext;
2057<SkipDoubleQuote>\" {
2059 yyextra->defText += *yytext;
2060 yyextra->defLitText+=yytext;
2063<SkipSingleQuote,SkipDoubleQuote>\\. {
2065 yyextra->defText += yytext;
2066 yyextra->defLitText+=yytext;
2068<SkipSingleQuote>\' {
2070 yyextra->defText += *yytext;
2071 yyextra->defLitText+=yytext;
2074<SkipDoubleQuote,SkipSingleQuote>. {
outputSpace(yyscanner,yytext[0]);
2075 yyextra->defText += *yytext;
2076 yyextra->defLitText += *yytext;
2079 yyextra->defText += *yytext;
2080 yyextra->defLitText += *yytext;
2083 TRACE(
"End of include file");
2085 if (yyextra->includeStack.empty())
2087 TRACE(
"Terminating scanner");
2092 QCString toFileName = yyextra->fileName;
2093 const std::unique_ptr<FileState> &fs=yyextra->includeStack.back();
2095 YY_BUFFER_STATE oldBuf = YY_CURRENT_BUFFER;
2096 yy_switch_to_buffer( fs->bufState, yyscanner );
2097 yy_delete_buffer( oldBuf, yyscanner );
2098 yyextra->yyLineNr = fs->lineNr;
2100 yyextra->inputBuf = fs->oldFileBuf;
2101 yyextra->inputBufPos = fs->oldFileBufPos;
2102 yyextra->curlyCount = fs->curlyCount;
2104 TRACE(
"switching to {}",yyextra->fileName);
2109 lineStr.sprintf(
"# %d \"%s\" 2",yyextra->yyLineNr,
qPrint(yyextra->fileName));
2112 yyextra->includeStack.pop_back();
2135 for (
const auto &kv : yyextra->localDefines)
2137 auto pair = yyextra->contextDefines.insert(kv);
2140 yyextra->contextDefines.erase(pair.first);
2141 yyextra->contextDefines.insert(kv);
2144 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)
2149 if (YY_START==SkipVerbatim || YY_START == SkipCondVerbatim || YY_START==SkipCond || YY_START==IDLquote || YY_START == PragmaOnce)
2156 yyextra->lastCContext=YY_START;
2157 yyextra->commentCount=1;
2160 yyextra->isSpecialComment =
true;
2161 yyextra->lastGuardName.clear();
2165 yyextra->isSpecialComment =
false;
2167 BEGIN(SkipCComment);
2171 if (YY_START==SkipVerbatim || YY_START == SkipCondVerbatim || YY_START==SkipCond ||
getLanguageFromFileName(yyextra->fileName)==SrcLangExt::Fortran || YY_START==IDLquote || YY_START == PragmaOnce)
2175 else if (YY_START==RulesRoundDouble)
2182 yyextra->lastCPPContext=YY_START;
2185 yyextra->isSpecialComment =
true;
2186 yyextra->lastGuardName.clear();
2190 yyextra->isSpecialComment =
false;
2192 BEGIN(SkipCPPComment);
2197 yyextra->yyLineNr++;
2200 yyextra->expectGuard =
FALSE;
2210 YY_EXTRA_TYPE state = preYYget_extra(yyscanner);
2211 int bytesInBuf =
static_cast<int>(state->inputBuf->size())-state->inputBufPos;
2212 int bytesToCopy = std::min(max_size,bytesInBuf);
2213 memcpy(buf,state->inputBuf->data()+state->inputBufPos,bytesToCopy);
2214 state->inputBufPos+=bytesToCopy;
2218static yy_size_t
getFenceSize(
char *txt, yy_size_t leng)
2220 yy_size_t fenceSize = 0;
2221 for (
size_t i = 0; i < leng; i++)
2223 if (txt[i] !=
' ' && txt[i] !=
'*' && txt[i] !=
'\t')
break;
2226 return leng-fenceSize;
2231 YY_EXTRA_TYPE state = preYYget_extra(yyscanner);
2234 state->fileName=fi.absFilePath();
2236 if (state->yyFileDef==
nullptr)
2242 if (state->yyFileDef && state->yyFileDef->isReference()) state->yyFileDef=
nullptr;
2247 state->isSource = section.isHeader() || section.isSource();
2252 YY_EXTRA_TYPE state = preYYget_extra(yyscanner);
2253 state->levelGuard.push(
false);
2259 YY_EXTRA_TYPE state = preYYget_extra(yyscanner);
2261 if (!state->levelGuard.empty())
2263 state->levelGuard.pop();
2267 warn(state->fileName,state->yyLineNr,
"More #endif's than #if's found.");
2273 YY_EXTRA_TYPE state = preYYget_extra(yyscanner);
2274 if (state->levelGuard.empty())
2276 warn(state->fileName,state->yyLineNr,
"Found an #else without a preceding #if.");
2281 return state->levelGuard.top();
2287 YY_EXTRA_TYPE state = preYYget_extra(yyscanner);
2288 state->levelGuard.top()=value;
2294 YY_EXTRA_TYPE state = preYYget_extra(yyscanner);
2295 alreadyProcessed =
FALSE;
2296 std::unique_ptr<FileState> fs;
2299 if (fi.exists() && fi.isFile())
2304 QCString absName = fi.absFilePath();
2307 if (state->curlyCount==0)
2312 alreadyProcessed =
TRUE;
2319 alreadyProcessed = std::any_of(
2320 state->includeStack.begin(),
2321 state->includeStack.end(),
2322 [absName](
const std::unique_ptr<FileState> &lfs)
2323 { return lfs->fileName==absName; }
2326 if (alreadyProcessed)
2333 fs = std::make_unique<FileState>();
2342 fs->oldFileBuf = state->inputBuf;
2343 fs->oldFileBufPos = state->inputBufPos;
2349static std::unique_ptr<FileState>
findFile(
yyscan_t yyscanner,
const QCString &fileName,
bool localInclude,
bool &alreadyProcessed)
2351 YY_EXTRA_TYPE state = preYYget_extra(yyscanner);
2362 else if (alreadyProcessed)
2367 if (localInclude && !state->fileName.isEmpty())
2369 FileInfo fi(state->fileName.str());
2380 else if (alreadyProcessed)
2386 if (state->pathList.empty())
2390 for (
auto path : state->pathList)
2392 QCString absName = path+
"/"+fileName;
2402 else if (alreadyProcessed)
2435 if (i>=0 && s[i]==
'*')
2438 while (i>0 && !(s[i-1]==
'/' && s[i]==
'*')) i--;
2445 return ((s[i+1]==
'*' || s[i+1]==
'!') && s[i+2]==
'<') ? &s[i-1] :
"";
2477 bool inString=
FALSE;
2482 if (!inString && !inChar)
2484 while (i<s.
length() && !inString && !inChar)
2505 while (i<s.
length() && inChar)
2526 while (i<s.
length() && inString)
2555 std::string e = expr.
str();
2556 static const reg::Ex r(R
"(\s*##\s*)");
2565 const auto &match = *it;
2566 size_t n = match.position();
2567 size_t l = match.length();
2569 if (n+l+1<e.length() && e[
static_cast<int>(n+l)]==
'@' && expr[
static_cast<int>(n+l+1)]==
'-')
2576 e=e.substr(0,n)+e.substr(n+l);
2577 int k=
static_cast<int>(n)-1;
2578 while (k>=0 &&
isId(e[k])) k--;
2579 if (k>0 && e[k]==
'-' && e[k-1]==
'@')
2582 e=e.substr(0,k-1)+e.substr(k+1);
2600 struct yyguts_t * yyg = (
struct yyguts_t*)yyscanner;
2608 while ((cc=
getNextChar(yyscanner,expr,rest,pos))!=EOF && cc!=0)
2624 int &cc, uint32_t &j,
int &len)
2626 bool changed =
false;
2631 while ((cc=
getCurrentChar(yyscanner,expr,rest,j))!=EOF && cc!=
'\n' && isspace(cc))
2639 int prevChar =
'\0';
2641 if ((cc=
getCurrentChar(yyscanner,expr,rest,j))!=EOF && cc ==
'*')
2643 while ((cc=
getNextChar(yyscanner,expr,rest,j))!=EOF && cc!=0)
2645 if (cc ==
'/' && prevChar ==
'*')
break;
2648 if (cc != EOF) changed =
true;
2661 int vl =
static_cast<int>(vaStr.
length());
2662 while ((vo = vaStr.
find(
"__VA_OPT__(",vp))!=-1)
2664 bool hasHash = vo>0 && vaStr.
at(vo-1)==
'#';
2667 result+=vaStr.
mid(vp,vo-vp-1);
2672 result+=vaStr.
mid(vp,vo-vp);
2676 while (bc>0 && ve<vl)
2678 if (vaStr[ve]==
')') bc--;
2679 else if (vaStr[ve]==
'(') bc++;
2683 if (bc==0 && hasOptionalArgs)
2695 result+=vaStr.
mid(vp);
2727 std::map<std::string,std::string> argTable;
2730 int argCountNonEmpty=0;
2736 while ((cc=
getNextChar(yyscanner,expr,rest,j))!=EOF && cc!=0)
2744 while (!done && (argCount<def->nargs || def->
varArgs) &&
2745 ((cc=
getNextChar(yyscanner,expr,rest,j))!=EOF && cc!=0)
2754 while ((cc=
getNextChar(yyscanner,expr,rest,j))!=EOF && cc!=0)
2758 if (c==
'\'' || c==
'\"')
2780 else if (c==
')' || c==
',')
2793 argKey.
sprintf(
"@%d",argCount++);
2794 if (c==
',' || !arg.
isEmpty()) argCountNonEmpty++;
2808 while (!found && (cc=
getNextChar(yyscanner,expr,rest,j))!=EOF && cc!=0)
2815 if ((cc=
getNextChar(yyscanner,expr,rest,j))==EOF || cc==0)
break;
2825 while (!found && (cc=
getNextChar(yyscanner,expr,rest,j))!=EOF && cc!=0)
2832 if ((cc=
getNextChar(yyscanner,expr,rest,j))==EOF || cc==0)
break;
2840 char prevChar =
'\0';
2844 while ((cc=
getNextChar(yyscanner,expr,rest,j))!=EOF && cc!=0)
2848 if (c ==
'/' && prevChar ==
'*')
break;
2861 if (argCount==def->
nargs ||
2872 bool inString=
FALSE;
2882 else if (d.
at(k+1)==
'-')
2893 if (l>=0 && d.
at(l)==
'"') l--;
2894 while (l>=0 && d.
at(l)==
' ') l--;
2895 if (l>0 && d.
at(l)==
'#' && d.
at(l-1)==
'#') hash=
TRUE;
2898 while (k<d.
length() && d.
at(k)>=
'0' && d.
at(k)<=
'9') key+=d.
at(k++);
2903 if (l<(
int)d.
length() && d.
at(l)==
'"') l++;
2904 while (l<(
int)d.
length() && d.
at(l)==
' ') l++;
2905 if (l<(
int)d.
length()-1 && d.
at(l)==
'#' && d.
at(l+1)==
'#') hash=
TRUE;
2908 auto it = argTable.find(key.
str());
2909 if (it!=argTable.end())
2929 if (hash && substArg.
isEmpty())
2940 if (!inString && d.
at(k)==
'\"')
2944 else if (k>2 && inString && d.
at(k)==
'\"' && (d.
at(k-1)!=
'\\' || d.
at(k-2)==
'\\'))
2968 while (p<(
int)expr.
length())
2970 char c=expr.
at(p++);
2975 else if (isalpha(c) || c==
'_')
2985 if (p<(
int)expr.
length()) c=expr.
at(p);
2986 while (p<(
int)expr.
length() && (c!=
'"' || (pc==
'\\' && ppc!=
'\\')))
2994 if (p<(
int)expr.
length()) ++p;
3000 if (p<(
int)expr.
length())
3006 while (p<(
int)expr.
length() && !(pc==
'*' && c==
'/'))
3019#define MAX_EXPANSION_DEPTH 50
3023 YY_EXTRA_TYPE state = preYYget_extra(yyscanner);
3024 if (!state->nospaces)
3027 char ccPrev = pos==0 || (int)expr.
length()<pos ? state->prevChar : expr.
at(pos-1);
3028 QCString leftSpace = ccPrev!=
':' && ccPrev!=
' ' ?
" " :
"";
3033 uint32_t j=(uint32_t)resultExpr.
length();
3034 while ((ccNext=
getNextChar(yyscanner,resultExpr,
nullptr,j))!=EOF && ccNext==
' ') { }
3035 if (ccNext != EOF)
unputChar(yyscanner,resultExpr,
nullptr,j,(
char)ccNext);
3039 ccNext=restExpr.
at(0);
3042 QCString rightSpace = ccNext!=
':' && ccNext!=
' ' ?
" " :
"";
3045 resultExpr=leftSpace+resultExpr+rightSpace;
3055 struct yyguts_t * yyg = (
struct yyguts_t*)yyscanner;
3056 YY_EXTRA_TYPE state = preYYget_extra(yyscanner);
3063 if (state->expanded.find(expr.
str())!=state->expanded.end() &&
3071 state->expanded.insert(expr.
str());
3075 bool definedTest=
FALSE;
3076 int i=pos, l=0, p=0, len=0;
3081 bool replaced=
FALSE;
3083 macroName=expr.
mid(p,l);
3088 expr=expr.
left(p)+resultExpr+restExpr;
3090 else if (p<2 || !(expr.
at(p-2)==
'@' && expr.
at(p-1)==
'-'))
3092 if (state->expandedDict.find(macroName.
str())==state->expandedDict.end())
3094 bool expanded=
false;
3098 if (yyextra->expandOnlyPredef && def && !def->
isPredefined) def=
nullptr;
3099 if (macroName==
"defined")
3104 else if (definedTest)
3106 if (def) expMacro =
" 1 ";
else expMacro =
" 0 ";
3111 else if (def && def->
nargs==-1)
3120 else if (def && def->
nargs>=0)
3131 resultExpr=expMacro;
3138 state->expandedDict.emplace(
toStdString(macroName),def);
3140 state->expandedDict.erase(
toStdString(macroName));
3149 expr=expr.
left(p)+resultExpr+restExpr;
3205 if (inputStr==
nullptr)
return inputStr;
3206 char term = *inputStr;
3207 if (
term!=
'\'' &&
term!=
'"')
return inputStr;
3212 while ((c=*inputStr))
3241 static const std::vector<std::string> signs = {
"signed",
"unsigned" };
3242 struct TypeInfo { std::string name;
size_t size; };
3243 static const std::vector<TypeInfo> types = {
3244 {
"short int",
sizeof(
short int) },
3245 {
"long long int",
sizeof(
long long int) },
3246 {
"long int",
sizeof(
long int) },
3247 {
"long long",
sizeof(
long long) },
3248 {
"long double",
sizeof(
long double) },
3249 {
"int",
sizeof(int) },
3250 {
"short",
sizeof(short) },
3251 {
"bool",
sizeof(bool) },
3252 {
"long",
sizeof(long) },
3253 {
"char",
sizeof(char) },
3254 {
"float",
sizeof(float) },
3255 {
"double",
sizeof(double) },
3261 auto process_cast_or_sizeof = [](
const char *p) -> std::pair<const char *,size_t>
3264 while (*q==
' ' || *q==
'\t') q++;
3266 size_t size =
sizeof(int);
3267 for (
const auto &sgn : signs)
3269 if (
qstrncmp(q,sgn.c_str(),sgn.length())==0) { q+=sgn.length(); found=
true; }
3271 if (!found || *q==
' ' || *q==
'\t' || *q==
')')
3273 while (*q==
' ' || *q==
'\t') q++;
3274 for (
const auto &t : types)
3276 if (
qstrncmp(q,t.name.c_str(),t.name.length())==0)
3278 q += t.name.length();
3283 while (*q==
' ' || *q==
'\t') q++;
3284 if (*q==
')')
return std::make_pair(++q,size);
3286 return std::make_pair(
nullptr,0);
3291 const char *p=s.
data();
3301 const char *q = process_cast_or_sizeof(p+1).first;
3311 const char *q = p+6;
3312 while (*q==
' ' || *q==
'\t') q++;
3315 auto r = process_cast_or_sizeof(q+1);
3332 else if (*(p+1)==
'E')
3338 else if (isdigit(c))
3348 else if (c==
'd' && !inNum)
3359 while ((c=*p) &&
isId(c)) p++;
3362 else if ((isalpha(c) || c==
'_') && !inNum)
3366 while ((c=*p) &&
isId(c)) p++;
3367 while ((c=*p) && isspace((uint8_t)c)) p++;
3374 if (c==
'(') count++;
3378 if (count==0)
break;
3386 while (*p && !(pc==
'*' && c==
'/'))
3403 while (*p && !(pc==
'*' && c==
'/'))
3420 char lc=(char)tolower(c);
3437 const char *p=s.
data();
3462 while (*p && !(pc==
'*' && c==
'/'))
3464 if (*p==
'@' && *(p+1)==
'@')
3507 YY_EXTRA_TYPE state = preYYget_extra(yyscanner);
3511 state->expanded.clear();
3517 return state->constExpParser.parse(state->fileName.data(),state->yyLineNr,e.
str(),ee.
str());
3526 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
3527 YY_EXTRA_TYPE state = preYYget_extra(yyscanner);
3528 state->prevChar = yyscanner->yytext_r > YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ? *(yyscanner->yytext_r-1) : 0;
3530 state->expanded.
clear();
3540 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
3542 if (name ==
"__LINE__")
3546 else if (name ==
"__FILE__")
3549 resultExpr += yyextra->fileName;
3552 else if (name ==
"__DATE__")
3555 resultExpr += __DATE__;
3558 else if (name ==
"__TIME__")
3561 resultExpr += __TIME__;
3569 YY_EXTRA_TYPE state = preYYget_extra(yyscanner);
3571 def.
name = state->defName;
3573 def.
nargs = state->defArgs;
3575 def.
fileDef = state->yyFileDef;
3576 def.
lineNr = state->yyLineNr-state->yyMLines;
3578 def.
varArgs = state->defVarArgs;
3588 auto it = state->localDefines.find(def.
name.
str());
3589 if (it!=state->localDefines.end())
3591 state->localDefines.erase(it);
3593 state->localDefines.emplace(def.
name.
str(),def);
3598 YY_EXTRA_TYPE state = preYYget_extra(yyscanner);
3599 if (state->skip)
return;
3604 define.
lineNr = state->yyLineNr - state->yyMLines;
3606 define.
name = state->defName;
3607 define.
args = state->defArgsStr;
3608 define.
fileDef = state->inputFileDef;
3610 QCString litText = state->defLitText;
3611 int l=litText.
find(
'\n');
3621 const char *p=litText.
data()+k;
3623 while ((c=*p++) && (c==
' ' || c==
'\t')) k++;
3627 if (litTextStripped.
contains(
'\n')>=1)
3636 state->macroDefinitions.push_back(define);
3642 YY_EXTRA_TYPE state = preYYget_extra(yyscanner);
3643 if (state->includeStack.empty() || state->curlyCount>0) (*state->outputBuf)+=c;
3648 YY_EXTRA_TYPE state = preYYget_extra(yyscanner);
3649 if (state->includeStack.empty() || state->curlyCount>0) (*state->outputBuf)+=std::string_view(a,len);
3654 YY_EXTRA_TYPE state = preYYget_extra(yyscanner);
3655 if (state->includeStack.empty() || state->curlyCount>0) (*state->outputBuf)+=a.
str();
3677 struct yyguts_t * yyg = (
struct yyguts_t*)yyscanner;
3678 if (!yyextra->defContinue)
return;
3679 for (
int i=0; i< (int)yyleng; i++)
3681 if (yytext[i] ==
'\t')
3682 yyextra->defExtraSpacing+=
'\t';
3684 yyextra->defExtraSpacing+=
' ';
3690 struct yyguts_t * yyg = (
struct yyguts_t*)yyscanner;
3691 yyextra->fenceSize=0;
3693 if (yytext[1]==
'f' && ((c=yytext[2])==
'[' || c==
'{' || c==
'(' || c==
'$'))
3697 case '[': yyextra->blockName=
"]";
break;
3698 case '{': yyextra->blockName=
"}";
break;
3699 case '(': yyextra->blockName=
")";
break;
3700 case '$': yyextra->blockName=
"$";
break;
3703 yyextra->blockName=yyextra->blockName.stripWhiteSpace();
3710 yyextra->blockName=
"uml";
3714 int i = bn.
find(
'{');
3716 yyextra->blockName=bn;
3724 YY_EXTRA_TYPE state = preYYget_extra(yyscanner);
3729 (inc.
at(i)==
' ' || inc.
at(i)==
'"' || inc.
at(i)==
'<')
3734 bool localInclude = s>0 && inc.
at(s-1)==
'"';
3737 while (i<inc.
length() && inc.
at(i)!=
'"' && inc.
at(i)!=
'>') i++;
3739 if (s<inc.
length() && i>s)
3749 QCString oldFileName = state->fileName;
3750 FileDef *oldFileDef = state->yyFileDef;
3751 int oldLineNr = state->yyLineNr;
3757 std::unique_ptr<FileState> fs;
3758 bool alreadyProcessed =
FALSE;
3760 fs=
findFile(yyscanner,absIncFileName,localInclude,alreadyProcessed);
3771 for (i=0;i<state->includeStack.size();i++)
3778 if (state->includeStack.empty() && oldFileDef)
3780 PreIncludeInfo *ii = state->includeRelations.find(absIncFileName);
3785 state->includeRelations.add(
3788 ambig ?
nullptr : incFd,
3796 struct yyguts_t * yyg = (
struct yyguts_t*)yyscanner;
3797 fs->bufState = YY_CURRENT_BUFFER;
3798 fs->lineNr = oldLineNr;
3799 fs->fileName = oldFileName;
3800 fs->curlyCount = state->curlyCount;
3802 fs->lexRulesPart = state->lexRulesPart;
3803 state->lexRulesPart =
false;
3806 state->includeStack.push_back(std::move(fs));
3812 lineStr.sprintf(
"# 1 \"%s\" 1\n",
qPrint(state->fileName));
3816 state->expectGuard=
TRUE;
3817 state->inputBuf = &fs_ptr->
fileBuf;
3818 state->inputBufPos=0;
3819 yy_switch_to_buffer(yy_create_buffer(0,
YY_BUF_SIZE, yyscanner),yyscanner);
3823 if (alreadyProcessed)
3831 if (state->includeStack.empty() && oldFileDef)
3833 PreIncludeInfo *ii = state->includeRelations.find(absIncFileName);
3838 ii = state->includeRelations.add(absIncFileName,
3840 ambig ?
nullptr : incFd,
3850 for (i=0;i<state->includeStack.size();i++)
3854 if (alreadyProcessed)
3864 if (localInclude && !state->includeStack.empty() && state->curlyCount>0 && !alreadyProcessed)
3866 warn(state->fileName,state->yyLineNr,
"include file {} not found, perhaps you forgot to add its directory to INCLUDE_PATH?",incFileName);
3876 YY_EXTRA_TYPE state = preYYget_extra(yyscanner);
3879 bool expResult = prs.
parse(state->fileName.data(),state->yyLineNr,sectId.
data());
3880 state->condStack.emplace(std::make_unique<preYY_CondCtx>(state->fileName,state->yyLineNr,sectId,state->skip));
3890 YY_EXTRA_TYPE state = preYYget_extra(yyscanner);
3891 if (state->condStack.empty())
3893 warn(state->fileName,state->yyLineNr,
"the \\endcond does not have a corresponding \\cond in this file");
3898 const std::unique_ptr<preYY_CondCtx> &ctx = state->condStack.top();
3899 state->skip=ctx->skip;
3900 state->condStack.pop();
3907 YY_EXTRA_TYPE state = preYYget_extra(yyscanner);
3908 while (!state->condStack.empty())
3910 state->condStack.pop();
3921 const char *p=text.
data();
3924 if (c==
'@') result+=
"@@";
else result+=c;
3934 case '=':
return '#';
3935 case '/':
return '\\';
3936 case '\'':
return '^';
3937 case '(':
return '[';
3938 case ')':
return ']';
3939 case '!':
return '|';
3940 case '<':
return '{';
3941 case '>':
return '}';
3942 case '-':
return '~';
3956 return expr.
at(pos++);
3958 else if (rest && !rest->
isEmpty())
3967 int cc=yyinput(yyscanner);
3979 return expr.
at(pos);
3981 else if (rest && !rest->
isEmpty())
3989 int cc=yyinput(yyscanner);
4006 char cs[2];cs[0]=c;cs[1]=
'\0';
4022 YY_EXTRA_TYPE state = preYYget_extra(yyscanner);
4025 auto findDefine = [&undef,&name](
DefineMap &map)
4028 auto it = map.
find(name.
str());
4041 Define *def = findDefine(state->localDefines);
4042 if (def==
nullptr && !undef)
4044 def = findDefine(state->contextDefines);
4051 YY_EXTRA_TYPE state = preYYget_extra(yyscanner);
4055 for (
const auto &ds : predefList)
4057 size_t i_equals=ds.find(
'=');
4058 size_t i_obrace=ds.find(
'(');
4059 size_t i_cbrace=ds.find(
')');
4060 bool nonRecursive = i_equals!=std::string::npos && i_equals>0 && ds[i_equals-1]==
':';
4062 if ((i_obrace==0) || (i_equals==0) || (i_equals==1 && ds[i_equals-1]==
':'))
4067 if (i_obrace<i_equals && i_cbrace<i_equals &&
4068 i_obrace!=std::string::npos && i_cbrace!=std::string::npos &&
4072 static const reg::Ex reId(R
"(\a\w*)");
4073 std::map<std::string,int> argMap;
4074 std::string args = ds.substr(i_obrace+1,i_cbrace-i_obrace-1);
4075 bool hasVarArgs = args.find(
"...")!=std::string::npos;
4081 for (; arg_it!=arg_end; ++arg_it)
4083 argMap.emplace(arg_it->str(),count++);
4087 argMap.emplace(
"__VA_ARGS__",count++);
4091 std::string definition;
4092 std::string in=ds.substr(i_equals+1);
4098 for (; re_it!=re_end; ++re_it)
4100 const auto &
match = *re_it;
4101 size_t pi =
match.position();
4102 size_t l =
match.length();
4103 if (pi>i) definition+=in.substr(i,pi-i);
4105 auto it = argMap.find(
match.str());
4106 if (it!=argMap.end())
4108 int argIndex = it->second;
4110 marker.
sprintf(
" @%d ",argIndex);
4111 definition+=marker.
str();
4115 definition+=
match.str();
4119 definition+=in.substr(i);
4122 std::string dname = ds.substr(0,i_obrace);
4131 def.
fileDef = state->yyFileDef;
4134 state->contextDefines.emplace(def.
name.
str(),def);
4140 else if (!ds.empty())
4144 if (i_equals==std::string::npos)
4151 int ine=
static_cast<int>(i_equals) - (nonRecursive ? 1 : 0);
4152 def.
name = ds.substr(0,ine);
4160 def.
fileDef = state->yyFileDef;
4162 state->contextDefines.emplace(def.
name.
str(),def);
4178 YY_EXTRA_TYPE state = preYYget_extra(
p->yyscanner);
4180 if (fi.isDir()) state->pathList.push_back(fi.absFilePath());
4185 preYYlex_init_extra(&
p->state,&
p->yyscanner);
4191 preYYlex_destroy(
p->yyscanner);
4198 YY_EXTRA_TYPE state = preYYget_extra(
p->yyscanner);
4199 struct yyguts_t *yyg = (
struct yyguts_t*)
p->yyscanner;
4212 state->curlyCount=0;
4213 state->lexRulesPart=
false;
4214 state->nospaces=
FALSE;
4215 state->inputBuf=&input;
4216 state->inputBufPos=0;
4217 state->outputBuf=&output;
4218 state->includeStack.clear();
4219 state->expandedDict.clear();
4220 state->contextDefines.clear();
4221 state->pragmaSet.clear();
4222 while (!state->condStack.empty()) state->condStack.pop();
4226 state->inputFileDef = state->yyFileDef;
4231 state->yyLineNr = 1;
4237 state->expectGuard =
guessSection(fileName).isHeader();
4238 state->guardName.clear();
4239 state->lastGuardName.clear();
4240 state->guardExpr.clear();
4242 preYYlex(yyscanner);
4244 while (!state->condStack.empty())
4246 const std::unique_ptr<preYY_CondCtx> &ctx = state->condStack.top();
4248 if (ctx->sectionId!=
" ") sectionInfo.
sprintf(
" with label '%s' ",
qPrint(ctx->sectionId.stripWhiteSpace()));
4249 warn(ctx->fileName,ctx->lineNr,
"Conditional section{}does not have "
4250 "a corresponding \\endcond command within this file.",sectionInfo);
4251 state->condStack.pop();
4256 if (!state->levelGuard.empty())
4258 warn(state->fileName,state->yyLineNr,
"More #if's than #endif's found (might be in an included file).");
4265 std::string contents;
4273 bool startOfLine =
true;
4274 size_t content_size = output.size() +
4277 contents.reserve(content_size);
4279 while (pos<output.size())
4284 snprintf(lineNrStr,15,
"%05d ",line++);
4285 contents+=lineNrStr;
4287 contents += output[pos];
4288 startOfLine = output[pos]==
'\n';
4293 if (!contents.empty() && contents[contents.length()-1]!=
'\n')
4298 if (yyextra->contextDefines.size()>0)
4302 for (
auto &kv : yyextra->contextDefines)
4306 for (
auto &kv : yyextra->localDefines)
4320 for (
const auto &inc : state->includeRelations)
4322 auto toKind = [](
bool local,
bool imported) ->
IncludeKind
4338 if (inc->fromFileDef)
4340 inc->fromFileDef->addIncludeDependency(inc->toFileDef,inc->includeName,toKind(inc->local,inc->imported));
4342 if (inc->toFileDef && inc->fromFileDef)
4344 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)