00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046 #ifndef __EBNF_NODE_ALGO__
00047 #define __EBNF_NODE_ALGO__
00048
00049 #include <stdexcept>
00050
00051 class EbnfNode;
00052
00053 class EbnfNodeAlgoException
00054 {
00055 public:
00056
00057 EbnfNodeAlgoException (const string &message_) :
00058 message(message_),
00059 pos()
00060 {}
00061
00062 EbnfNodeAlgoException () :
00063 message("Bad option"),
00064 pos()
00065 {}
00066
00067 EbnfNodeAlgoException (const Position &pos_, const string &message_) :
00068 message(message_),
00069 pos(pos_)
00070 {}
00071
00072 virtual const char* what() const throw()
00073 {
00074 return message.c_str();
00075 }
00076
00077 virtual operator string() const
00078 {
00079 return message;
00080 }
00081
00082 const Position& where() const
00083 {
00084 return pos;
00085 }
00086
00087 protected:
00088
00089 string message;
00090 Position pos;
00091
00092 };
00093
00100 class EbnfNodeAlgo
00101 {
00102 public:
00103
00107 virtual bool operator() (EbnfNode &n) throw (EbnfNodeAlgoException) = 0;
00108 };
00109
00110 #endif