SCalc
syntax.hh
1 /*
2  syntax.hh, copyright (c) 2006 by Vincent Fourmond:
3  The class for describing syntax errors
4 
5  This program 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 2 of the License, or
8  (at your option) any later version.
9 
10  This program 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 (in the COPYING file).
14 
15 */
16 
17 namespace SCalc {
18 
26  class SyntaxError : public ParserResult {
27  protected:
28  std::string original;
29  std::string message;
30  int start;
31  int end;
32  public:
33 
35  virtual int is_syntax_error() { return 1;};
36 
37  SyntaxError(Session * s, const char * str,
38  const char *error, int st, int en);
39 
41  std::string original_string() { return original;};
43  std::string error_message() { return message;};
45  int start_pos() { return start;};
47  int end_pos() { return end;};
48 
56  virtual std::string pretty_print();
57  };
58 };
A class representing a whole session.
Definition: session.hh:75
std::string original_string()
The original string on which the error occured.
Definition: syntax.hh:41
virtual int is_syntax_error()
Yes, this is a syntax error.
Definition: syntax.hh:35
The result of an SCalc::Session::eval().
Definition: expression.hh:36
A syntax error This class represents a syntax error. You can get several informations about this erro...
Definition: syntax.hh:26
int start_pos()
The starting position.
Definition: syntax.hh:45
virtual std::string pretty_print()
Pretty prints the error message Returns a std::string containing a nice display of the error message...
std::string error_message()
The error message.
Definition: syntax.hh:43
int end_pos()
The end position.
Definition: syntax.hh:47
Definition: session.hh:45