15%option never-interactive
18%option extra-type="struct preYY_state *"
22#define YY_TYPEDEF_YY_SCANNER_T
68#define YY_NO_UNISTD_H 1
132 for (
auto &[name,define] : fromMap)
150 if (dpf && includeStack.find(incFile)==includeStack.end())
152 includeStack.insert(incFile);
159 toMap.emplace(name,define);
173 void addInclude(
const std::string &fromFileName,
const std::string &toFileName)
179 it =
m_fileMap.emplace(fromFileName,std::make_unique<DefinesPerFile>(
this)).first;
181 auto &dpf = it->second;
182 dpf->addInclude(toFileName);
191 it =
m_fileMap.emplace(fileName,std::make_unique<DefinesPerFile>(
this)).first;
193 it->second->store(fromMap);
201 auto &dpf = it->second;
202 dpf->retrieve(toMap);
212 return it->second->stored();
222 return it!=
m_fileMap.end() ? it->second.get() :
nullptr;
225 std::unordered_map< std::string, std::unique_ptr<DefinesPerFile> >
m_fileMap;
344static yy_size_t
getFenceSize(
char *txt, yy_size_t leng);
349#define YY_INPUT(buf,result,max_size) result=yyread(yyscanner,buf,max_size);
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)
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.
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 startCondSection(yyscan_t yyscanner, const QCString §Id)
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 void endCondSection(yyscan_t yyscanner)
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 int yyread(yyscan_t yyscanner, char *buf, int max_size)
static char resolveTrigraph(char c)
static const char * stateToString(int state)
static DefineManager g_defineManager
static void readIncludeFile(yyscan_t yyscanner, const QCString &inc)
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 const char * getLexerFILE()
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.
359IDSTART [a-z_A-Z\x80-\xFF]
360ID {IDSTART}[a-z_A-Z0-9\x80-\xFF]*
364RAWBEGIN (u|U|L|u8)?R\"[^ \t\(\)\\]{0,16}"("
365RAWEND ")"[^ \t\(\)\\]{0,16}\"
366CHARLIT (("'"\\[0-7]{1,3}"'")|("'"\\."'")|("'"[^'\\\n]{1,4}"'"))
369FORMULA_START {CMD}("f{"|"f$"|"f["|"f(")
370FORMULA_END {CMD}("f}"|"f$"|"f]"|"f)")
371VERBATIM_START {CMD}("verbatim"|"iliteral"|"latexonly"|"htmlonly"|"xmlonly"|"docbookonly"|"rtfonly"|"manonly"|"dot"|"msc"|"startuml"|"code"("{"[^}]*"}")?){BN}+
372VERBATIM_END {CMD}("endverbatim"|"endiliteral"|"endlatexonly"|"endhtmlonly"|"endxmlonly"|"enddocbookonly"|"endrtfonly"|"endmanonly"|"enddot"|"endmsc"|"enduml"|"endcode")
373VERBATIM_LINE {CMD}"noop"{B}+
374LITERAL_BLOCK {FORMULA_START}|{VERBATIM_START}
375LITERAL_BLOCK_END {FORMULA_END}|{VERBATIM_END}
380RulesSharp "<"[^>\n]*">"
381RulesCurly "{"[^{}\n]*"}"
386EscapeRulesCharOpen "\\["|"\<"|"\\{"|"\\("|"\\\""|"\\ "|"\\\\"
387EscapeRulesCharClose "\\]"|"\>"|"\\}"|"\\)"
388EscapeRulesChar {EscapeRulesCharOpen}|{EscapeRulesCharClose}
404DECIMAL_INTEGER [1-9][0-9']*[0-9]?[uU]?[lL]?[lL]?
405HEXADECIMAL_INTEGER "0"[xX][0-9a-zA-Z']+[0-9a-zA-Z]?
406OCTAL_INTEGER "0"[0-7][0-7']+[0-7]?
407BINARY_INTEGER "0"[bB][01][01']*[01]?
408INTEGER_NUMBER {DECIMAL_INTEGER}|{HEXADECIMAL_INTEGER}|{OCTAL_INTEGER}|{BINARY_INTEGER}
412DIGIT_SEQ [0-9][0-9']*[0-9]?
413FRAC_CONST {DIGIT_SEQ}"."|{DIGIT_SEQ}?"."{DIGIT_SEQ}
414FP_EXP [eE][+-]?{DIGIT_SEQ}
415DEC_FP1 {FRAC_CONST}{FP_EXP}?{FP_SUF}?
416DEC_FP2 {DIGIT_SEQ}{FP_EXP}{FP_SUF}
418HEX_DIGIT_SEQ [0-9a-fA-F][0-9a-fA-F']*[0-9a-fA-F]?
419HEX_FRAC_CONST {HEX_DIGIT_SEQ}"."|{HEX_DIGIT_SEQ}?"."{HEX_DIGIT_SEQ}
420BIN_EXP [pP][+-]?{DIGIT_SEQ}
421HEX_FP1 "0"[xX]{HEX_FRAC_CONST}{BIN_EXP}{FP_SUF}?
422HEX_FP2 "0"[xX]{HEX_DIGIT_SEQ}{BIN_EXP}{FP_SUF}?
424FLOAT_DECIMAL {DEC_FP1}|{DEC_FP2}
425FLOAT_HEXADECIMAL {HEX_FP1}|{HEX_FP2}
426FLOAT_NUMBER {FLOAT_DECIMAL}|{FLOAT_HEXADECIMAL}
427NUMBER {INTEGER_NUMBER}|{FLOAT_NUMBER}
443%x CopyStringFtnDouble
460%x JavaDocVerbatimCode
494 yyextra->yyColNr+=(int)yyleng;
496 yyextra->potentialDefine=yytext;
499<Start>^("%top{"|"%{") {
SrcLangExt getLanguageFromFileName(const QCString &fileName, SrcLangExt defLang)
504<Start>^{Bopt}"cpp_quote"{Bopt}"("{Bopt}\" {
505 if (yyextra->insideIDL)
520<IDLquote>"\""{Bopt}")" {
534<Start>^{B}*[a-z_A-Z\x80-\xFF][a-z_A-Z0-9\x80-\xFF]+{B}*"("[^\)\n]*")"/{BN}{1,10}*[:{] {
536 for (i=(
int)yyleng-1;i>=0;i--)
542<Start>^{B}*[_A-Z][_A-Z0-9]+{B}*"("[^\(\)\n]*"("[^\)\n]*")"[^\)\n]*")"{B}*\n |
543<Start>^{B}*[_A-Z][_A-Z0-9]+{B}*"("[^\)\n]*")"{B}*\n |
544<Start>^{B}*[_A-Z][_A-Z0-9]+{B}*"("[^\(\)\n]*"("[^\)\n]*")"[^\)\n]*")"/{B}*("//"|"/\*") |
545<Start>^{B}*[_A-Z][_A-Z0-9]+{B}*"("[^\)\n]*")"/{B}*("//"|"/\*") {
548 int pos = name.find(
'(');
550 name=name.left(pos).stripWhiteSpace();
553 if (skipFuncMacros && !yyextra->insideFtn &&
554 name!=
"Q_PROPERTY" &&
556 (yyextra->includeStack.empty() || yyextra->curlyCount>0) &&
557 yyextra->macroExpansion &&
565 if (yytext[yyleng-1] ==
'\n')
574 for (i=(
int)yyleng-1;i>=0;i--)
#define Config_getBool(name)
581<CopyLine,LexCopyLine>"extern"{BN}*"\""[^\"]+"\""{BN}*("{")? {
583 yyextra->yyLineNr+=text.
contains(
'\n');
int contains(char c, bool cs=TRUE) const
586<CopyLine,LexCopyLine>{RAWBEGIN} {
589 BEGIN(CopyRawString);
QCString extractBeginRawStringDelimiter(const char *rawStart)
591<CopyLine,LexCopyLine>"{" {
592 if (yyextra->includeStack.empty())
594 yyextra->curlyCount++;
601<CopyLine,LexCopyLine>"}" {
602 if (yyextra->includeStack.empty() && yyextra->curlyCount>0)
604 yyextra->curlyCount--;
608<CopyLine,LexCopyLine>"'"\\[0-7]{1,3}"'" {
611<CopyLine,LexCopyLine>"'"\\."'" {
614<CopyLine,LexCopyLine>"'"."'" {
617<CopyLine,LexCopyLine>[$]?@\" {
620 BEGIN( CopyStringCs );
622<CopyLine,LexCopyLine>\" {
630 BEGIN( CopyStringFtnDouble );
633<CopyLine,LexCopyLine>\' {
636 BEGIN( CopyStringFtn );
638<CopyString>[^\"\\\r\n]{1,1000} {
641<CopyStringCs>[^\"\r\n]{1,1000} {
650<CopyString,CopyStringCs>\" {
654<CopyStringFtnDouble>[^\"\\\r\n]{1,1000} {
657<CopyStringFtnDouble>\\. {
660<CopyStringFtnDouble>\" {
664<CopyStringFtn>[^\'\\\r\n]{1,1000} {
674<CopyRawString>{RAWEND} {
QCString extractEndRawStringDelimiter(const char *rawEnd)
681<CopyRawString>[^)]{1,1000} {
687<CopyLine,LexCopyLine>{ID}/{BN}{0,80}"(" {
688 yyextra->expectGuard =
FALSE;
698 if ((yyextra->includeStack.empty() || yyextra->curlyCount>0) &&
699 yyextra->macroExpansion &&
705 yyextra->roundCount=0;
706 yyextra->defArgsStr=yytext;
716 yyextra->findDefArgContext = CopyLine;
717 BEGIN(FindDefineArgs);
725<CopyLine>{RulesDelim} {
727 yyextra->lexRulesPart = !yyextra->lexRulesPart;
731<CopyLine>{RulesSharp} {
732 if (!yyextra->lexRulesPart) REJECT;
733 if (yyextra->curlyCount) REJECT;
737<RulesPattern>{EscapeRulesChar} {
740<RulesPattern>{RulesCurly} {
743<RulesPattern>{StartDouble} {
745 yyextra->lastContext = YY_START;
748<RulesDouble,RulesRoundDouble>"\\\\" {
751<RulesDouble,RulesRoundDouble>"\\\"" {
756 BEGIN( yyextra->lastContext ) ;
758<RulesRoundDouble>"\"" {
762<RulesDouble,RulesRoundDouble>. {
765<RulesPattern>{StartSquare} {
767 yyextra->lastContext = YY_START;
770<RulesSquare,RulesRoundSquare>{CHARCE} {
773<RulesSquare,RulesRoundSquare>"\\[" |
774<RulesSquare,RulesRoundSquare>"\\]" {
781<RulesRoundSquare>"]" {
785<RulesSquare,RulesRoundSquare>"\\\\" {
788<RulesSquare,RulesRoundSquare>. {
791<RulesPattern>{StartRoundQuest} {
793 yyextra->lastContext = YY_START;
794 BEGIN(RulesRoundQuest);
796<RulesRoundQuest>{nl} {
799<RulesRoundQuest>[^)] {
802<RulesRoundQuest>")" {
804 BEGIN(yyextra->lastContext);
806<RulesPattern>{StartRound} {
807 yyextra->roundCount++;
809 yyextra->lastContext = YY_START;
812<RulesRound>{RulesCurly} {
815<RulesRound>{StartSquare} {
817 BEGIN(RulesRoundSquare);
819<RulesRound>{StartDouble} {
821 BEGIN(RulesRoundDouble);
823<RulesRound>{EscapeRulesChar} {
827 yyextra->roundCount++;
831 yyextra->roundCount--;
833 if (!yyextra->roundCount) BEGIN( yyextra->lastContext ) ;
852<CopyLine,LexCopyLine>{ID} {
854 if ((yyextra->includeStack.empty() || yyextra->curlyCount>0) &&
855 yyextra->macroExpansion &&
871<CopyLine,LexCopyLine>"\\"\r?/\n {
874<CopyLine,LexCopyLine>\\. {
877<CopyLine,LexCopyLine>. {
880<CopyLine,LexCopyLine>\n {
887 yyextra->defArgsStr+=
'(';
888 yyextra->roundCount++;
891 yyextra->defArgsStr+=
')';
892 yyextra->roundCount--;
893 if (yyextra->roundCount==0)
897 if (yyextra->findDefArgContext==CopyLine)
900 BEGIN(yyextra->findDefArgContext);
905 yyextra->nospaces=
FALSE;
915<FindDefineArgs>{CHARLIT} {
916 yyextra->defArgsStr+=yytext;
918<FindDefineArgs>{CCS}[*!]? {
919 yyextra->defArgsStr+=yytext;
920 BEGIN(ArgCopyCComment);
922<FindDefineArgs>{CPPC}[/!].*\n/{B}*{CPPC}[/!] {
927 yyextra->defArgsStr+=
QCString(
"/**< @brief ")+&yytext[4];
931 yyextra->defArgsStr+=
QCString(
"/** @brief ")+&yytext[3];
936 yyextra->defArgsStr+=
QCString(
"/**")+&yytext[3];
938 BEGIN(ArgCopyCppComment);
940<FindDefineArgs>{CPPC}[/!].*\n {
943 yyextra->defArgsStr+=
QCString(
"/**")+&yytext[3]+
" */";
949 yyextra->defArgsStr+=
QCString(
"/**< @brief ")+&yytext[4]+
" */";
953 yyextra->defArgsStr+=
QCString(
"/** @brief ")+&yytext[3]+
" */";
957<FindDefineArgs>{CPPC}.*\n {
958 yyextra->defArgsStr+=
QCString(
"/*")+&yytext[2]+
" */";
961 yyextra->defArgsStr+=*yytext;
966 yyextra->defArgsStr+=*yytext;
970 yyextra->defArgsStr+=
' ';
975 yyextra->defArgsStr+=
"@@";
978 yyextra->defArgsStr+=*yytext;
980<ArgCopyCComment>[^*\n]+ {
981 yyextra->defArgsStr+=yytext;
983<ArgCopyCComment>{CCE} {
984 yyextra->defArgsStr+=yytext;
985 BEGIN(FindDefineArgs);
988 yyextra->defArgsStr+=yytext;
992 yyextra->defArgsStr+=yytext;
994<ArgCopyCppComment>^{B}*
995<ArgCopyCppComment>{CPPC}[/!].*\n/{B}*{CPPC}[/!] {
996 const char *startContent = &yytext[3];
997 if (startContent[0]==
'<') startContent++;
998 yyextra->defArgsStr+=startContent;
1000<ArgCopyCppComment>{CPPC}[/!].*\n {
1001 const char *startContent = &yytext[3];
1002 if (startContent[0]==
'<') startContent++;
1003 yyextra->defArgsStr+=
QCString(startContent)+
" */";
1004 BEGIN(FindDefineArgs);
1006<ArgCopyCppComment>. {
1008 yyextra->defArgsStr+=
" */";
1009 BEGIN(FindDefineArgs);
1012 yyextra->defArgsStr+=*yytext;
1013 BEGIN(FindDefineArgs);
1017 yyextra->defArgsStr+=*yytext;
1018 BEGIN(FindDefineArgs);
1021<ReadString>{CPPC}|{CCS} {
1022 yyextra->defArgsStr+=yytext;
1024<ReadString>\\/\r?\n {
1027 yyextra->defArgsStr+=yytext;
1030 yyextra->defArgsStr+=*yytext;
1032<Command>("include"|"import"){B}+/{ID} {
1033 yyextra->isImported = yytext[1]==
'm';
1034 if (yyextra->macroExpansion)
1037<Command>("include"|"import"){B}*[<"] {
1038 yyextra->isImported = yytext[1]==
'm';
1040 c[0]=yytext[yyleng-1];c[1]=
'\0';
1044<Command>("cmake")?"define"{B}+ {
1045 yyextra->potentialDefine +=
substitute(yytext,
"cmake",
" ");
1047 yyextra->yyColNr+=(int)yyleng;
QCString substitute(const QCString &s, const QCString &src, const QCString &dst)
substitute all occurrences of src in s by dst
1050<Command>"cmakedefine01"{B}+ {
1051 yyextra->potentialDefine +=
substitute(yytext,
"cmakedefine01",
" define ");
1053 yyextra->yyColNr+=(int)yyleng;
1054 BEGIN(CmakeDefName01);
1056<Command>"ifdef"/{B}*"(" {
1058 yyextra->guardExpr.clear();
1059 BEGIN(DefinedExpr2);
1061<Command>"ifdef"/{B}+ {
1064 yyextra->guardExpr.clear();
1065 BEGIN(DefinedExpr1);
1067<Command>"ifndef"/{B}*"(" {
1069 yyextra->guardExpr=
"! ";
1070 BEGIN(DefinedExpr2);
1072<Command>"ifndef"/{B}+ {
1074 yyextra->guardExpr=
"! ";
1075 BEGIN(DefinedExpr1);
1077<Command>"if"/[ \t(!] {
1079 yyextra->guardExpr.clear();
1082<Command>("elif"|"else"{B}*"if")/[ \t(!] {
1085 yyextra->guardExpr.clear();
1091 BEGIN(SkipCPPBlock);
1094<Command>"else"/[^a-z_A-Z0-9\x80-\xFF] {
1098 BEGIN(SkipCPPBlock);
1105<Command>"undef"{B}+ {
1108<Command>("elif"|"else"{B}*"if")/[ \t(!] {
1111 yyextra->guardExpr.clear();
1115<Command>"endif"/[^a-z_A-Z0-9\x80-\xFF] {
1119<Command,IgnoreLine>\n {
1122 yyextra->yyLineNr++;
1124<Command>"pragma"{B}+"once" {
1125 yyextra->expectGuard =
FALSE;
1126 if (yyextra->pragmaSet.find(yyextra->fileName.str())!=yyextra->pragmaSet.end())
1133 yyextra->pragmaSet.insert(yyextra->fileName.data());
1138<PragmaOnce><<EOF>> {
1139 yyextra->expectGuard =
FALSE;
1145<IgnoreLine>\\[\r]?\n {
1147 yyextra->yyLineNr++;
1150<Command>. { yyextra->potentialDefine += yytext[0]==
'\t' ?
'\t' :
' ';
1151 yyextra->yyColNr+=(int)yyleng;
1167 yyextra->guardExpr+=
' ';
1168 yyextra->yyLineNr++;
1170<Guard>"defined"/{B}*"(" {
1171 BEGIN(DefinedExpr2);
1173<Guard>"defined"/{B}+ {
1174 BEGIN(DefinedExpr1);
1176<Guard>"true"/{B}|{B}*[\r]?\n { yyextra->guardExpr+=
"1L"; }
1177<Guard>"false"/{B}|{B}*[\r]?\n { yyextra->guardExpr+=
"0L"; }
1178<Guard>"not"/{B} { yyextra->guardExpr+=
'!'; }
1179<Guard>"not_eq"/{B} { yyextra->guardExpr+=
"!="; }
1180<Guard>"and"/{B} { yyextra->guardExpr+=
"&&"; }
1181<Guard>"or"/{B} { yyextra->guardExpr+=
"||"; }
1182<Guard>"bitand"/{B} { yyextra->guardExpr+=
"&"; }
1183<Guard>"bitor"/{B} { yyextra->guardExpr+=
"|"; }
1184<Guard>"xor"/{B} { yyextra->guardExpr+=
"^"; }
1185<Guard>"compl"/{B} { yyextra->guardExpr+=
"~"; }
1186<Guard>{ID} { yyextra->guardExpr+=yytext; }
1187<Guard>"@" { yyextra->guardExpr+=
"@@"; }
1188<Guard>. { yyextra->guardExpr+=*yytext; }
1202 BEGIN(SkipCPPBlock);
1205<DefinedExpr1,DefinedExpr2>\\\n { yyextra->yyLineNr++;
outputChar(yyscanner,
'\n'); }
1207 if (
isDefined(yyscanner,yytext) || yyextra->guardName==yytext)
1208 yyextra->guardExpr+=
" 1L ";
1210 yyextra->guardExpr+=
" 0L ";
1211 yyextra->lastGuardName=yytext;
1215 if (
isDefined(yyscanner,yytext) || yyextra->guardName==yytext)
1216 yyextra->guardExpr+=
" 1L ";
1218 yyextra->guardExpr+=
" 0L ";
1219 yyextra->lastGuardName=yytext;
1221<DefinedExpr1,DefinedExpr2>\n {
1222 yyextra->yyLineNr++;
1224 BEGIN(SkipCPPBlock);
1229<DefinedExpr1,DefinedExpr2>.
1230<SkipCPPBlock>^{B}*"#" { BEGIN(SkipCommand); }
1231<SkipCPPBlock>^{Bopt}/[^#] { BEGIN(SkipLine); }
1232<SkipCPPBlock>\n { yyextra->yyLineNr++;
outputChar(yyscanner,
'\n'); }
1234<SkipCommand>"if"(("n")?("def"))?/[ \t(!] {
1239<SkipCommand>"else" {
1248<SkipCommand>("elif"|"else"{B}*"if")/[ \t(!] {
1249 if (yyextra->ifcount==0)
1253 yyextra->guardExpr.clear();
1254 yyextra->lastGuardName.clear();
1259 BEGIN(SkipCPPBlock);
1263<SkipCommand>"endif" {
1264 yyextra->expectGuard =
FALSE;
1266 if (--yyextra->ifcount<0)
1274 yyextra->yyLineNr++;
1275 BEGIN(SkipCPPBlock);
1282<SkipLine>{CHARLIT} { }
1287<SkipString>{CPPC}/[^\n]* {
1289<SkipLine,SkipCommand,SkipCPPBlock>{CPPC}[^\n]* {
1290 yyextra->lastCPPContext=YY_START;
1291 BEGIN(RemoveCPPComment);
1293<SkipString>{CCS}/[^\n]* {
1295<SkipLine,SkipCommand,SkipCPPBlock>{CCS}/[^\n]* {
1296 yyextra->lastCContext=YY_START;
1297 BEGIN(RemoveCComment);
1301 yyextra->yyLineNr++;
1302 BEGIN(SkipCPPBlock);
1304<SkipString>[^"\\\n]+ { }
1310<IncludeID>{ID}{Bopt}/"(" {
1311 yyextra->nospaces=
TRUE;
1312 yyextra->roundCount=0;
1313 yyextra->defArgsStr=yytext;
1314 yyextra->findDefArgContext = IncludeID;
1315 BEGIN(FindDefineArgs);
1318 yyextra->nospaces=
TRUE;
1322<Include>[^\">\n]+[\">] {
1323 yyextra->incName+=yytext;
1324 if (yyextra->isImported)
1334<EndImport>{ENDIMPORTopt}/\n {
1338<EndImport>\\[\r]?"\n" {
1340 yyextra->yyLineNr++;
1344<DefName>{ID}/("\\\n")*"(" {
1346 yyextra->argMap.clear();
1347 yyextra->defArgs = 0;
1348 yyextra->defArgsStr.clear();
1349 yyextra->defText.clear();
1350 yyextra->defLitText.clear();
1351 yyextra->defName = yytext;
1352 yyextra->defVarArgs =
FALSE;
1353 yyextra->defExtraSpacing.clear();
1354 yyextra->defContinue =
false;
1357<DefName>{ID}{B}+"1"/[ \r\t\n] {
1359 yyextra->argMap.clear();
1360 yyextra->defArgs = -1;
1361 yyextra->defArgsStr.clear();
1363 yyextra->defVarArgs =
FALSE;
1366 if (yyextra->curlyCount>0 || yyextra->defName!=yyextra->lastGuardName || !yyextra->expectGuard)
1368 QCString def = yyextra->potentialDefine +
1371 outputSpaces(yyscanner,yytext+yyextra->defName.length());
1372 yyextra->quoteArg=
FALSE;
1373 yyextra->insideComment=
FALSE;
1374 yyextra->lastGuardName.clear();
1375 yyextra->defText=
"1";
1376 yyextra->defLitText=
"1";
1382 yyextra->defText.clear();
1383 yyextra->defLitText.clear();
1386 yyextra->expectGuard=
FALSE;
QCString stripWhiteSpace() const
returns a copy of this string with leading and trailing whitespace removed
QCString left(size_t len) const
1388<DefName,CmakeDefName01>{ID}/{B}*"\n" {
1389 yyextra->argMap.clear();
1390 yyextra->defArgs = -1;
1391 yyextra->defName = yytext;
1392 yyextra->defArgsStr.clear();
1393 yyextra->defText.clear();
1394 yyextra->defLitText.clear();
1395 yyextra->defVarArgs =
FALSE;
1398 if (yyextra->curlyCount>0 || yyextra->defName!=yyextra->lastGuardName || !yyextra->expectGuard)
1400 QCString def = yyextra->potentialDefine + yyextra->defName;
1402 yyextra->quoteArg=
FALSE;
1403 yyextra->insideComment=
FALSE;
1404 if (YY_START == CmakeDefName01) yyextra->defText =
"0";
1405 else if (yyextra->insideCS) yyextra->defText=
"1";
1411 yyextra->guardName = yytext;
1412 yyextra->lastGuardName.clear();
1415 yyextra->expectGuard=
FALSE;
1419 yyextra->argMap.clear();
1420 yyextra->defArgs = -1;
1421 yyextra->defArgsStr.clear();
1422 yyextra->defText.clear();
1423 yyextra->defLitText.clear();
1424 yyextra->defName = yytext;
1425 yyextra->defVarArgs =
FALSE;
1426 QCString def = yyextra->potentialDefine +
1428 yyextra->defArgsStr ;
1430 yyextra->quoteArg=
FALSE;
1431 yyextra->insideComment=
FALSE;
1435 yyextra->defExtraSpacing+=
"\n";
1436 yyextra->defContinue =
true;
1437 yyextra->yyLineNr++;
1439<DefineArg>{B}* { yyextra->defExtraSpacing+=yytext; }
1440<DefineArg>","{B}* { yyextra->defArgsStr+=yytext; }
1441<DefineArg>"("{B}* { yyextra->defArgsStr+=yytext; }
1442<DefineArg>{B}*")"{B}* {
1444 yyextra->defArgsStr+=yytext;
1445 QCString def = yyextra->potentialDefine +
1447 yyextra->defArgsStr +
1448 yyextra->defExtraSpacing ;
1450 yyextra->quoteArg=
FALSE;
1451 yyextra->insideComment=
FALSE;
1455 yyextra->defVarArgs =
TRUE;
1456 yyextra->defArgsStr+=yytext;
1457 yyextra->argMap.emplace(std::string(
"__VA_ARGS__"),yyextra->defArgs);
1460<DefineArg>{ID}{B}*("..."?) {
1463 yyextra->defVarArgs = yytext[yyleng-1]==
'.';
1464 if (yyextra->defVarArgs)
1469 yyextra->defArgsStr+=yytext;
1470 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)
1486<DefineText>{CCS}[!*]? {
1487 yyextra->defText+=yytext;
1488 yyextra->defLitText+=yytext;
1489 yyextra->lastCContext=YY_START;
1490 yyextra->commentCount=1;
1491 BEGIN(CopyCComment);
1493<DefineText>{CPPC}[!/]? {
1495 yyextra->lastCPPContext=YY_START;
1496 yyextra->defLitText+=
' ';
1497 BEGIN(SkipCPPComment);
1499<SkipCComment>[/]?{CCE} {
1500 if (yytext[0]==
'/')
outputChar(yyscanner,
'/');
1502 if (--yyextra->commentCount<=0)
1504 if (yyextra->lastCContext==Start)
1508 YY_CURRENT_BUFFER->yy_at_bol=1;
1510 BEGIN(yyextra->lastCContext);
1513<SkipCComment>{CPPC}("/")* {
1516<SkipCComment>{CCS} {
1520<SkipCond>{CMD}{CMD} { }
1521<SkipCond>^({B}*"*"+)?{B}{0,3}"~~~"[~]* {
1523 if (!markdownSupport || !yyextra->isSpecialComment)
1529 yyextra->fenceChar=
'~';
1531 BEGIN(SkipCondVerbatim);
1534<SkipCond>^({B}*"*"+)?{B}{0,3}"```"[`]* {
1536 if (!markdownSupport || !yyextra->isSpecialComment)
1542 yyextra->fenceChar=
'`';
1544 BEGIN(SkipCondVerbatim);
1547<SkipCComment>^({B}*"*"+)?{B}{0,3}"~~~"[~]* {
1549 if (!markdownSupport || !yyextra->isSpecialComment)
1556 yyextra->fenceChar=
'~';
1558 BEGIN(SkipVerbatim);
1561<SkipCComment>^({B}*"*"+)?{B}{0,3}"```"[`]* {
1563 if (!markdownSupport || !yyextra->isSpecialComment)
1570 yyextra->fenceChar=
'`';
1572 BEGIN(SkipVerbatim);
1575<SkipCComment>{CMD}{VERBATIM_LINE} |
1576<SkipCComment>{CMD}{LITERAL_BLOCK} {
1580<SkipCComment>{VERBATIM_LINE}.*/\n {
1583<SkipCComment>{LITERAL_BLOCK} {
1587 BEGIN(SkipVerbatim);
1589<SkipCond>{CMD}{CMD}"cond"[ \t]+ {}
1590<SkipCond>{CMD}"cond"/\n |
1591<SkipCond>{CMD}"cond"[ \t]+ {
1595<SkipCComment>"{"[ \t]*"@code"/[ \t\n] {
1597 yyextra->javaBlock=1;
1598 BEGIN(JavaDocVerbatimCode);
1600<SkipCComment>"{"[ \t]*"@literal"/[ \t\n] {
1602 yyextra->javaBlock=1;
1603 BEGIN(JavaDocVerbatimCode);
1605<SkipCComment,SkipCPPComment>{CMD}{CMD}"cond"[ \t\n]+ {
1608<SkipCPPComment>{CMD}"cond"[ \t]+ {
1609 yyextra->ccomment=
TRUE;
1610 yyextra->condCtx=YY_START;
1613<SkipCComment>{CMD}"cond"[ \t]+ {
1614 yyextra->ccomment=
FALSE;
1615 yyextra->condCtx=YY_START;
1618<CondLineC,CondLineCpp>[!()&| \ta-z_A-Z0-9\x80-\xFF.\-]+ {
1622 if (YY_START==CondLineC)
1626 yyextra->ccomment=
TRUE;
1630 yyextra->ccomment=
FALSE;
1636 BEGIN(yyextra->condCtx);
1639<CondLineC,CondLineCpp>. {
1644 if (YY_START==CondLineC)
1648 yyextra->ccomment=
TRUE;
1652 yyextra->ccomment=
FALSE;
1658 BEGIN(yyextra->condCtx);
1661<SkipCComment,SkipCPPComment>{CMD}"cond"{WSopt}/\n {
1662 if (YY_START==SkipCComment)
1664 yyextra->ccomment=
TRUE;
1670 yyextra->ccomment=
FALSE;
1672 yyextra->condCtx=YY_START;
1676<SkipCond>\n { yyextra->yyLineNr++;
outputChar(yyscanner,
'\n'); }
1677<SkipCond>{VERBATIM_LINE}.*/\n { }
1678<SkipCond>{LITERAL_BLOCK} {
1680 yyextra->yyLineNr+=numNLs;
1681 for (
int i = 0; i < numNLs; i++)
outputChar(yyscanner,
'\n');
1683 BEGIN(SkipCondVerbatim);
1687<SkipCond>[^\/\!*\\@\n]+ { }
1688<SkipCond>{CPPC}[/!] { yyextra->ccomment=
FALSE; }
1689<SkipCond>{CCS}[*!] { yyextra->ccomment=
TRUE; }
1690<SkipCond,SkipCComment,SkipCPPComment>{CMD}{CMD}"endcond"/[^a-z_A-Z0-9\x80-\xFF] {
1696<SkipCond>{CMD}"endcond"/[^a-z_A-Z0-9\x80-\xFF] {
1697 bool oldSkip = yyextra->skip;
1699 if (oldSkip && !yyextra->skip)
1701 if (yyextra->ccomment)
1705 BEGIN(yyextra->condCtx);
1708<SkipCComment,SkipCPPComment>{CMD}"endcond"/[^a-z_A-Z0-9\x80-\xFF] {
1709 bool oldSkip = yyextra->skip;
1711 if (oldSkip && !yyextra->skip)
1713 BEGIN(yyextra->condCtx);
1716<SkipCondVerbatim>{LITERAL_BLOCK_END} {
1717 if (yytext[1]==
'f' && yyextra->blockName==&yytext[2])
1721 else if (&yytext[4]==yyextra->blockName)
1726<SkipVerbatim>{LITERAL_BLOCK_END} {
1728 if (yytext[1]==
'f' && yyextra->blockName==&yytext[2])
1730 BEGIN(SkipCComment);
1732 else if (&yytext[4]==yyextra->blockName)
1734 BEGIN(SkipCComment);
1737<SkipCondVerbatim>^({B}*"*"+)?{B}{0,3}"~~~"[~]* {
1738 if (yyextra->fenceSize==
getFenceSize(yytext,yyleng) && yyextra->fenceChar==
'~')
1743<SkipCondVerbatim>^({B}*"*"+)?{B}{0,3}"```"[`]* {
1744 if (yyextra->fenceSize==
getFenceSize(yytext,yyleng) && yyextra->fenceChar==
'`')
1749<SkipVerbatim>^({B}*"*"+)?{B}{0,3}"~~~"[~]* {
1751 if (yyextra->fenceSize==
getFenceSize(yytext,yyleng) && yyextra->fenceChar==
'~')
1753 BEGIN(SkipCComment);
1756<SkipVerbatim>^({B}*"*"+)?{B}{0,3}"```"[`]* {
1758 if (yyextra->fenceSize==
getFenceSize(yytext,yyleng) && yyextra->fenceChar==
'`')
1760 BEGIN(SkipCComment);
1763<SkipCondVerbatim>{CCE}|{CCS} { }
1764<SkipVerbatim>{CCE}|{CCS} {
1767<JavaDocVerbatimCode>"{" {
1768 if (yyextra->javaBlock==0)
1774 yyextra->javaBlock++;
1778<JavaDocVerbatimCode>"}" {
1779 if (yyextra->javaBlock==0)
1785 yyextra->javaBlock--;
1786 if (yyextra->javaBlock==0)
1789 BEGIN(SkipCComment);
1797<JavaDocVerbatimCode>\n {
1800<JavaDocVerbatimCode>. {
1803<SkipCondVerbatim>[^{*\\@\x06~`\n\/]+ { }
1804<SkipCComment,SkipVerbatim>[^{*\\@\x06~`\n\/]+ {
1807<SkipCComment,SkipVerbatim,SkipCondVerbatim>\n {
1808 yyextra->yyLineNr++;
1811<SkipCondVerbatim>. { }
1812<SkipCComment,SkipVerbatim>. {
1815<CopyCComment>[^*a-z_A-Z\x80-\xFF\n]*[^*a-z_A-Z\x80-\xFF\\\n] {
1816 yyextra->defLitText+=yytext;
1817 yyextra->defText+=
escapeAt(yytext);
1819<CopyCComment>\\[\r]?\n {
1820 yyextra->defLitText+=yytext;
1821 yyextra->defText+=
" ";
1822 yyextra->yyLineNr++;
1823 yyextra->yyMLines++;
1825<CopyCComment>{CCE} {
1826 yyextra->defLitText+=yytext;
1827 yyextra->defText+=yytext;
1828 BEGIN(yyextra->lastCContext);
1831 yyextra->yyLineNr++;
1832 yyextra->defLitText+=yytext;
1833 yyextra->defText+=
' ';
1835<RemoveCComment>{CCE}{B}*"#" {
1836 if (yyextra->lastCContext==SkipCPPBlock)
1845<RemoveCComment>{CCE} { BEGIN(yyextra->lastCContext); }
1846<RemoveCComment>{CPPC}
1847<RemoveCComment>{CCS}
1848<RemoveCComment>[^*\x06\n]+
1849<RemoveCComment>\n { yyextra->yyLineNr++;
outputChar(yyscanner,
'\n'); }
1851<SkipCPPComment>[^\n\/\\@]+ {
1854<SkipCPPComment,RemoveCPPComment>\n {
1856 BEGIN(yyextra->lastCPPContext);
1858<SkipCPPComment>{CCS} {
1861<SkipCPPComment>{CPPC} {
1864<SkipCPPComment>[^\x06\@\\\n]+ {
1870<RemoveCPPComment>{CCS}
1871<RemoveCPPComment>{CPPC}
1872<RemoveCPPComment>[^\x06\n]+
1874<DefineText>"#"/{IDSTART} {
1876 yyextra->quoteArg=
TRUE;
1877 yyextra->idStart=
true;
1878 yyextra->defLitText+=yytext;
1880<DefineText,CopyCComment>{ID} {
1881 yyextra->defLitText+=yytext;
1882 if (YY_START == DefineText)
outputSpaces(yyscanner,yytext);
1883 if (yyextra->quoteArg)
1885 yyextra->defText+=
"\"";
1887 if (yyextra->defArgs>0)
1889 auto it = yyextra->argMap.find(yytext);
1890 if (it!=yyextra->argMap.end())
1893 yyextra->defText+=
'@';
1898 if (yyextra->idStart)
1900 warn(yyextra->fileName,yyextra->yyLineNr,
1901 "'#' is not followed by a macro parameter '{}': '{}'",
1902 yyextra->defName,yyextra->defLitText.stripWhiteSpace());
1904 yyextra->defText+=yytext;
1909 yyextra->defText+=yytext;
1911 if (yyextra->quoteArg)
1913 yyextra->defText+=
"\"";
1915 yyextra->quoteArg=
FALSE;
1916 yyextra->idStart=
false;
QCString & setNum(short n)
#define warn(file, line, fmt,...)
1919 yyextra->defLitText+=yytext;
1920 yyextra->defText+=yytext;
1922<DefineText>\\[\r]?\n {
1923 yyextra->defLitText+=yytext;
1926 yyextra->defText +=
' ';
1927 yyextra->yyLineNr++;
1928 yyextra->yyMLines++;
1932 yyextra->defText = yyextra->defText.stripWhiteSpace();
1933 if (yyextra->defText.startsWith(
"##"))
1935 warn(yyextra->fileName,yyextra->yyLineNr,
1936 "'##' cannot occur at the beginning of a macro definition '{}': '{}'",
1937 yyextra->defName,yyextra->defLitText.stripWhiteSpace());
1939 else if (yyextra->defText.endsWith(
"##"))
1941 warn(yyextra->fileName,yyextra->yyLineNr,
1942 "'##' cannot occur at the end of a macro definition '{}': '{}'",
1943 yyextra->defName,yyextra->defLitText.stripWhiteSpace());
1945 else if (yyextra->defText.endsWith(
"#"))
1947 warn(yyextra->fileName,yyextra->yyLineNr,
1948 "expected formal parameter after # in macro definition '{}': '{}'",
1949 yyextra->defName,yyextra->defLitText.stripWhiteSpace());
1954 yyextra->defLitText=yyextra->defLitText.left(yyextra->defLitText.length()-
comment.length()-1);
1957 yyextra->defLitText+=yytext;
1960 if (yyextra->includeStack.empty() || yyextra->curlyCount>0)
1964 def=
isDefined(yyscanner,yyextra->defName);
1978 def->
name = yyextra->defName;
1980 def->
nargs = yyextra->defArgs;
1982 def->
lineNr = yyextra->yyLineNr-yyextra->yyMLines;
1987 if (def->
fileName != yyextra->fileName && !yyextra->expandOnlyPredef)
addDefine(yyscanner);
1991 yyextra->argMap.clear();
1992 yyextra->yyLineNr++;
1994 yyextra->lastGuardName.clear();
1998 yyextra->defText +=
' ';
1999 yyextra->defLitText+=yytext;
2002 yyextra->defText +=
"##";
2003 yyextra->defLitText+=yytext;
2006 yyextra->defText +=
"@@";
2007 yyextra->defLitText+=yytext;
2011 yyextra->defText += *yytext;
2012 yyextra->defLitText+=yytext;
2013 if (!yyextra->insideComment)
2015 BEGIN(SkipDoubleQuote);
2018<DefineText>{NUMBER} {
2020 yyextra->defText += yytext;
2021 yyextra->defLitText+=yytext;
2025 yyextra->defText += *yytext;
2026 yyextra->defLitText+=yytext;
2027 if (!yyextra->insideComment)
2029 BEGIN(SkipSingleQuote);
2032<SkipDoubleQuote>{CPPC}[/]? {
outputSpaces(yyscanner,yytext);
2033 yyextra->defText += yytext;
2034 yyextra->defLitText+=yytext;
2036<SkipDoubleQuote>{CCS}[*]? {
outputSpaces(yyscanner,yytext);
2037 yyextra->defText += yytext;
2038 yyextra->defLitText+=yytext;
2040<SkipDoubleQuote>\" {
2042 yyextra->defText += *yytext;
2043 yyextra->defLitText+=yytext;
2046<SkipSingleQuote,SkipDoubleQuote>\\. {
2048 yyextra->defText += yytext;
2049 yyextra->defLitText+=yytext;
2051<SkipSingleQuote>\' {
2053 yyextra->defText += *yytext;
2054 yyextra->defLitText+=yytext;
2057<SkipDoubleQuote,SkipSingleQuote>. {
outputSpace(yyscanner,yytext[0]);
2058 yyextra->defText += *yytext;
2059 yyextra->defLitText += *yytext;
2062 yyextra->defText += *yytext;
2063 yyextra->defLitText += *yytext;
2066 TRACE(
"End of include file");
2068 if (yyextra->includeStack.empty())
2070 TRACE(
"Terminating scanner");
2075 QCString toFileName = yyextra->fileName;
2076 const std::unique_ptr<FileState> &fs=yyextra->includeStack.back();
2078 YY_BUFFER_STATE oldBuf = YY_CURRENT_BUFFER;
2079 yy_switch_to_buffer( fs->bufState, yyscanner );
2080 yy_delete_buffer( oldBuf, yyscanner );
2081 yyextra->yyLineNr = fs->lineNr;
2083 yyextra->inputBuf = fs->oldFileBuf;
2084 yyextra->inputBufPos = fs->oldFileBufPos;
2085 yyextra->curlyCount = fs->curlyCount;
2087 TRACE(
"switching to {}",yyextra->fileName);
2092 lineStr.sprintf(
"# %d \"%s\" 2",yyextra->yyLineNr,
qPrint(yyextra->fileName));
2095 yyextra->includeStack.pop_back();
2118 for (
const auto &kv : yyextra->localDefines)
2120 auto pair = yyextra->contextDefines.insert(kv);
2123 yyextra->contextDefines.erase(pair.first);
2124 yyextra->contextDefines.insert(kv);
2127 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)
2132 if (YY_START==SkipVerbatim || YY_START == SkipCondVerbatim || YY_START==SkipCond || YY_START==IDLquote || YY_START == PragmaOnce)
2139 yyextra->lastCContext=YY_START;
2140 yyextra->commentCount=1;
2143 yyextra->isSpecialComment =
true;
2144 yyextra->lastGuardName.clear();
2148 yyextra->isSpecialComment =
false;
2150 BEGIN(SkipCComment);
2154 if (YY_START==SkipVerbatim || YY_START == SkipCondVerbatim || YY_START==SkipCond ||
getLanguageFromFileName(yyextra->fileName)==SrcLangExt::Fortran || YY_START==IDLquote || YY_START == PragmaOnce)
2158 else if (YY_START==RulesRoundDouble)
2165 yyextra->lastCPPContext=YY_START;
2168 yyextra->isSpecialComment =
true;
2169 yyextra->lastGuardName.clear();
2173 yyextra->isSpecialComment =
false;
2175 BEGIN(SkipCPPComment);
2180 yyextra->yyLineNr++;
2183 yyextra->expectGuard =
FALSE;
2193 YY_EXTRA_TYPE state = preYYget_extra(yyscanner);
2194 int bytesInBuf =
static_cast<int>(state->inputBuf->size())-state->inputBufPos;
2195 int bytesToCopy = std::min(max_size,bytesInBuf);
2196 memcpy(buf,state->inputBuf->data()+state->inputBufPos,bytesToCopy);
2197 state->inputBufPos+=bytesToCopy;
2203 yy_size_t fenceSize = 0;
2204 for (
size_t i = 0; i < leng; i++)
2206 if (txt[i] !=
' ' && txt[i] !=
'*' && txt[i] !=
'\t')
break;
2209 return leng-fenceSize;
2214 YY_EXTRA_TYPE state = preYYget_extra(yyscanner);
2219 if (state->yyFileDef==
nullptr)
2225 if (state->yyFileDef && state->yyFileDef->isReference()) state->yyFileDef=
nullptr;
2230 state->isSource = section.isHeader() || section.isSource();
2235 YY_EXTRA_TYPE state = preYYget_extra(yyscanner);
2236 state->levelGuard.push(
false);
2242 YY_EXTRA_TYPE state = preYYget_extra(yyscanner);
2244 if (!state->levelGuard.empty())
2246 state->levelGuard.pop();
2250 warn(state->fileName,state->yyLineNr,
"More #endif's than #if's found.");
2256 YY_EXTRA_TYPE state = preYYget_extra(yyscanner);
2257 if (state->levelGuard.empty())
2259 warn(state->fileName,state->yyLineNr,
"Found an #else without a preceding #if.");
2264 return state->levelGuard.top();
2270 YY_EXTRA_TYPE state = preYYget_extra(yyscanner);
2271 state->levelGuard.top()=value;
2277 YY_EXTRA_TYPE state = preYYget_extra(yyscanner);
2278 alreadyProcessed =
FALSE;
2279 std::unique_ptr<FileState> fs;
2290 if (state->curlyCount==0)
2295 alreadyProcessed =
TRUE;
2302 alreadyProcessed = std::any_of(
2303 state->includeStack.begin(),
2304 state->includeStack.end(),
2305 [absName](
const std::unique_ptr<FileState> &lfs)
2306 { return lfs->fileName==absName; }
2309 if (alreadyProcessed)
2316 fs = std::make_unique<FileState>();
2325 fs->oldFileBuf = state->inputBuf;
2326 fs->oldFileBufPos = state->inputBufPos;
2334 YY_EXTRA_TYPE state = preYYget_extra(yyscanner);
2345 else if (alreadyProcessed)
2350 if (localInclude && !state->fileName.isEmpty())
2352 FileInfo fi(state->fileName.str());
2363 else if (alreadyProcessed)
2369 if (state->pathList.empty())
2373 for (
auto path : state->pathList)
2375 QCString absName = path+
"/"+fileName;
2385 else if (alreadyProcessed)
2418 if (i>=0 && s[i]==
'*')
2421 while (i>0 && !(s[i-1]==
'/' && s[i]==
'*')) i--;
2428 return ((s[i+1]==
'*' || s[i+1]==
'!') && s[i+2]==
'<') ? &s[i-1] :
"";
2460 bool inString=
FALSE;
2465 if (!inString && !inChar)
2467 while (i<s.
length() && !inString && !inChar)
2488 while (i<s.
length() && inChar)
2509 while (i<s.
length() && inString)
2538 std::string e = expr.
str();
2539 static const reg::Ex r(R
"(\s*##\s*)");
2548 const auto &match = *it;
2549 size_t n = match.position();
2550 size_t l = match.length();
2552 if (n+l+1<e.length() && e[
static_cast<int>(n+l)]==
'@' && expr[
static_cast<int>(n+l+1)]==
'-')
2559 e=e.substr(0,n)+e.substr(n+l);
2560 int k=
static_cast<int>(n)-1;
2561 while (k>=0 &&
isId(e[k])) k--;
2562 if (k>0 && e[k]==
'-' && e[k-1]==
'@')
2565 e=e.substr(0,k-1)+e.substr(k+1);
2583 struct yyguts_t * yyg = (
struct yyguts_t*)yyscanner;
2591 while ((cc=
getNextChar(yyscanner,expr,rest,pos))!=EOF && cc!=0)
2593 if (cc==
'\\') arg+=(char)cc,cc=
getNextChar(yyscanner,expr,rest,pos);
2594 else if (cc==
term)
return;
2600 int &cc, uint32_t &j,
int &len)
2602 bool changed =
false;
2607 while ((cc=
getCurrentChar(yyscanner,expr,rest,j))!=EOF && cc!=
'\n' && isspace(cc))
2615 int prevChar =
'\0';
2617 if ((cc=
getCurrentChar(yyscanner,expr,rest,j))!=EOF && cc ==
'*')
2619 while ((cc=
getNextChar(yyscanner,expr,rest,j))!=EOF && cc!=0)
2621 if (cc ==
'/' && prevChar ==
'*')
break;
2624 if (cc != EOF) changed =
true;
2657 std::map<std::string,std::string> argTable;
2665 while ((cc=
getNextChar(yyscanner,expr,rest,j))!=EOF && cc!=0)
2673 while (!done && (argCount<def->nargs || def->
varArgs) &&
2674 ((cc=
getNextChar(yyscanner,expr,rest,j))!=EOF && cc!=0)
2683 while ((cc=
getNextChar(yyscanner,expr,rest,j))!=EOF && cc!=0)
2687 if (c==
'\'' || c==
'\"')
2707 else if (c==
')' || c==
',')
2717 argKey.
sprintf(
"@%d",argCount++);
2732 while (!found && (cc=
getNextChar(yyscanner,expr,rest,j))!=EOF && cc!=0)
2739 if ((cc=
getNextChar(yyscanner,expr,rest,j))==EOF || cc==0)
break;
2749 while (!found && (cc=
getNextChar(yyscanner,expr,rest,j))!=EOF && cc!=0)
2756 if ((cc=
getNextChar(yyscanner,expr,rest,j))==EOF || cc==0)
break;
2764 char prevChar =
'\0';
2768 while ((cc=
getNextChar(yyscanner,expr,rest,j))!=EOF && cc!=0)
2772 if (c ==
'/' && prevChar ==
'*')
break;
2785 if (argCount==def->
nargs ||
2794 bool inString=
FALSE;
2804 else if (d.
at(k+1)==
'-')
2815 if (l>=0 && d.
at(l)==
'"') l--;
2816 while (l>=0 && d.
at(l)==
' ') l--;
2817 if (l>0 && d.
at(l)==
'#' && d.
at(l-1)==
'#') hash=
TRUE;
2820 while (k<d.
length() && d.
at(k)>=
'0' && d.
at(k)<=
'9') key+=d.
at(k++);
2825 if (l<(
int)d.
length() && d.
at(l)==
'"') l++;
2826 while (l<(
int)d.
length() && d.
at(l)==
' ') l++;
2827 if (l<(
int)d.
length()-1 && d.
at(l)==
'#' && d.
at(l+1)==
'#') hash=
TRUE;
2830 auto it = argTable.find(key.
str());
2831 if (it!=argTable.end())
2851 if (hash && substArg.
isEmpty())
2862 if (!inString && d.
at(k)==
'\"')
2866 else if (k>2 && inString && d.
at(k)==
'\"' && (d.
at(k-1)!=
'\\' || d.
at(k-2)==
'\\'))
2890 while (p<(
int)expr.
length())
2892 char c=expr.
at(p++);
2897 else if (isalpha(c) || c==
'_')
2907 if (p<(
int)expr.
length()) c=expr.
at(p);
2908 while (p<(
int)expr.
length() && (c!=
'"' || (pc==
'\\' && ppc!=
'\\')))
2916 if (p<(
int)expr.
length()) ++p;
2922 if (p<(
int)expr.
length())
2928 while (p<(
int)expr.
length() && !(pc==
'*' && c==
'/'))
2941#define MAX_EXPANSION_DEPTH 50
2945 YY_EXTRA_TYPE state = preYYget_extra(yyscanner);
2946 if (!state->nospaces)
2949 char ccPrev = pos==0 || (int)expr.
length()<pos ? state->prevChar : expr.
at(pos-1);
2950 QCString leftSpace = ccPrev!=
':' && ccPrev!=
' ' ?
" " :
"";
2955 uint32_t j=(uint32_t)resultExpr.
length();
2956 while ((ccNext=
getNextChar(yyscanner,resultExpr,
nullptr,j))!=EOF && ccNext==
' ') { }
2957 if (ccNext != EOF)
unputChar(yyscanner,resultExpr,
nullptr,j,(
char)ccNext);
2961 ccNext=restExpr.
at(0);
2964 QCString rightSpace = ccNext!=
':' && ccNext!=
' ' ?
" " :
"";
2967 resultExpr=leftSpace+resultExpr+rightSpace;
2977 struct yyguts_t * yyg = (
struct yyguts_t*)yyscanner;
2978 YY_EXTRA_TYPE state = preYYget_extra(yyscanner);
2985 if (state->expanded.find(expr.
str())!=state->expanded.end() &&
2993 state->expanded.insert(expr.
str());
2997 bool definedTest=
FALSE;
2998 int i=pos, l=0, p=0, len=0;
3003 bool replaced=
FALSE;
3004 macroName=expr.
mid(p,l);
3006 if (p<2 || !(expr.
at(p-2)==
'@' && expr.
at(p-1)==
'-'))
3008 if (state->expandedDict.find(macroName.
str())==state->expandedDict.end())
3013 if (yyextra->expandOnlyPredef && def && !def->
isPredefined) def=
nullptr;
3014 if (macroName==
"defined")
3019 else if (definedTest)
3021 if (def) expMacro =
" 1 ";
else expMacro =
" 0 ";
3026 else if (def && def->
nargs==-1)
3035 else if (def && def->
nargs>=0)
3052 bool expanded=
false;
3055 state->expandedDict.emplace(
toStdString(macroName),def);
3057 state->expandedDict.erase(
toStdString(macroName));
3066 expr=expr.
left(p)+resultExpr+restExpr;
3122 if (inputStr==
nullptr)
return inputStr;
3123 char term = *inputStr;
3124 if (
term!=
'\'' &&
term!=
'"')
return inputStr;
3129 while ((c=*inputStr))
3158 static const std::vector<std::string> signs = {
"signed",
"unsigned" };
3159 struct TypeInfo { std::string name;
size_t size; };
3160 static const std::vector<TypeInfo> types = {
3161 {
"short int",
sizeof(
short int) },
3162 {
"long long int",
sizeof(
long long int) },
3163 {
"long int",
sizeof(
long int) },
3164 {
"long long",
sizeof(
long long) },
3165 {
"long double",
sizeof(
long double) },
3166 {
"int",
sizeof(int) },
3167 {
"short",
sizeof(short) },
3168 {
"bool",
sizeof(bool) },
3169 {
"long",
sizeof(long) },
3170 {
"char",
sizeof(char) },
3171 {
"float",
sizeof(float) },
3172 {
"double",
sizeof(double) },
3178 auto process_cast_or_sizeof = [](
const char *p) -> std::pair<const char *,size_t>
3181 while (*q==
' ' || *q==
'\t') q++;
3183 size_t size =
sizeof(int);
3184 for (
const auto &sgn : signs)
3186 if (
qstrncmp(q,sgn.c_str(),sgn.length())==0) { q+=sgn.length(); found=
true; }
3188 if (!found || *q==
' ' || *q==
'\t' || *q==
')')
3190 while (*q==
' ' || *q==
'\t') q++;
3191 for (
const auto &t : types)
3193 if (
qstrncmp(q,t.name.c_str(),t.name.length())==0)
3195 q += t.name.length();
3200 while (*q==
' ' || *q==
'\t') q++;
3201 if (*q==
')')
return std::make_pair(++q,size);
3203 return std::make_pair(
nullptr,0);
3208 const char *p=s.
data();
3218 const char *q = process_cast_or_sizeof(p+1).first;
3228 const char *q = p+6;
3229 while (*q==
' ' || *q==
'\t') q++;
3232 auto r = process_cast_or_sizeof(q+1);
3249 else if (*(p+1)==
'E')
3255 else if (isdigit(c))
3265 else if (c==
'd' && !inNum)
3276 while ((c=*p) &&
isId(c)) p++;
3279 else if ((isalpha(c) || c==
'_') && !inNum)
3283 while ((c=*p) &&
isId(c)) p++;
3284 while ((c=*p) && isspace((uint8_t)c)) p++;
3291 if (c==
'(') count++;
3295 if (count==0)
break;
3303 while (*p && !(pc==
'*' && c==
'/'))
3320 while (*p && !(pc==
'*' && c==
'/'))
3337 char lc=(char)tolower(c);
3354 const char *p=s.
data();
3379 while (*p && !(pc==
'*' && c==
'/'))
3381 if (*p==
'@' && *(p+1)==
'@')
3388 if (*p) result+=c,p++;
3415 YY_EXTRA_TYPE state = preYYget_extra(yyscanner);
3419 state->expanded.clear();
3425 return state->constExpParser.parse(state->fileName.data(),state->yyLineNr,e.
str(),ee.
str());
3434 struct yyguts_t *yyg = (
struct yyguts_t*)yyscanner;
3435 YY_EXTRA_TYPE state = preYYget_extra(yyscanner);
3436 state->prevChar = yyscanner->yytext_r > YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ? *(yyscanner->yytext_r-1) : 0;
3438 state->expanded.
clear();
3448 YY_EXTRA_TYPE state = preYYget_extra(yyscanner);
3450 def.
name = state->defName;
3452 def.
nargs = state->defArgs;
3454 def.
fileDef = state->yyFileDef;
3455 def.
lineNr = state->yyLineNr-state->yyMLines;
3457 def.
varArgs = state->defVarArgs;
3467 auto it = state->localDefines.find(def.
name.
str());
3468 if (it!=state->localDefines.end())
3470 state->localDefines.erase(it);
3472 state->localDefines.emplace(def.
name.
str(),def);
3477 YY_EXTRA_TYPE state = preYYget_extra(yyscanner);
3478 if (state->skip)
return;
3483 define.
lineNr = state->yyLineNr - state->yyMLines;
3485 define.
name = state->defName;
3486 define.
args = state->defArgsStr;
3487 define.
fileDef = state->inputFileDef;
3489 QCString litText = state->defLitText;
3490 int l=litText.
find(
'\n');
3500 const char *p=litText.
data()+k;
3502 while ((c=*p++) && (c==
' ' || c==
'\t')) k++;
3506 if (litTextStripped.
contains(
'\n')>=1)
3515 state->macroDefinitions.push_back(define);
3521 YY_EXTRA_TYPE state = preYYget_extra(yyscanner);
3522 if (state->includeStack.empty() || state->curlyCount>0) (*state->outputBuf)+=c;
3527 YY_EXTRA_TYPE state = preYYget_extra(yyscanner);
3528 if (state->includeStack.empty() || state->curlyCount>0) (*state->outputBuf)+=std::string_view(a,len);
3533 YY_EXTRA_TYPE state = preYYget_extra(yyscanner);
3534 if (state->includeStack.empty() || state->curlyCount>0) (*state->outputBuf)+=a.
str();
3556 struct yyguts_t * yyg = (
struct yyguts_t*)yyscanner;
3557 if (!yyextra->defContinue)
return;
3558 for (
int i=0; i< (int)yyleng; i++)
3560 if (yytext[i] ==
'\t')
3561 yyextra->defExtraSpacing+=
'\t';
3563 yyextra->defExtraSpacing+=
' ';
3569 struct yyguts_t * yyg = (
struct yyguts_t*)yyscanner;
3570 yyextra->fenceSize=0;
3572 if (yytext[1]==
'f' && ((c=yytext[2])==
'[' || c==
'{' || c==
'(' || c==
'$'))
3576 case '[': yyextra->blockName=
"]";
break;
3577 case '{': yyextra->blockName=
"}";
break;
3578 case '(': yyextra->blockName=
")";
break;
3579 case '$': yyextra->blockName=
"$";
break;
3582 yyextra->blockName=yyextra->blockName.stripWhiteSpace();
3589 yyextra->blockName=
"uml";
3593 int i = bn.
find(
'{');
3595 yyextra->blockName=bn;
3603 YY_EXTRA_TYPE state = preYYget_extra(yyscanner);
3608 (inc.
at(i)==
' ' || inc.
at(i)==
'"' || inc.
at(i)==
'<')
3613 bool localInclude = s>0 && inc.
at(s-1)==
'"';
3616 while (i<inc.
length() && inc.
at(i)!=
'"' && inc.
at(i)!=
'>') i++;
3618 if (s<inc.
length() && i>s)
3628 QCString oldFileName = state->fileName;
3629 FileDef *oldFileDef = state->yyFileDef;
3630 int oldLineNr = state->yyLineNr;
3636 std::unique_ptr<FileState> fs;
3637 bool alreadyProcessed =
FALSE;
3639 fs=
findFile(yyscanner,absIncFileName,localInclude,alreadyProcessed);
3650 for (i=0;i<state->includeStack.size();i++)
3657 if (state->includeStack.empty() && oldFileDef)
3659 PreIncludeInfo *ii = state->includeRelations.find(absIncFileName);
3664 state->includeRelations.add(
3667 ambig ?
nullptr : incFd,
3675 struct yyguts_t * yyg = (
struct yyguts_t*)yyscanner;
3676 fs->bufState = YY_CURRENT_BUFFER;
3677 fs->lineNr = oldLineNr;
3678 fs->fileName = oldFileName;
3679 fs->curlyCount = state->curlyCount;
3681 fs->lexRulesPart = state->lexRulesPart;
3682 state->lexRulesPart =
false;
3685 state->includeStack.push_back(std::move(fs));
3695 state->expectGuard=
TRUE;
3696 state->inputBuf = &fs_ptr->
fileBuf;
3697 state->inputBufPos=0;
3698 yy_switch_to_buffer(yy_create_buffer(0,
YY_BUF_SIZE, yyscanner),yyscanner);
3702 if (alreadyProcessed)
3710 if (state->includeStack.empty() && oldFileDef)
3712 PreIncludeInfo *ii = state->includeRelations.find(absIncFileName);
3717 ii = state->includeRelations.add(absIncFileName,
3719 ambig ?
nullptr : incFd,
3729 for (i=0;i<state->includeStack.size();i++)
3733 if (alreadyProcessed)
3743 if (localInclude && !state->includeStack.empty() && state->curlyCount>0 && !alreadyProcessed)
3745 warn(state->fileName,state->yyLineNr,
"include file {} not found, perhaps you forgot to add its directory to INCLUDE_PATH?",incFileName);
3755 YY_EXTRA_TYPE state = preYYget_extra(yyscanner);
3758 bool expResult = prs.
parse(state->fileName.data(),state->yyLineNr,sectId.
data());
3759 state->condStack.emplace(std::make_unique<preYY_CondCtx>(state->fileName,state->yyLineNr,sectId,state->skip));
3769 YY_EXTRA_TYPE state = preYYget_extra(yyscanner);
3770 if (state->condStack.empty())
3772 warn(state->fileName,state->yyLineNr,
"the \\endcond does not have a corresponding \\cond in this file");
3777 const std::unique_ptr<preYY_CondCtx> &ctx = state->condStack.top();
3778 state->skip=ctx->skip;
3779 state->condStack.pop();
3786 YY_EXTRA_TYPE state = preYYget_extra(yyscanner);
3787 while (!state->condStack.empty())
3789 state->condStack.pop();
3800 const char *p=text.
data();
3803 if (c==
'@') result+=
"@@";
else result+=c;
3813 case '=':
return '#';
3814 case '/':
return '\\';
3815 case '\'':
return '^';
3816 case '(':
return '[';
3817 case ')':
return ']';
3818 case '!':
return '|';
3819 case '<':
return '{';
3820 case '>':
return '}';
3821 case '-':
return '~';
3835 return expr.
at(pos++);
3837 else if (rest && !rest->
isEmpty())
3846 int cc=yyinput(yyscanner);
3858 return expr.
at(pos);
3860 else if (rest && !rest->
isEmpty())
3868 int cc=yyinput(yyscanner);
3885 char cs[2];cs[0]=c;cs[1]=
'\0';
3901 YY_EXTRA_TYPE state = preYYget_extra(yyscanner);
3904 auto findDefine = [&undef,&name](
DefineMap &map)
3907 auto it = map.find(name.
str());
3920 Define *def = findDefine(state->localDefines);
3921 if (def==
nullptr && !undef)
3923 def = findDefine(state->contextDefines);
3930 YY_EXTRA_TYPE state = preYYget_extra(yyscanner);
3934 for (
const auto &ds : predefList)
3936 size_t i_equals=ds.find(
'=');
3937 size_t i_obrace=ds.find(
'(');
3938 size_t i_cbrace=ds.find(
')');
3939 bool nonRecursive = i_equals!=std::string::npos && i_equals>0 && ds[i_equals-1]==
':';
3941 if ((i_obrace==0) || (i_equals==0) || (i_equals==1 && ds[i_equals-1]==
':'))
3946 if (i_obrace<i_equals && i_cbrace<i_equals &&
3947 i_obrace!=std::string::npos && i_cbrace!=std::string::npos &&
3951 static const reg::Ex reId(R
"(\a\w*)");
3952 std::map<std::string,int> argMap;
3953 std::string args = ds.substr(i_obrace+1,i_cbrace-i_obrace-1);
3954 bool hasVarArgs = args.find(
"...")!=std::string::npos;
3960 for (; arg_it!=arg_end; ++arg_it)
3962 argMap.emplace(arg_it->
str(),count++);
3966 argMap.emplace(
"__VA_ARGS__",count++);
3970 std::string definition;
3971 std::string in=ds.substr(i_equals+1);
3977 for (; re_it!=re_end; ++re_it)
3979 const auto &match = *re_it;
3980 size_t pi = match.position();
3981 size_t l = match.length();
3982 if (pi>i) definition+=in.substr(i,pi-i);
3984 auto it = argMap.find(match.str());
3985 if (it!=argMap.end())
3987 int argIndex = it->second;
3989 marker.
sprintf(
" @%d ",argIndex);
3990 definition+=marker.
str();
3994 definition+=match.str();
3998 definition+=in.substr(i);
4001 std::string dname = ds.substr(0,i_obrace);
4010 def.
fileDef = state->yyFileDef;
4013 state->contextDefines.emplace(def.
name.
str(),def);
4019 else if (!ds.empty())
4023 if (i_equals==std::string::npos)
4030 int ine=
static_cast<int>(i_equals) - (nonRecursive ? 1 : 0);
4031 def.
name = ds.substr(0,ine);
4039 def.
fileDef = state->yyFileDef;
4041 state->contextDefines.emplace(def.
name.
str(),def);
4057 YY_EXTRA_TYPE state = preYYget_extra(
p->yyscanner);
4064 preYYlex_init_extra(&
p->state,&
p->yyscanner);
4070 preYYlex_destroy(
p->yyscanner);
4077 YY_EXTRA_TYPE state = preYYget_extra(
p->yyscanner);
4078 struct yyguts_t *yyg = (
struct yyguts_t*)
p->yyscanner;
4091 state->curlyCount=0;
4092 state->lexRulesPart=
false;
4093 state->nospaces=
FALSE;
4094 state->inputBuf=&input;
4095 state->inputBufPos=0;
4096 state->outputBuf=&output;
4097 state->includeStack.clear();
4098 state->expandedDict.clear();
4099 state->contextDefines.clear();
4100 state->pragmaSet.clear();
4101 while (!state->condStack.empty()) state->condStack.pop();
4105 state->inputFileDef = state->yyFileDef;
4110 state->yyLineNr = 1;
4116 state->expectGuard =
guessSection(fileName).isHeader();
4117 state->guardName.clear();
4118 state->lastGuardName.clear();
4119 state->guardExpr.clear();
4121 preYYlex(yyscanner);
4123 while (!state->condStack.empty())
4125 const std::unique_ptr<preYY_CondCtx> &ctx = state->condStack.top();
4127 if (ctx->sectionId!=
" ") sectionInfo.
sprintf(
" with label '%s' ",
qPrint(ctx->sectionId.stripWhiteSpace()));
4128 warn(ctx->fileName,ctx->lineNr,
"Conditional section{}does not have "
4129 "a corresponding \\endcond command within this file.",sectionInfo);
4130 state->condStack.pop();
4135 if (!state->levelGuard.empty())
4137 warn(state->fileName,state->yyLineNr,
"More #if's than #endif's found (might be in an included file).");
4144 std::string contents;
4152 bool startOfLine =
true;
4153 size_t content_size = output.size() +
4156 contents.reserve(content_size);
4158 while (pos<output.size())
4163 snprintf(lineNrStr,15,
"%05d ",line++);
4164 contents+=lineNrStr;
4166 contents += output[pos];
4167 startOfLine = output[pos]==
'\n';
4172 if (!contents.empty() && contents[contents.length()-1]!=
'\n')
4177 if (yyextra->contextDefines.size()>0)
4181 for (
auto &kv : yyextra->contextDefines)
4185 for (
auto &kv : yyextra->localDefines)
4199 for (
const auto &inc : state->includeRelations)
4201 auto toKind = [](
bool local,
bool imported) ->
IncludeKind
4217 if (inc->fromFileDef)
4219 inc->fromFileDef->addIncludeDependency(inc->toFileDef,inc->includeName,toKind(inc->local,inc->imported));
4221 if (inc->toFileDef && inc->fromFileDef)
4223 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.
std::string dirPath(bool absPath=true) const
std::string absFilePath() const
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
size_t size() const
Returns the length of the string, not counting the 0-terminator.
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.
std::string str() const
Return a string representing the matching part.
static int yyread(yyscan_t yyscanner, char *buf, int max_size)
#define Config_getList(name)
static FILE * findFile(const QCString &fileName)
DirIterator end(const DirIterator &) noexcept
#define AUTO_TRACE_ADD(...)
bool isAbsolutePath(const QCString &fileName)
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 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)