blob: 96d497989e9c76a7aeb20c612da3c5eaf2dffd26 [file] [log] [blame]
Václav Kubernát624a8872018-03-02 17:28:47 +01001/*
2 * Copyright (C) 2018 CESNET, https://photonics.cesnet.cz/
Václav Kubernátd6662962018-03-22 17:41:33 +01003 * Copyright (C) 2018 FIT CVUT, https://fit.cvut.cz/
Václav Kubernát624a8872018-03-02 17:28:47 +01004 *
5 * Written by Václav Kubernát <kubervac@fit.cvut.cz>
6 *
Václav Kubernátd6662962018-03-22 17:41:33 +01007*/
Václav Kubernát624a8872018-03-02 17:28:47 +01008
9#pragma once
10#include <boost/spirit/home/x3.hpp>
11#include "CTree.hpp"
Václav Kubernátd6662962018-03-22 17:41:33 +010012#include "ast.hpp"
Václav Kubernát624a8872018-03-02 17:28:47 +010013namespace x3 = boost::spirit::x3;
14namespace ascii = boost::spirit::x3::ascii;
15using Cmd = std::vector<std::string>;
16using x3::alpha;
17using x3::lit;
18using x3::char_;
19using x3::_attr;
20using x3::lexeme;
21using ascii::space;
22
23class TooManyArgumentsException : public std::invalid_argument {
24public:
25 using std::invalid_argument::invalid_argument;
26 ~TooManyArgumentsException() override;
27};
28
29class CParser {
30public:
31 CParser(const CTree& tree);
Václav Kubernátd6662962018-03-22 17:41:33 +010032 cd_ parseCommand(const std::string& line);
Václav Kubernát624a8872018-03-02 17:28:47 +010033
34private:
35 const CTree& m_tree;
36};