00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016 #ifndef __NEDPARSER_H
00017 #define __NEDPARSER_H
00018
00019 #include <stdio.h>
00020
00021 #include "nedgrammar.h"
00022 #include "nedelement.h"
00023
00024 class NEDFileBuffer;
00025 class NEDParser;
00026 extern NEDParser *np;
00027
00028
00029 #define TYPE_NUMERIC 'N'
00030 #define TYPE_CONST_NUM 'C'
00031 #define TYPE_STRING 'S'
00032 #define TYPE_BOOL 'B'
00033 #define TYPE_XML 'X'
00034 #define TYPE_ANYTYPE 'A'
00035
00036
00045 class NEDParser
00046 {
00047 public:
00048 NEDElement *tree;
00049 NEDFileBuffer *nedsource;
00050
00051 protected:
00052 bool parseexpr;
00053 bool storesrc;
00054
00055 const char *filename;
00056 int num_errors;
00057
00058 public:
00062 NEDParser();
00063
00067 ~NEDParser();
00068
00074 void setParseExpressions(bool b) {parseexpr = b;}
00075
00081 void setStoreSource(bool b) {storesrc = b;}
00082
00086 bool parseFile(const char *fname);
00087
00091 bool parseText(const char *nedtext);
00092
00097 NEDElement *getTree();
00098
00099
00100 void error(const char *msg, int line);
00101 void dbg(YYLTYPE lc, const char *what);
00102 };
00103
00104 #endif
00105