blob: 5caeb2e90a7f4860a06a3ff9b47609ad18c81cae [file] [log] [blame]
Václav Kubernát24df80e2018-06-06 15:18:03 +02001/*
2 * Copyright (C) 2018 CESNET, https://photonics.cesnet.cz/
3 * Copyright (C) 2018 FIT CVUT, https://fit.cvut.cz/
4 *
5 * Written by Václav Kubernát <kubervac@fit.cvut.cz>
6 *
7*/
8#pragma once
9
10#include "ast_path.hpp"
11
12namespace x3 = boost::spirit::x3;
13namespace ascii = boost::spirit::x3::ascii;
14
15using ascii::space;
16using x3::_attr;
17using x3::alnum;
18using x3::alpha;
19using x3::char_;
20using x3::expect;
21using x3::lexeme;
22using x3::lit;
23
24struct parser_context_tag;
25
26using keyValue_ = std::pair<std::string, std::string>;
27
28struct cd_ : x3::position_tagged {
29 bool operator==(const cd_& b) const;
30 path_ m_path;
31};
32
33struct create_ : x3::position_tagged {
34 bool operator==(const create_& b) const;
35 path_ m_path;
36};
37
38struct delete_ : x3::position_tagged {
39 bool operator==(const delete_& b) const;
40 path_ m_path;
41};
42
43struct set_ : x3::position_tagged {
44 bool operator==(const set_& b) const;
45 path_ m_path;
46 std::string m_data;
47};
48
49using command_ = boost::variant<cd_, create_, delete_, set_>;
50
51BOOST_FUSION_ADAPT_STRUCT(cd_, m_path)
52BOOST_FUSION_ADAPT_STRUCT(create_, m_path)
53BOOST_FUSION_ADAPT_STRUCT(delete_, m_path)
54BOOST_FUSION_ADAPT_STRUCT(set_, m_path, m_data)