1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-01-22 23:23:53 +00:00
openmw/apps/opencs/model/tools/scriptcheck.hpp

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

66 lines
1.5 KiB
C++
Raw Normal View History

2014-02-14 12:38:30 +00:00
#ifndef CSM_TOOLS_SCRIPTCHECK_H
#define CSM_TOOLS_SCRIPTCHECK_H
2022-10-19 17:02:00 +00:00
#include <string>
2014-02-14 12:38:30 +00:00
#include <components/compiler/errorhandler.hpp>
#include <components/compiler/extensions.hpp>
2022-10-19 17:02:00 +00:00
#include <apps/opencs/model/doc/messages.hpp>
2014-02-14 12:38:30 +00:00
#include "../doc/stage.hpp"
#include "../world/scriptcontext.hpp"
namespace CSMDoc
{
class Document;
}
2022-10-19 17:02:00 +00:00
namespace Compiler
{
struct TokenLoc;
}
2014-02-14 12:38:30 +00:00
namespace CSMTools
{
/// \brief VerifyStage: make sure that scripts compile
class ScriptCheckStage : public CSMDoc::Stage, private Compiler::ErrorHandler
{
enum WarningMode
{
Mode_Ignore,
Mode_Normal,
Mode_Strict
};
2022-09-22 18:26:05 +00:00
const CSMDoc::Document& mDocument;
2014-02-14 12:38:30 +00:00
Compiler::Extensions mExtensions;
CSMWorld::ScriptContext mContext;
std::string mId;
2014-02-15 12:25:38 +00:00
std::string mFile;
CSMDoc::Messages* mMessages;
WarningMode mWarningMode;
bool mIgnoreBaseRecords;
2022-09-22 18:26:05 +00:00
CSMDoc::Message::Severity getSeverity(Type type);
2022-09-22 18:26:05 +00:00
void report(const std::string& message, const Compiler::TokenLoc& loc, Type type) override;
2014-02-14 12:38:30 +00:00
///< Report error to the user.
2022-09-22 18:26:05 +00:00
void report(const std::string& message, Type type) override;
2014-02-14 12:38:30 +00:00
///< Report a file related error
2022-09-22 18:26:05 +00:00
2014-02-14 12:38:30 +00:00
public:
ScriptCheckStage(const CSMDoc::Document& document);
2022-09-22 18:26:05 +00:00
int setup() override;
2014-02-14 12:38:30 +00:00
///< \return number of steps
2022-09-22 18:26:05 +00:00
void perform(int stage, CSMDoc::Messages& messages) override;
2014-02-14 12:38:30 +00:00
///< Messages resulting from this tage will be appended to \a messages.
};
}
#endif