blob: 26c718680518a319d63855897872cf4ce14daa01 (
plain) (
blame)
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
|
#pragma once
#include "defs.h"
#include <util/generic/fwd.h>
#include <util/generic/string.h>
#include <util/generic/vector.h>
#include <unordered_set>
namespace NSQLComplete {
// std::vector is used to prevent copying a C3 output
struct TSuggestedToken {
TTokenId Number;
std::vector<TTokenId> Following;
};
struct TMatchedRule {
TRuleId Index;
TParserCallStack ParserCallStack;
};
struct TC3Candidates {
TVector<TSuggestedToken> Tokens;
TVector<TMatchedRule> Rules;
};
class IC3Engine {
public:
using TPtr = THolder<IC3Engine>;
// std::unordered_set is used to prevent copying into c3 core
struct TConfig {
std::unordered_set<TTokenId> IgnoredTokens;
std::unordered_set<TRuleId> PreferredRules;
};
virtual TC3Candidates Complete(TStringBuf prefix) = 0;
virtual ~IC3Engine() = default;
};
} // namespace NSQLComplete
|