OpenMW
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
scriptparser.hpp
Go to the documentation of this file.
1 #ifndef COMPILER_SCRIPTPARSER_H_INCLUDED
2 #define COMPILER_SCRIPTPARSER_H_INCLUDED
3 
4 
5 #include "parser.hpp"
6 #include "lineparser.hpp"
7 #include "controlparser.hpp"
8 #include "output.hpp"
9 
10 namespace Compiler
11 {
12  class Locals;
13 
14  // Script parser, to be used in dialogue scripts and as part of FileParser
15 
16  class ScriptParser : public Parser
17  {
21  bool mEnd;
22 
23  public:
24 
26  ScriptParser (ErrorHandler& errorHandler, const Context& context, Locals& locals,
27  bool end = false);
28 
29  void getCode (std::vector<Interpreter::Type_Code>& code) const;
31 
32  virtual bool parseName (const std::string& name, const TokenLoc& loc,
33  Scanner& scanner);
36 
37  virtual bool parseKeyword (int keyword, const TokenLoc& loc, Scanner& scanner);
40 
41  virtual bool parseSpecial (int code, const TokenLoc& loc, Scanner& scanner);
44 
45  virtual void parseEOF (Scanner& scanner);
47 
48  void reset();
50  };
51 }
52 
53 #endif
54 
virtual bool parseName(const std::string &name, const TokenLoc &loc, Scanner &scanner)
Definition: scriptparser.cpp:22
void reset()
Reset parser to clean state.
Definition: scriptparser.cpp:92
Output mOutput
Definition: scriptparser.hpp:18
Definition: output.hpp:14
bool mEnd
Definition: scriptparser.hpp:21
virtual bool parseKeyword(int keyword, const TokenLoc &loc, Scanner &scanner)
Definition: scriptparser.cpp:32
Definition: context.hpp:10
ControlParser mControlParser
Definition: scriptparser.hpp:20
Location of a token in a source file.
Definition: tokenloc.hpp:10
LineParser mLineParser
Definition: scriptparser.hpp:19
ScriptParser(ErrorHandler &errorHandler, const Context &context, Locals &locals, bool end=false)
Definition: scriptparser.cpp:9
Error handling.
Definition: errorhandler.hpp:14
virtual void parseEOF(Scanner &scanner)
Handle EOF token.
Definition: scriptparser.cpp:86
Definition: controlparser.hpp:19
int code
Definition: crashcatcher.cpp:70
Parser base class.
Definition: parser.hpp:17
Definition: scriptparser.hpp:16
Local variable declarations.
Definition: locals.hpp:12
virtual bool parseSpecial(int code, const TokenLoc &loc, Scanner &scanner)
Definition: scriptparser.cpp:68
void getCode(std::vector< Interpreter::Type_Code > &code) const
store generated code in code.
Definition: scriptparser.cpp:17
Scanner.
Definition: scanner.hpp:21
const char * name
Definition: crashcatcher.cpp:59
Line parser, to be used in console scripts and as part of ScriptParser.
Definition: lineparser.hpp:20