00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014 #ifndef __NEDPARSER_H
00015 #define __NEDPARSER_H
00016
00017 #include <stdio.h>
00018
00019 #include "nedgrammar.h"
00020 #include "nedelement.h"
00021
00022 class NEDFileBuffer;
00023 class NEDParser;
00024 extern NEDParser *np;
00025
00026
00027 #define TYPE_NUMERIC 'N'
00028 #define TYPE_CONST_NUM 'C'
00029 #define TYPE_STRING 'S'
00030 #define TYPE_BOOL 'B'
00031 #define TYPE_ANYTYPE 'A'
00032
00033
00042 class NEDParser
00043 {
00044 public:
00045 NEDElement *tree;
00046 NEDFileBuffer *nedsource;
00047
00048 protected:
00049 const char *filename;
00050 int num_errors;
00051
00052 public:
00056 NEDParser();
00057
00061 ~NEDParser();
00062
00067 bool parseFile(const char *fname,bool parseexpr);
00068
00073 bool parseText(const char *nedtext,bool parseexpr);
00074
00079 NEDElement *getTree();
00080
00081
00082 void error(const char *msg, int line);
00083 void dbg(YYLTYPE lc, const char *what);
00084 };
00085
00086 #endif
00087