OpenMW
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
fileparser.hpp
Go to the documentation of this file.
1 #ifndef COMPILER_FILEPARSER_H_INCLUDED
2 #define COMPILER_FILEPARSER_H_INCLUDED
3 
4 #include "parser.hpp"
5 #include "scriptparser.hpp"
6 #include "locals.hpp"
7 #include "literals.hpp"
8 
9 namespace Compiler
10 {
11  // Top-level parser, to be used for global scripts, local scripts and targeted scripts
12 
13  class FileParser : public Parser
14  {
15  enum State
16  {
19  };
20 
23  std::string mName;
25 
26  public:
27 
28  FileParser (ErrorHandler& errorHandler, Context& context);
29 
30  std::string getName() const;
32 
33  void getCode (std::vector<Interpreter::Type_Code>& code) const;
35 
36  const Locals& getLocals() const;
38 
39  virtual bool parseName (const std::string& name, const TokenLoc& loc,
40  Scanner& scanner);
43 
44  virtual bool parseKeyword (int keyword, const TokenLoc& loc, Scanner& scanner);
47 
48  virtual bool parseSpecial (int code, const TokenLoc& loc, Scanner& scanner);
51 
52  virtual void parseEOF (Scanner& scanner);
54 
55  void reset();
57  };
58 }
59 
60 #endif
ScriptParser mScriptParser
Definition: fileparser.hpp:21
void getCode(std::vector< Interpreter::Type_Code > &code) const
store generated code in code.
Definition: fileparser.cpp:19
Definition: fileparser.hpp:17
State mState
Definition: fileparser.hpp:22
Definition: context.hpp:10
Location of a token in a source file.
Definition: tokenloc.hpp:10
Error handling.
Definition: errorhandler.hpp:14
State
Definition: fileparser.hpp:15
virtual bool parseKeyword(int keyword, const TokenLoc &loc, Scanner &scanner)
Definition: fileparser.cpp:61
Definition: fileparser.hpp:17
Definition: fileparser.hpp:13
virtual bool parseSpecial(int code, const TokenLoc &loc, Scanner &scanner)
Definition: fileparser.cpp:94
const Locals & getLocals() const
get local variable declarations.
Definition: fileparser.cpp:24
int code
Definition: crashcatcher.cpp:70
FileParser(ErrorHandler &errorHandler, Context &context)
Definition: fileparser.cpp:8
Locals mLocals
Definition: fileparser.hpp:24
virtual void parseEOF(Scanner &scanner)
Handle EOF token.
Definition: fileparser.cpp:125
Parser base class.
Definition: parser.hpp:17
std::string mName
Definition: fileparser.hpp:23
Definition: fileparser.hpp:17
Definition: scriptparser.hpp:16
Definition: fileparser.hpp:17
virtual bool parseName(const std::string &name, const TokenLoc &loc, Scanner &scanner)
Definition: fileparser.cpp:29
Definition: fileparser.hpp:18
std::string getName() const
Return script name.
Definition: fileparser.cpp:14
Local variable declarations.
Definition: locals.hpp:12
Scanner.
Definition: scanner.hpp:21
void reset()
Reset parser to clean state.
Definition: fileparser.cpp:131
const char * name
Definition: crashcatcher.cpp:59