File: scriptcheck.hpp

package info (click to toggle)
openmw 0.49.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 33,992 kB
  • sloc: cpp: 372,479; xml: 2,149; sh: 1,403; python: 797; makefile: 26
file content (65 lines) | stat: -rw-r--r-- 1,571 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#ifndef CSM_TOOLS_SCRIPTCHECK_H
#define CSM_TOOLS_SCRIPTCHECK_H

#include <string>

#include <components/compiler/errorhandler.hpp>
#include <components/compiler/extensions.hpp>

#include <apps/opencs/model/doc/messages.hpp>

#include "../doc/stage.hpp"

#include "../world/scriptcontext.hpp"

namespace CSMDoc
{
    class Document;
}

namespace Compiler
{
    struct TokenLoc;
}

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
        };

        const CSMDoc::Document& mDocument;
        Compiler::Extensions mExtensions;
        CSMWorld::ScriptContext mContext;
        ESM::RefId mId;
        std::string mFile;
        CSMDoc::Messages* mMessages;
        WarningMode mWarningMode;
        bool mIgnoreBaseRecords;

        CSMDoc::Message::Severity getSeverity(Type type);

        void report(const std::string& message, const Compiler::TokenLoc& loc, Type type) override;
        ///< Report error to the user.

        void report(const std::string& message, Type type) override;
        ///< Report a file related error

    public:
        ScriptCheckStage(const CSMDoc::Document& document);

        int setup() override;
        ///< \return number of steps

        void perform(int stage, CSMDoc::Messages& messages) override;
        ///< Messages resulting from this tage will be appended to \a messages.
    };
}

#endif