00001 /* 00002 syntax.hh, copyright (c) 2006 by Vincent Fourmond: 00003 The class for describing syntax errors 00004 00005 This program is free software; you can redistribute it and/or modify 00006 it under the terms of the GNU General Public License as published by 00007 the Free Software Foundation; either version 2 of the License, or 00008 (at your option) any later version. 00009 00010 This program is distributed in the hope that it will be useful, 00011 but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00013 GNU General Public License for more details (in the COPYING file). 00014 00015 */ 00016 00017 namespace SCalc { 00018 00026 class SyntaxError : public ParserResult { 00027 protected: 00028 std::string original; 00029 std::string message; 00030 int start; 00031 int end; 00032 public: 00033 00035 virtual int is_syntax_error() { return 1;}; 00036 00037 SyntaxError(Session * s, const char * str, 00038 const char *error, int st, int en); 00039 00041 std::string original_string() { return original;}; 00043 std::string error_message() { return message;}; 00045 int start_pos() { return start;}; 00047 int end_pos() { return end;}; 00048 00056 virtual std::string pretty_print(); 00057 }; 00058 };