-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvqlcompiler.h
66 lines (48 loc) · 1.2 KB
/
vqlcompiler.h
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
#ifndef VQLCOMPILER_H
#define VQLCOMPILER_H
#include <string>
#include <vector>
#include <iostream>
#include <map>
#include <boost/spirit/home/x3.hpp>
#include <boost/fusion/adapted/struct/adapt_struct.hpp>
#include <boost/fusion/include/adapt_struct.hpp>
using namespace boost::spirit;
/*
Exemple of query :
SELECT chr, pos, ref, ann.gene_name FROM variant
SELECT chr, pos, ref, sample["boby"].gt FROM variant
SELECT chr, pos, ref, ann.gene_name FROM variant WHERE pos = 3
SELECT chr, pos, ref, sample["boby"].gt FROM variant INSIDE bed
*/
using namespace std;
struct VqlResult {
std::vector<std::string> selectData;
std::string fromData;
std::string whereData;
std::string insideData;
};
BOOST_FUSION_ADAPT_STRUCT
(
VqlResult,
selectData,
fromData,
whereData,
insideData
);
class VqlParser
{
public:
VqlParser();
bool parse(const string& source);
const string& source() const;
const string& tableName() const;
const vector<string>& columns() const;
const string& conditions() const;
const string& inside() const;
private:
string mSource;
VqlResult mResult;
};
std::ostream &operator<<(std::ostream& os, VqlParser& c);
#endif // VQLCOMPILER_H