parser.h File Reference

#include "Error.h"

Include dependency graph for parser.h:

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  parser_arg
 Pass parameters by reference to a parser. Pass parameters by reference to a parser. More...

parse_error

Generate error messages for the various parsers.

parser_error() generates error messages for the various parsers used by libdap. There are two versions of the function, one which takes a const char *message and a const int line_num and writes the message and line number too stderr and a second which takes an additional parser_arg arg parameter and writes the error message into an Error object which is returned to the caller via the arg parameter.

Note:
{The second version of this function also accepts a third parameter (const char *context) which can be used to provide an additional line of information beyond what is in the string message.}
Returns:
void


void parse_error (const string &msg, const int line_num, const char *context=0)
void parse_error (parser_arg *arg, const char *s, const int line_num=0, const char *context=0)

Defines

#define FALSE   0
#define ID_MAX   256
#define TRUE   1
#define YY_NO_UNPUT   1
#define YYDEBUG   1

Functions

int check_byte (const char *val)
 Is the value a valid byte?
int check_float32 (const char *val)
 Is the value a valid float?
int check_float64 (const char *val)
int check_int16 (const char *val)
 Is the value a valid integer?
int check_int32 (const char *val)
int check_uint16 (const char *val)
int check_uint32 (const char *val)
int check_url (const char *val)
 Is the value a valid URL?
bool is_keyword (string id, const string &keyword)
void save_str (string &dst, const char *src, const int)
void save_str (char *dst, const char *src, const int line_num)
 Save a string to a temporary variable during the parse.


Define Documentation

#define FALSE   0

Definition at line 51 of file parser.h.

#define ID_MAX   256

Definition at line 47 of file parser.h.

#define TRUE   1

Definition at line 50 of file parser.h.

#define YY_NO_UNPUT   1

Definition at line 45 of file parser.h.

#define YYDEBUG   1

Definition at line 43 of file parser.h.


Function Documentation

int check_byte ( const char *  val  ) 

Check to see if val is a valid byte value. If not, generate an error message using parser_error(). There are two versions of check_byte(), one which calls parser_error() and prints an error message to stderr an one which calls parser_error() and generates and Error object.

Returns:
Returns: True if val is a byte value, False otherwise.

Definition at line 157 of file parser-util.cc.

References DBG, DODS_SCHAR_MIN, DODS_UCHAR_MAX, FALSE, and TRUE.

int check_float32 ( const char *  val  ) 

Like check_byte() but for 64-bit float values.

Definition at line 247 of file parser-util.cc.

References DBG, DODS_FLT_MAX, DODS_FLT_MIN, FALSE, and TRUE.

int check_float64 ( const char *  val  ) 

Definition at line 275 of file parser-util.cc.

References DBG, DODS_DBL_MAX, DODS_DBL_MIN, FALSE, and TRUE.

int check_int16 ( const char *  val  ) 

Like check_byte() but for 32-bit integers (check_uint() is for unsigned integers).

Definition at line 183 of file parser-util.cc.

References DODS_SHRT_MAX, DODS_SHRT_MIN, FALSE, and TRUE.

int check_int32 ( const char *  val  ) 

Definition at line 215 of file parser-util.cc.

References DODS_INT_MAX, DODS_INT_MIN, FALSE, and TRUE.

int check_uint16 ( const char *  val  ) 

Definition at line 199 of file parser-util.cc.

References DODS_USHRT_MAX, FALSE, and TRUE.

int check_uint32 ( const char *  val  ) 

Definition at line 231 of file parser-util.cc.

References FALSE, and TRUE.

int check_url ( const char *  val  ) 

Currently this function always returns true.

Definition at line 332 of file parser-util.cc.

References TRUE.

bool is_keyword ( string  id,
const string &  keyword 
)

Definition at line 149 of file parser-util.cc.

References DBG, downcase(), and prune_spaces().

Here is the call graph for this function:

void parse_error ( const string &  msg,
const int  line_num,
const char *  context = 0 
)

Definition at line 128 of file parser-util.cc.

References parse_error().

Here is the call graph for this function:

void parse_error ( parser_arg arg,
const char *  s,
const int  line_num = 0,
const char *  context = 0 
)

Definition at line 68 of file parser-util.cc.

References append_long_to_string(), FALSE, parser_arg::set_error(), parser_arg::set_status(), and unknown_error.

Here is the call graph for this function:

void save_str ( string &  dst,
const char *  src,
const   int 
)

Definition at line 144 of file parser-util.cc.

void save_str ( char *  dst,
const char *  src,
const int  line_num 
)

Given a string (const char *src), save it to the temporary variable pointed to by dst. If the string is longer than ID_MAX, generate and error indicating that src was truncated to ID_MAX characters during the copy operation. There are two versions of this function; one calls the version of parser_error() which writes to stderr. The version which accepts the parser_arg *arg argument calls the version of parser_error() which generates and Error object.

Returns:
void

Definition at line 133 of file parser-util.cc.

References ID_MAX, long_to_string(), and parse_error().

Here is the call graph for this function:


Generated on Wed Jun 27 12:57:04 2007 for libdap++ by  doxygen 1.4.7