ztsdb
interp_error.hpp
1 // (C) 2016 Leonardo Silvestri
2 //
3 // This file is part of ztsdb.
4 //
5 // ztsdb is free software: you can redistribute it and/or modify
6 // it under the terms of the GNU General Public License as published by
7 // the Free Software Foundation, either version 3 of the License, or
8 // (at your option) any later version.
9 //
10 // ztsdb is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 // GNU General Public License for more details.
14 //
15 // You should have received a copy of the GNU General Public License
16 // along with ztsdb. If not, see <http://www.gnu.org/licenses/>.
17 
18 
19 #ifndef INTERP_ERROR_HPP
20 #define INTERP_ERROR_HPP
21 
22 
23 #include <string>
24 #include "main_parser/location.hpp"
25 
26 
27 namespace interp {
28 
29  struct FutureException : public std::out_of_range {
30  FutureException(const std::string& what_p) : std::out_of_range(what_p) { }
31  };
32 
33  struct RemoteErrorException : public std::out_of_range {
34  RemoteErrorException(const std::string& what_p) : std::out_of_range(what_p) { }
35  };
36 
37  struct EvalException : public std::out_of_range {
38  EvalException(const std::string& what_p, const yy::location& loc_p) :
39  std::out_of_range(what_p), loc(loc_p) { }
40 
41  const yy::location loc;
42  };
43 
47  std::string errorLines(const yy::location& loc, unsigned nlinesBefore);
48 
49 
50 } // end namespace interp
51 
52 #endif
interp::FutureException
Definition: interp_error.hpp:29
yy::location
Abstract a location.
Definition: location.hpp:54
interp::RemoteErrorException
Definition: interp_error.hpp:33
location.hpp
interp
Struct and functions implementing the interpreter.
Definition: env.hpp:36
interp::errorLines
std::string errorLines(const yy::location &loc, unsigned nlinesBefore)
Definition: interp_error.cpp:46
interp::EvalException
Definition: interp_error.hpp:37