OMNeT++ NEDXML  5.4.1
nedparser.h
Go to the documentation of this file.
1 //==========================================================================
2 // NEDPARSER.H - part of
3 //
4 // OMNeT++/OMNEST
5 // Discrete System Simulation in C++
6 //
7 //==========================================================================
8 
9 /*--------------------------------------------------------------*
10  Copyright (C) 2002-2017 Andras Varga
11  Copyright (C) 2006-2017 OpenSim Ltd.
12 
13  This file is distributed WITHOUT ANY WARRANTY. See the file
14  `license' for details on this and other legal matters.
15 *--------------------------------------------------------------*/
16 
17 #ifndef __OMNETPP_NEDXML_NEDPARSER_H
18 #define __OMNETPP_NEDXML_NEDPARSER_H
19 
20 #include <cstdio>
21 #include "yydefs.h"
22 
23 namespace omnetpp {
24 namespace nedxml {
25 
26 class ASTNode;
27 class ErrorStore;
28 class SourceDocument;
29 
30 /* to EXPR_TYPE: */
31 #define TYPE_NUMERIC 'N'
32 #define TYPE_CONST_NUM 'C'
33 #define TYPE_STRING 'S'
34 #define TYPE_BOOL 'B'
35 #define TYPE_XML 'X'
36 #define TYPE_ANYTYPE 'A'
37 
38 
49 {
50  public:
52 
53  protected:
54  bool loadFile(const char *osfname, const char *fname);
55  bool loadText(const char *nedtext, const char *fname);
56  ASTNode *parseNed();
57 
58  public:
63 
67  ~NedParser();
68 
73  static const char *getBuiltInDeclarations();
74 
80  void setParseExpressions(bool b) {np.parseexpr = b;}
81 
87  void setStoreSource(bool b) {np.storesrc = b;}
88 
92  bool getParseExpressionsFlag() {return np.parseexpr;}
93 
97  bool getStoreSourceFlag() {return np.storesrc;}
98 
105  ASTNode *parseNedFile(const char *osfname, const char *fname=nullptr);
106 
113  ASTNode *parseNedText(const char *nedtext, const char *fname=nullptr);
114 
119  ASTNode *parseNedExpression(const char *nedexpression);
120 };
121 
122 } // namespace nedxml
123 } // namespace omnetpp
124 
125 
126 #endif
127 
bool storesrc
Definition: yydefs.h:51
#define NEDXML_API
Definition: nedxmldefs.h:31
ParseContext np
Definition: nedparser.h:51
void setParseExpressions(bool b)
Definition: nedparser.h:80
bool getParseExpressionsFlag()
Definition: nedparser.h:92
void setStoreSource(bool b)
Definition: nedparser.h:87
Definition: yydefs.h:48
bool parseexpr
Definition: yydefs.h:49
Parses NED files into an AST.
Definition: nedparser.h:48
bool getStoreSourceFlag()
Definition: nedparser.h:97
Definition: astbuilder.h:25
Definition: astnode.h:75
Definition: errorstore.h:37