nedparser.h Source File

NEDXML API: nedparser.h Source File
NEDXML API
nedparser.h
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
23namespace omnetpp {
24namespace nedxml {
25
26class ASTNode;
27class ErrorStore;
28class 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
48class NEDXML_API NedParser
49{
50 public:
51 ParseContext np;
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
68
73 static const char *getBuiltInDeclarations();
74
80 void setStoreSource(bool b) {np.storesrc = b;}
81
85 bool getStoreSourceFlag() {return np.storesrc;}
86
93 ASTNode *parseNedFile(const char *osfname, const char *fname=nullptr);
94
101 ASTNode *parseNedText(const char *nedtext, const char *fname=nullptr);
102
107 bool isValidNedExpression(const char *expr);
108};
109
110} // namespace nedxml
111} // namespace omnetpp
112
113
114#endif
115
Definition astnode.h:88
Definition errorstore.h:38
bool getStoreSourceFlag()
Definition nedparser.h:85
bool isValidNedExpression(const char *expr)
ASTNode * parseNedFile(const char *osfname, const char *fname=nullptr)
void setStoreSource(bool b)
Definition nedparser.h:80
ASTNode * parseNedText(const char *nedtext, const char *fname=nullptr)
static const char * getBuiltInDeclarations()
Stores the full text of a NED/MSG file.
Definition sourcedocument.h:38