varconf  1.0.3
Configuration library for the Worldforge system.
parse_error.cpp
1 /*
2  * parse_error.cpp - implementation of the parse error handling class
3  * Copyright (C) 2001, Stefanus Du Toit, Joseph Zupko
4  * (C) 2003-2004 Alistair Riddoch
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2.1 of the License, or (at your option) any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this library; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19  *
20  * Contact: Joseph Zupko
21  * jaz147@psu.edu
22  *
23  * 189 Reese St.
24  * Old Forge, PA 18518
25  */
26 
27 #include "parse_error.h"
28 
29 #include <iostream>
30 #include <sstream>
31 
32 namespace {
33 std::string compose(const std::string& exp, int line, int col) {
34  std::stringstream ss;
35  ss << "ParseError: Expected " << exp << " at line " << line
36  << ", column " << col << ".";
37  return ss.str();
38 }
39 }
40 
41 namespace varconf {
42 
43 ParseError::ParseError( const std::string& exp, int line, int col)
44 : std::runtime_error(compose(exp, line, col))
45 {
46 }
47 
48 ParseError::~ParseError() = default;
49 
50 
51 } // namespace varconf