blob: 4b3e1c42f62da723494daaf2e4e31ac56900db00 [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>
Václav Kubernát0a2a2e82018-05-11 13:59:12 +020011#include "grammars.hpp"
Václav Kubernát624a8872018-03-02 17:28:47 +010012namespace x3 = boost::spirit::x3;
13namespace ascii = boost::spirit::x3::ascii;
14using Cmd = std::vector<std::string>;
15using x3::alpha;
16using x3::lit;
17using x3::char_;
18using x3::_attr;
19using x3::lexeme;
20using ascii::space;
21
Václav Kubernátb96eef72018-05-04 19:10:22 +020022class InvalidCommandException : public std::invalid_argument {
23public:
24 using std::invalid_argument::invalid_argument;
25 ~InvalidCommandException() override;
26};
27
Václav Kubernát624a8872018-03-02 17:28:47 +010028class TooManyArgumentsException : public std::invalid_argument {
29public:
30 using std::invalid_argument::invalid_argument;
31 ~TooManyArgumentsException() override;
32};
33
Václav Kubernátb96eef72018-05-04 19:10:22 +020034
Václav Kubernát624a8872018-03-02 17:28:47 +010035class CParser {
36public:
37 CParser(const CTree& tree);
Václav Kubernát2315c732018-05-16 20:25:55 +020038 cd_ parseCommand(const std::string& line, std::ostream& errorStream);
Václav Kubernát624a8872018-03-02 17:28:47 +010039
40private:
41 const CTree& m_tree;
42};