Chatterino
FilterParser.hpp
Go to the documentation of this file.
1 #pragma once
2 
5 
6 namespace chatterino {
7 
8 class Channel;
9 
10 } // namespace chatterino
11 
12 namespace filterparser {
13 
15 
17 {
18 public:
19  FilterParser(const QString &text);
20  bool execute(const ContextMap &context) const;
21  bool valid() const;
22 
23  const QStringList &errors() const;
24  const QString debugString() const;
25  const QString filterString() const;
26 
27 private:
28  ExpressionPtr parseExpression(bool top = false);
29  ExpressionPtr parseAnd();
30  ExpressionPtr parseUnary();
31  ExpressionPtr parseParentheses();
32  ExpressionPtr parseCondition();
33  ExpressionPtr parseValue();
34  ExpressionPtr parseList();
35 
36  void errorLog(const QString &text, bool expand = false);
37 
38  QStringList parseLog_;
39  bool valid_ = true;
40 
41  QString text_;
42  Tokenizer tokenizer_;
43  ExpressionPtr builtExpression_;
44 };
45 } // namespace filterparser
std::unique_ptr< Expression > ExpressionPtr
Definition: Types.hpp:86
Definition: FilterParser.cpp:8
Definition: Tokenizer.hpp:45
ContextMap buildContextMap(const MessagePtr &m, chatterino::Channel *channel)
Definition: FilterParser.cpp:10
Definition: Application.cpp:48
Definition: FilterParser.hpp:16
QMap< QString, QVariant > ContextMap
Definition: Types.hpp:10
Definition: Channel.hpp:30
std::shared_ptr< const Message > MessagePtr
Definition: Channel.hpp:18