From d2386fac9b9f1432bfe70e5a0dc295fd11febb12 Mon Sep 17 00:00:00 2001 From: BigBahss Date: Fri, 29 Jan 2021 22:05:08 -0500 Subject: [PATCH] Add functions to parse all global event scripts labels in the project --- include/core/parseutil.h | 9 ++++++++ src/core/parseutil.cpp | 50 +++++++++++++++++++++++++++++++++++++--- 2 files changed, 56 insertions(+), 3 deletions(-) diff --git a/include/core/parseutil.h b/include/core/parseutil.h index 82fad4e2..17a1cf4c 100644 --- a/include/core/parseutil.h +++ b/include/core/parseutil.h @@ -60,6 +60,9 @@ public: static int getScriptLineNumber(const QString &filePath, const QString &scriptLabel); static int getRawScriptLineNumber(QString text, const QString &scriptLabel); static int getPoryScriptLineNumber(QString text, const QString &scriptLabel); + static QStringList getGlobalScriptLabels(const QString &filePath); + static QStringList getGlobalRawScriptLabels(QString text); + static QStringList getGlobalPoryScriptLabels(QString text); static QString &removeStringLiterals(QString &text); static QString &removeLineComments(QString &text, const QString &commentSymbol); static QString &removeLineComments(QString &text, const QStringList &commentSymbols); @@ -74,6 +77,12 @@ private: QList generatePostfix(QList tokens); int evaluatePostfix(QList postfix); void error(QString message, QString expression); + + static const QRegularExpression re_incScriptLabel; + static const QRegularExpression re_globalIncScriptLabel; + static const QRegularExpression re_poryScriptLabel; + static const QRegularExpression re_globalPoryScriptLabel; + static const QRegularExpression re_poryRawSection; }; #endif // PARSEUTIL_H diff --git a/src/core/parseutil.cpp b/src/core/parseutil.cpp index 74330738..e37772e8 100644 --- a/src/core/parseutil.cpp +++ b/src/core/parseutil.cpp @@ -6,6 +6,12 @@ #include #include +const QRegularExpression ParseUtil::re_incScriptLabel("\\b(?