OMNeT++ NEDXML 6.1
Discrete Event Simulation Library
nedyyutil.h
Go to the documentation of this file.
1 //==========================================================================
2 // nedyyutil.h -
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_NEDYYUTIL_H
18 #define __OMNETPP_NEDXML_NEDYYUTIL_H
19 
20 #include "yyutil.h"
21 #include "nedelements.h"
22 
23 namespace omnetpp {
24 namespace nedxml {
25 namespace nedyyutil { // for now
26 
27 ASTNode *createNedElementWithTag(ParseContext *np, int tagcode, ASTNode *parent=nullptr);
28 ASTNode *getOrCreateNedElementWithTag(ParseContext *np, int tagcode, ASTNode *parent);
29 
30 PropertyElement *addProperty(ParseContext *np, ASTNode *node, const char *name); // directly under the node
31 PropertyElement *addComponentProperty(ParseContext *np, ASTNode *node, const char *name); // into ParametersElement child of node
32 
33 PropertyElement *storeSourceCode(ParseContext *np, ASTNode *node, YYLoc tokenpos); // directly under the node
34 PropertyElement *storeComponentSourceCode(ParseContext *np, ASTNode *node, YYLoc tokenpos); // into ParametersElement child
35 PropertyElement *setIsNetworkProperty(ParseContext *np, ASTNode *node); // into ParametersElement child
36 
37 void addComment(ParseContext *np, ASTNode *node, const char *locId, const char *comment, const char *defaultValue);
38 void storeFileComment(ParseContext *np, ASTNode *node);
39 void storeBannerComment(ParseContext *np, ASTNode *node, YYLoc tokenpos);
40 void storeRightComment(ParseContext *np, ASTNode *node, YYLoc tokenpos);
41 void storeTrailingComment(ParseContext *np, ASTNode *node, YYLoc tokenpos);
43 void storeBannerAndRightComments(ParseContext *np, ASTNode *node, YYLoc firstpos, YYLoc lastpos);
45 
46 ParamElement *addParameter(ParseContext *np, ASTNode *params, YYLoc namepos);
47 ParamElement *addParameter(ParseContext *np, ASTNode *params, const char *name, YYLoc namepos);
48 GateElement *addGate(ParseContext *np, ASTNode *gates, YYLoc namepos);
49 
50 void swapConnection(ASTNode *conn);
51 
52 LiteralElement *createPropertyValue(ParseContext *np, YYLoc textpos);
53 LiteralElement *createLiteral(ParseContext *np, int type, YYLoc valuepos, YYLoc textpos);
54 LiteralElement *createLiteral(ParseContext *np, int type, const char *value, const char *text);
55 LiteralElement *createStringLiteral(ParseContext *np, YYLoc textpos);
56 LiteralElement *createQuantityLiteral(ParseContext *np, YYLoc textpos);
58 
59 void addOptionalExpression(ParseContext *np, ASTNode *elem, const char *attrname, YYLoc exprpos, ASTNode *expr);
60 void addExpression(ParseContext *np, ASTNode *elem, const char *attrname, YYLoc exprpos, ASTNode *expr);
61 
62 } // namespace nedyyutil
63 } // namespace nedxml
64 } // namespace omnetpp
65 
66 
67 #endif
68 
omnetpp::nedxml::nedyyutil::addParameter
ParamElement * addParameter(ParseContext *np, ASTNode *params, YYLoc namepos)
omnetpp::nedxml::nedyyutil::addComponentProperty
PropertyElement * addComponentProperty(ParseContext *np, ASTNode *node, const char *name)
omnetpp::nedxml::nedyyutil::createStringLiteral
LiteralElement * createStringLiteral(ParseContext *np, YYLoc textpos)
omnetpp::nedxml::nedyyutil::storeBannerComment
void storeBannerComment(ParseContext *np, ASTNode *node, YYLoc tokenpos)
omnetpp::nedxml::nedyyutil::storeComponentSourceCode
PropertyElement * storeComponentSourceCode(ParseContext *np, ASTNode *node, YYLoc tokenpos)
omnetpp::nedxml::nedyyutil::storeInnerComments
void storeInnerComments(ParseContext *np, ASTNode *node, YYLoc pos)
omnetpp::nedxml::nedyyutil::prependMinusSign
ASTNode * prependMinusSign(ParseContext *np, ASTNode *node)
omnetpp::nedxml::nedyyutil::addExpression
void addExpression(ParseContext *np, ASTNode *elem, const char *attrname, YYLoc exprpos, ASTNode *expr)
omnetpp::nedxml::nedyyutil::swapConnection
void swapConnection(ASTNode *conn)
omnetpp::nedxml::YYLoc
Definition: yydefs.h:37
omnetpp::nedxml::nedyyutil::storeRightComment
void storeRightComment(ParseContext *np, ASTNode *node, YYLoc tokenpos)
omnetpp::nedxml::nedyyutil::createNedElementWithTag
ASTNode * createNedElementWithTag(ParseContext *np, int tagcode, ASTNode *parent=nullptr)
omnetpp::nedxml::pos
LineColumn pos
omnetpp
Definition: astbuilder.h:25
omnetpp::nedxml::nedyyutil::setIsNetworkProperty
PropertyElement * setIsNetworkProperty(ParseContext *np, ASTNode *node)
omnetpp::nedxml::nedyyutil::storeFileComment
void storeFileComment(ParseContext *np, ASTNode *node)
omnetpp::nedxml::nedyyutil::addProperty
PropertyElement * addProperty(ParseContext *np, ASTNode *node, const char *name)
omnetpp::nedxml::nedyyutil::createPropertyValue
LiteralElement * createPropertyValue(ParseContext *np, YYLoc textpos)
omnetpp::nedxml::nedyyutil::addGate
GateElement * addGate(ParseContext *np, ASTNode *gates, YYLoc namepos)
omnetpp::nedxml::ASTNode
Definition: astnode.h:87
yyutil.h
omnetpp::nedxml::nedyyutil::storeBannerAndRightComments
void storeBannerAndRightComments(ParseContext *np, ASTNode *node, YYLoc pos)
omnetpp::nedxml::nedyyutil::addOptionalExpression
void addOptionalExpression(ParseContext *np, ASTNode *elem, const char *attrname, YYLoc exprpos, ASTNode *expr)
omnetpp::nedxml::ParseContext
Definition: yydefs.h:48
omnetpp::nedxml::nedyyutil::storeTrailingComment
void storeTrailingComment(ParseContext *np, ASTNode *node, YYLoc tokenpos)
omnetpp::nedxml::nedyyutil::storeSourceCode
PropertyElement * storeSourceCode(ParseContext *np, ASTNode *node, YYLoc tokenpos)
omnetpp::nedxml::nedyyutil::createQuantityLiteral
LiteralElement * createQuantityLiteral(ParseContext *np, YYLoc textpos)
omnetpp::nedxml::nedyyutil::createLiteral
LiteralElement * createLiteral(ParseContext *np, int type, YYLoc valuepos, YYLoc textpos)
omnetpp::nedxml::nedyyutil::addComment
void addComment(ParseContext *np, ASTNode *node, const char *locId, const char *comment, const char *defaultValue)
omnetpp::nedxml::nedyyutil::getOrCreateNedElementWithTag
ASTNode * getOrCreateNedElementWithTag(ParseContext *np, int tagcode, ASTNode *parent)