-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtokentype.h
More file actions
89 lines (79 loc) · 1.57 KB
/
Copy pathtokentype.h
File metadata and controls
89 lines (79 loc) · 1.57 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
#pragma once
#include <cf/searchstring.h>
enum TokenType {
T_INVALID = -1,
T_EOF = 0,
T_OR,
T_AND,
T_NOT,
T_OPEN_PAREN,
T_CLOSE_PAREN,
T_QUOTE,
T_WORD,
};
class QueryToken {
public:
virtual TokenType GetType() const {
return T_INVALID;
}
virtual string GetValue() const
{
return "";
}
virtual ~QueryToken() = default;
QueryToken() = default;
};
class QueryTokenWord : public QueryToken {
private:
string word;
public:
QueryTokenWord(string val) : word(val) {}
TokenType GetType() const override {
return TokenType::T_WORD;
}
string GetValue() const override {
return word;
}
};
class TokenEOF : public QueryToken {
public:
TokenType GetType() const override {
return T_EOF;
}
};
class TokenOr : public QueryToken {
public:
TokenType GetType() const override {
return T_OR;
}
};
class TokenAnd : public QueryToken {
public:
TokenType GetType() const override {
return T_AND;
}
};
class TokenNot : public QueryToken {
public:
TokenType GetType() const override {
return T_NOT;
}
};
class TokenOpenParen : public QueryToken {
public:
TokenType GetType() const override {
return T_OPEN_PAREN;
}
};
class TokenCloseParen : public QueryToken {
public:
TokenType GetType() const override {
return T_CLOSE_PAREN;
}
};
class TokenQuote : public QueryToken {
public:
TokenType GetType() const override {
return T_QUOTE;
}
};