OpenMW
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
parser.hpp
Go to the documentation of this file.
1 #ifndef CSM_FILTER_PARSER_H
2 #define CSM_FILTER_PARSER_H
3 
4 #include "node.hpp"
5 
6 namespace CSMWorld
7 {
8  class Data;
9 }
10 
11 namespace CSMFilter
12 {
13  struct Token;
14 
15  class Parser
16  {
17  std::shared_ptr<Node> mFilter;
18  std::string mInput;
19  int mIndex;
20  bool mError;
22 
24 
26 
28 
29  Token checkKeywords (const Token& token);
31 
32  std::shared_ptr<Node> parseImp (bool allowEmpty = false, bool ignoreOneShot = false);
34 
35  std::shared_ptr<Node> parseNAry (const Token& keyword);
36 
37  std::shared_ptr<Node> parseText();
38 
39  std::shared_ptr<Node> parseValue();
40 
41  void error();
42 
43  public:
44 
45  Parser (const CSMWorld::Data& data);
46 
47  bool parse (const std::string& filter, bool allowPredefined = true);
51 
52  std::shared_ptr<Node> getFilter() const;
54  };
55 }
56 
57 #endif
Parser(const CSMWorld::Data &data)
Definition: parser.cpp:536
std::shared_ptr< Node > parseText()
Definition: parser.cpp:342
std::shared_ptr< Node > parseImp(bool allowEmpty=false, bool ignoreOneShot=false)
Will return a null-pointer, if there is nothing more to parse.
Definition: parser.cpp:238
Token getNumberToken()
Definition: parser.cpp:140
bool parse(const std::string &filter, bool allowPredefined=true)
Definition: parser.cpp:539
std::string mInput
Definition: parser.hpp:18
bool mError
Definition: parser.hpp:20
int mIndex
Definition: parser.hpp:19
std::shared_ptr< Node > parseValue()
Definition: parser.cpp:406
void error()
Definition: parser.cpp:531
std::shared_ptr< Node > parseNAry(const Token &keyword)
Definition: parser.cpp:295
Definition: data.hpp:80
Token getNextToken()
Definition: parser.cpp:201
const CSMWorld::Data & mData
Definition: parser.hpp:21
std::shared_ptr< Node > getFilter() const
Throws an exception if the last call to parse did not return true.
Definition: parser.cpp:615
Definition: parser.hpp:15
Token checkKeywords(const Token &token)
Turn string token into keyword token, if possible.
Definition: parser.cpp:182
std::shared_ptr< Node > mFilter
Definition: parser.hpp:17
Definition: parser.cpp:22
Token getStringToken()
Definition: parser.cpp:96