1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-01-24 11:23:52 +00:00
openmw/components/compiler/scriptparser.hpp

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"
2022-09-22 18:26:05 +00:00
#include "lineparser.hpp"
#include "output.hpp"
2022-09-22 18:26:05 +00:00
#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
{
2022-09-22 18:26:05 +00:00
Output mOutput;
LineParser mLineParser;
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.
ScriptParser(ErrorHandler& errorHandler, const Context& context, Locals& locals, bool end = false);
2014-02-14 11:23:00 +00:00
Interpreter::Program getProgram() const;
2014-02-14 11:23:00 +00:00
2022-09-22 18:26:05 +00:00
bool parseName(const std::string& name, const TokenLoc& loc, Scanner& scanner) override;
///< Handle a name token.
/// \return fetch another token?
2022-09-22 18:26:05 +00:00
bool parseKeyword(int keyword, const TokenLoc& loc, Scanner& scanner) override;
///< Handle a keyword token.
/// \return fetch another token?
2022-09-22 18:26:05 +00:00
bool parseSpecial(int code, const TokenLoc& loc, Scanner& scanner) override;
///< Handle a special character token.
/// \return fetch another token?
2022-09-22 18:26:05 +00:00
void parseEOF(Scanner& scanner) override;
///< Handle EOF token.
2014-02-14 11:23:00 +00:00
2022-09-22 18:26:05 +00:00
void reset() override;
///< Reset parser to clean state.
};
}
#endif