utils.hpp

Go to the documentation of this file.
00001 //  This file is part of jdl_parser.
00002 //
00003 //  jdl_parser is free software: you can redistribute it and/or modify
00004 //  it under the terms of the GNU General Public License as published by
00005 //  the Free Software Foundation, either version 3 of the License, or
00006 //  (at your option) any later version.
00007 //
00008 //  jdl_parser is distributed in the hope that it will be useful,
00009 //  but WITHOUT ANY WARRANTY; without even the implied warranty of
00010 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00011 //  GNU General Public License for more details.
00012 //
00013 //  You should have received a copy of the GNU General Public License
00014 //  along with jdl_parser.  If not, see <http://www.gnu.org/licenses/>.
00015 
00016 // Copyright Simone Pellegrini 2007-2008; e-mail: motonacciu@gmail.com
00017 
00018 #ifndef JDLPARSER_UTILS_HPP_
00019 #define JDLPARSER_UTILS_HPP_
00020 
00021 #include "defs.hpp"
00022 
00023 namespace jdl{
00024 
00025 class semantic_error: public logic_error{
00026 public:
00027         semantic_error(string message): logic_error(message), where(NULL){};
00028         semantic_error(string message, char const *end): logic_error(message), where(end){};
00029         char const *where;
00030 };
00031 
00032 class parse_error: public logic_error{
00033 public:
00034         parse_error(string message_, int row_, int col_): logic_error(message_), row(row_), col(col_){}
00035         const int row;
00036         const int col;
00037 };
00038 
00039 void indent(int n, ostream &out);
00040 
00041 string open_file(string const& jdl_file);
00042 
00043 std::pair<int, int> iter2RowCol(string const& str, string const& where);
00044 
00045 }
00046 
00047 #endif /*UTILS_HPP_*/

Generated on Sun Feb 17 16:55:14 2008 for JDLParser by  doxygen 1.5.3