1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-01-16 18:29:55 +00:00
openmw/components/compiler/scriptparser.hpp

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

49 lines
1.3 KiB
C++
Raw Normal View History

#ifndef COMPILER_SCRIPTPARSER_H_INCLUDED
#define COMPILER_SCRIPTPARSER_H_INCLUDED
2010-06-30 17:58:25 +00:00
#include "controlparser.hpp"
#include "lineparser.hpp"
#include "output.hpp"
#include "parser.hpp"
namespace Compiler
{
class Locals;
// Script parser, to be used in dialogue scripts and as part of FileParser
2014-02-14 11:23:00 +00:00
class ScriptParser : public Parser
{
Output mOutput;
LineParser mLineParser;
2010-06-30 17:58:25 +00:00
ControlParser mControlParser;
bool mEnd;
2014-02-14 11:23:00 +00:00
2022-09-22 18:26:05 +00:00
public:
/// \param end of script is marked by end keyword.
2014-02-14 11:23:00 +00:00
ScriptParser(ErrorHandler& errorHandler, const Context& context, Locals& locals, bool end = false);
Interpreter::Program getProgram() const;
2014-02-14 11:23:00 +00:00
bool parseName(const std::string& name, const TokenLoc& loc, Scanner& scanner) override;
///< Handle a name token.
/// \return fetch another token?
bool parseKeyword(int keyword, const TokenLoc& loc, Scanner& scanner) override;
///< Handle a keyword token.
/// \return fetch another token?
bool parseSpecial(int code, const TokenLoc& loc, Scanner& scanner) override;
///< Handle a special character token.
/// \return fetch another token?
void parseEOF(Scanner& scanner) override;
2014-02-14 11:23:00 +00:00
///< Handle EOF token.
void reset() override;
///< Reset parser to clean state.
};
}
#endif