8#include <QtCore/qbytearrayview.h>
19 bool displayWarnings =
true;
20 bool displayNotes =
true;
21 bool activeQtMode =
false;
22 bool qmlMacroWarningIsFatal =
false;
26 inline explicit IncludePath(
const QByteArray &_path)
27 : path(_path), isFrameworkPath(
false) {}
31 QList<IncludePath> includes;
33 std::stack<QByteArray, QByteArrayList> currentFilenames;
35 inline bool hasNext()
const {
return (index < symbols.size()); }
36 inline Token next() {
if (index >= symbols.size())
return NOTOKEN;
return symbols.at(index++).token; }
37 inline Token peek() {
if (index >= symbols.size())
return NOTOKEN;
return symbols.at(index).token; }
40 void next(Token,
const char *msg);
41 inline void prev() {--index;}
42 inline Token lookup(
int k = 1);
43 inline const Symbol &symbol_lookup(
int k = 1) {
return symbols.at(index-1+k);}
44 inline Token token() {
return symbols.at(index-1).token;}
45 inline QByteArray lexem() {
return symbols.at(index-1).lexem();}
46 inline QByteArray unquotedLexem() {
return symbols.at(index-1).unquotedLexem();}
47 inline QByteArrayView lexemView() {
return symbols.at(index-1).lexemView();}
48 inline QByteArrayView unquotedLexemView() {
return symbols.at(index-1).unquotedLexemView();}
49 inline const Symbol &symbol() {
return symbols.at(index-1);}
50 inline const Symbol &symbolAt(qsizetype idx) {
return symbols.at(idx); }
52 Q_NORETURN
void error(
const Symbol &symbol);
53 Q_NORETURN
void error(
const char *msg =
nullptr);
54 Q_NORETURN
void error(
const Symbol &symbol,
const char *msg);
55 void warning(
const char * =
nullptr);
56 void warning(
const Symbol &sym, QByteArrayView msg);
57 void note(
const char * =
nullptr);
58 void defaultErrorMsg(
const Symbol &sym);
59 void printMsg(QByteArrayView formatStringSuffix, QByteArrayView msg,
const Symbol &sym);
63inline bool Parser::test(Token token)
65 if (index < symbols.size() && symbols.at(index).token == token) {
72inline Token Parser::lookup(
int k)
74 const qsizetype l = index - 1 + k;
75 return l < symbols.size() ? symbols.at(l).token : NOTOKEN;
78inline void Parser::next(Token token)
84inline void Parser::next(Token token,
const char *msg)
bool requireCompleteTypes
void generate(FILE *out, FILE *jsonOutput)
void setDebugIncludes(bool value)
void parseDefineArguments(Macro *m)
QHash< QByteArray, QByteArray > nonlocalIncludePathResolutionCache
Symbols preprocessed(const QByteArray &filename, QFile *device)
void substituteUntilNewline(Symbols &substituted)
QList< QByteArray > frameworks
static bool preprocessOnly
static Symbols macroExpandIdentifier(Preprocessor *that, SymbolStack &symbols, int lineNum, QByteArray *macroName)
QByteArray resolveInclude(const QByteArray &filename, const QByteArray &relativeTo)
static Symbols tokenize(const QByteArray &input, int lineNum=1, TokenizeMode mode=TokenizeCpp)
static void macroExpand(Symbols *into, Preprocessor *that, const Symbols &toExpand, qsizetype &index, int lineNum, bool one, const QSet< QByteArray > &excludeSymbols=QSet< QByteArray >())
@ PreparePreprocessorStatement
@ TokenizePreprocessorStatement
The QCommandLineOption class defines a possible command-line option. \inmodule QtCore.
The QCommandLineParser class provides a means for handling the command line options.
QHash< MacroName, Macro > Macros
#define qPrintable(string)
#define QStringLiteral(str)
static QByteArray combinePath(const QString &infile, const QString &outfile)
static bool hasNext(const Symbols &symbols, int i)
static const Symbol & next(const Symbols &symbols, int &i)
int runMoc(int argc, char **argv)
static auto openFileForWriting(const QString &name)
void error(const char *msg="Invalid argument")
static QStringList argumentsFromCommandLineAndFile(const QStringList &arguments, bool &hasOptionFiles)
QByteArray composePreprocessorOutput(const Symbols &symbols)
int main(int argc, char *argv[])
[ctor_close]
Simple structure used by the Doc and DocParser classes.