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 <boost/shared_ptr.hpp>
5 
6 #include "node.hpp"
7 
8 namespace CSMWorld
9 {
10  class Data;
11 }
12 
13 namespace CSMFilter
14 {
15  struct Token;
16 
17  class Parser
18  {
19  boost::shared_ptr<Node> mFilter;
20  std::string mInput;
21  int mIndex;
22  bool mError;
24 
26 
28 
30 
31  Token checkKeywords (const Token& token);
33 
34  boost::shared_ptr<Node> parseImp (bool allowEmpty = false, bool ignoreOneShot = false);
36 
37  boost::shared_ptr<Node> parseNAry (const Token& keyword);
38 
39  boost::shared_ptr<Node> parseText();
40 
41  boost::shared_ptr<Node> parseValue();
42 
43  void error();
44 
45  public:
46 
47  Parser (const CSMWorld::Data& data);
48 
49  bool parse (const std::string& filter, bool allowPredefined = true);
53 
54  boost::shared_ptr<Node> getFilter() const;
56  };
57 }
58 
59 #endif
Parser(const CSMWorld::Data &data)
Definition: parser.cpp:536
Token getNumberToken()
Definition: parser.cpp:140
bool parse(const std::string &filter, bool allowPredefined=true)
Definition: parser.cpp:539
boost::shared_ptr< Node > parseValue()
Definition: parser.cpp:406
std::string mInput
Definition: parser.hpp:20
bool mError
Definition: parser.hpp:22
int mIndex
Definition: parser.hpp:21
boost::shared_ptr< Node > parseText()
Definition: parser.cpp:342
void error()
Definition: parser.cpp:531
Definition: data.hpp:77
Token getNextToken()
Definition: parser.cpp:201
const CSMWorld::Data & mData
Definition: parser.hpp:23
boost::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:17
Token checkKeywords(const Token &token)
Turn string token into keyword token, if possible.
Definition: parser.cpp:182
boost::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
boost::shared_ptr< Node > mFilter
Definition: parser.hpp:19
Definition: parser.cpp:22
Token getStringToken()
Definition: parser.cpp:96
boost::shared_ptr< Node > parseNAry(const Token &keyword)
Definition: parser.cpp:295