Václav Kubernát | 624a887 | 2018-03-02 17:28:47 +0100 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2018 CESNET, https://photonics.cesnet.cz/ |
Václav Kubernát | d666296 | 2018-03-22 17:41:33 +0100 | [diff] [blame^] | 3 | * Copyright (C) 2018 FIT CVUT, https://fit.cvut.cz/ |
Václav Kubernát | 624a887 | 2018-03-02 17:28:47 +0100 | [diff] [blame] | 4 | * |
| 5 | * Written by Václav Kubernát <kubervac@fit.cvut.cz> |
| 6 | * |
Václav Kubernát | d666296 | 2018-03-22 17:41:33 +0100 | [diff] [blame^] | 7 | */ |
Václav Kubernát | 624a887 | 2018-03-02 17:28:47 +0100 | [diff] [blame] | 8 | |
| 9 | #pragma once |
| 10 | #include <boost/spirit/home/x3.hpp> |
| 11 | #include "CTree.hpp" |
Václav Kubernát | d666296 | 2018-03-22 17:41:33 +0100 | [diff] [blame^] | 12 | #include "ast.hpp" |
Václav Kubernát | 624a887 | 2018-03-02 17:28:47 +0100 | [diff] [blame] | 13 | namespace x3 = boost::spirit::x3; |
| 14 | namespace ascii = boost::spirit::x3::ascii; |
| 15 | using Cmd = std::vector<std::string>; |
| 16 | using x3::alpha; |
| 17 | using x3::lit; |
| 18 | using x3::char_; |
| 19 | using x3::_attr; |
| 20 | using x3::lexeme; |
| 21 | using ascii::space; |
| 22 | |
| 23 | class TooManyArgumentsException : public std::invalid_argument { |
| 24 | public: |
| 25 | using std::invalid_argument::invalid_argument; |
| 26 | ~TooManyArgumentsException() override; |
| 27 | }; |
| 28 | |
| 29 | class CParser { |
| 30 | public: |
| 31 | CParser(const CTree& tree); |
Václav Kubernát | d666296 | 2018-03-22 17:41:33 +0100 | [diff] [blame^] | 32 | cd_ parseCommand(const std::string& line); |
Václav Kubernát | 624a887 | 2018-03-02 17:28:47 +0100 | [diff] [blame] | 33 | |
| 34 | private: |
| 35 | const CTree& m_tree; |
| 36 | }; |