Go to the documentation of this file.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 #ifndef _parser_h
00037 #define _parser_h
00038
00039 #ifndef _error_h
00040 #include "Error.h"
00041 #endif
00042
00043 #define YYDEBUG 1
00044 #undef YYERROR_VERBOSE
00045 #define YY_NO_UNPUT 1
00046
00047 #define ID_MAX 256
00048
00049 #ifndef TRUE
00050 #define TRUE 1
00051 #define FALSE 0
00052 #endif
00053
00054 namespace libdap
00055 {
00056
00068 struct parser_arg
00069 {
00070 void *_object;
00071 Error *_error;
00072 int _status;
00073
00074 parser_arg() : _object(0), _error(0), _status(1)
00075 {}
00076 parser_arg(void *obj) : _object(obj), _error(0), _status(1)
00077 {}
00078 virtual ~parser_arg()
00079 {
00080 if (_error) {
00081 delete _error; _error = 0;
00082 }
00083 }
00084
00085 void *object()
00086 {
00087 return _object;
00088 }
00089 void set_object(void *obj)
00090 {
00091 _object = obj;
00092 }
00093 Error *error()
00094 {
00095 return _error;
00096 }
00097 void set_error(Error *obj)
00098 {
00099 _error = obj;
00100 }
00101 int status()
00102 {
00103 return _status;
00104 }
00105 void set_status(int val = 0)
00106 {
00107 _status = val;
00108 }
00109 };
00110
00130 void parse_error(parser_arg *arg, const char *s, const int line_num = 0,
00131 const char *context = 0);
00132 void parse_error(const string &msg, const int line_num,
00133 const char *context = 0);
00135
00150 void save_str(char *dst, const char *src, const int line_num);
00151 void save_str(string &dst, const char *src, const int);
00152
00153 bool is_keyword(string id, const string &keyword);
00154
00166 int check_byte(const char *val);
00167
00175 int check_int16(const char *val);
00176 int check_uint16(const char *val);
00177 int check_int32(const char *val);
00178 int check_uint32(const char *val);
00179
00184 int check_float32(const char *val);
00185 int check_float64(const char *val);
00186
00191 int check_url(const char *val);
00192
00193 }
00194
00195 #endif // _parser_h
00196