Home | Documentation | Download | Platforms | Projects | Mailing Lists | Version History

- Main Page
- Classes
- Files
- Related Pages

# gml_scanner.h

    00001 //==========================================================================
    00002 //
    00003 //   gml_scanner.h
    00004 //
    00005 //==========================================================================
    00006 // $Id: gml_scanner.h,v 1.11 2000/03/06 15:16:52 raitner Exp $
    00007
    00008 #ifndef GTL_GML_SCANNER_H
    00009 #define GTL_GML_SCANNER_H
    00010
    00011 #include <GTL/GTL.h>
    00012
    00013 #include <cstdio>
    00014
    00015 __GTL_BEGIN_NAMESPACE
    00016
    00017 /*
    00018  * start-size of buffers for reading strings. If too small it will be enlarged
    00019  * dynamically
    00020  */
    00021
    00022 #define INITIAL_SIZE 1024
    00023
    00024 GTL_EXTERN typedef enum {
    00025     GML_KEY, GML_INT, GML_DOUBLE, GML_STRING, GML_L_BRACKET,
    00026     GML_R_BRACKET, GML_END, GML_LIST, GML_ERROR
    00027 } GML_value;
    00028
    00029
    00033 GTL_EXTERN typedef enum {
    00034     GML_UNEXPECTED, GML_SYNTAX, GML_PREMATURE_EOF, GML_TOO_MANY_DIGITS,
    00035     GML_OPEN_BRACKET, GML_TOO_MANY_BRACKETS, GML_OK, GML_FILE_NOT_FOUND
    00036 } GML_error_value;
    00037
    00038
    00051 struct GTL_EXTERN GML_error {
    00076     GML_error_value err_num;
    00077
    00083     int line;
    00084
    00088     int column;
    00089 };
    00090
    00091
    00092 union GTL_EXTERN GML_tok_val {
    00093     long integer;
    00094     double floating;
    00095     char* str;
    00096     struct GML_error err;
    00097 };
    00098
    00102 struct GTL_EXTERN GML_token {
    00103     GML_value kind;
    00104     union GML_tok_val value;
    00105 };
    00106
    00107 /*
    00108  * global variables
    00109  */
    00110
    00111 GTL_EXTERN extern unsigned int GML_line;
    00112 GTL_EXTERN extern unsigned int GML_column;
    00113
    00114 /*
    00115  * if you are interested in the position where an error occured it is a good
    00116  * idea to set GML_line and GML_column back.
    00117  * This is what GML_init does.
    00118  */
    00119
    00120 GTL_EXTERN void GML_init ();
    00121
    00122 /*
    00123  * returns the next token in file. If an error occured it will be stored in
    00124  * GML_token.
    00125  */
    00126
    00127 GTL_EXTERN struct GML_token GML_scanner (FILE*);
    00128
    00129 GTL_EXTERN extern const char* GML_table[];
    00130
    00131 __GTL_END_NAMESPACE
    00132
    00133 #endif // GTL_GML_SCANNER_H
    00134
    00135 //--------------------------------------------------------------------------
    00136 //   end of file
    00137 //--------------------------------------------------------------------------

University of Passau - FMI - Theoretical Computer Science

Design © 2002, 2003 Marcus Raitner, University of Passau