OMNeT++ NEDXML 6.1
Discrete Event Simulation Library
nedsyntaxvalidator.h
Go to the documentation of this file.
1 //==========================================================================
2 // nedsyntaxvalidator.h -
3 //
4 // OMNeT++/OMNEST
5 // Discrete System Simulation in C++
6 //
7 // Contents:
8 // class NedSyntaxValidator
9 //
10 //==========================================================================
11 
12 /*--------------------------------------------------------------*
13  Copyright (C) 2002-2017 Andras Varga
14  Copyright (C) 2006-2017 OpenSim Ltd.
15 
16  This file is distributed WITHOUT ANY WARRANTY. See the file
17  `license' for details on this and other legal matters.
18 *--------------------------------------------------------------*/
19 
20 
21 #ifndef __OMNETPP_NEDXML_NEDSYNTAXVALIDATOR_H
22 #define __OMNETPP_NEDXML_NEDSYNTAXVALIDATOR_H
23 
24 #include "nedvalidator.h"
25 
26 namespace omnetpp {
27 namespace nedxml {
28 
39 class NEDXML_API NedSyntaxValidator : public NedValidatorBase
40 {
41  protected:
42  // internal helpers: verify attributes
43  void checkExpressionAttributes(ASTNode *node, const char *attrs[], bool optional[], int n);
44  void checkEnumAttribute(ASTNode *node, const char *attr, const char *values[], int n);
45  void checkDottedNameAttribute(ASTNode *node, const char *attr, bool wildcardsAllowed);
46  void checkPropertyNameAttribute(ASTNode *node, const char *attr);
47  void checkPropertyIndexAttribute(ASTNode *node, const char *attr);
48 
49  // helper: whether the given node is inside the BODY of a submodule or a connection
50  bool isWithinSubcomponent(ASTNode *node);
51 
52  // whether the given node is inside an inner type
53  bool isWithinInnerType(ASTNode *node);
54 
55  public:
59  NedSyntaxValidator(ErrorStore *e) : NedValidatorBase(e) {}
60 
64  virtual ~NedSyntaxValidator() {}
65 
66  protected:
69  virtual void validateElement(FilesElement *node) override;
70  virtual void validateElement(NedFileElement *node) override;
71  virtual void validateElement(CommentElement *node) override;
72  virtual void validateElement(PackageElement *node) override;
73  virtual void validateElement(ImportElement *node) override;
74  virtual void validateElement(PropertyDeclElement *node) override;
75  virtual void validateElement(ExtendsElement *node) override;
76  virtual void validateElement(InterfaceNameElement *node) override;
77  virtual void validateElement(SimpleModuleElement *node) override;
78  virtual void validateElement(ModuleInterfaceElement *node) override;
79  virtual void validateElement(CompoundModuleElement *node) override;
80  virtual void validateElement(ChannelInterfaceElement *node) override;
81  virtual void validateElement(ChannelElement *node) override;
82  virtual void validateElement(ParametersElement *node) override;
83  virtual void validateElement(ParamElement *node) override;
84  virtual void validateElement(PropertyElement *node) override;
85  virtual void validateElement(PropertyKeyElement *node) override;
86  virtual void validateElement(GatesElement *node) override;
87  virtual void validateElement(GateElement *node) override;
88  virtual void validateElement(TypesElement *node) override;
89  virtual void validateElement(SubmodulesElement *node) override;
90  virtual void validateElement(SubmoduleElement *node) override;
91  virtual void validateElement(ConnectionsElement *node) override;
92  virtual void validateElement(ConnectionElement *node) override;
93  virtual void validateElement(ConnectionGroupElement *node) override;
94  virtual void validateElement(LoopElement *node) override;
95  virtual void validateElement(ConditionElement *node) override;
96  virtual void validateElement(LiteralElement *node) override;
97  virtual void validateElement(UnknownElement *node) override;
99 };
100 
101 } // namespace nedxml
102 } // namespace omnetpp
103 
104 
105 #endif
106 
omnetpp::nedxml::NedSyntaxValidator
Performs structural validation of components.
Definition: nedsyntaxvalidator.h:39
NEDXML_API
#define NEDXML_API
Definition: nedxmldefs.h:31
omnetpp
Definition: astbuilder.h:25
omnetpp::nedxml::ASTNode
Definition: astnode.h:87
omnetpp::nedxml::NedSyntaxValidator::NedSyntaxValidator
NedSyntaxValidator(ErrorStore *e)
Definition: nedsyntaxvalidator.h:59
omnetpp::nedxml::NedSyntaxValidator::~NedSyntaxValidator
virtual ~NedSyntaxValidator()
Definition: nedsyntaxvalidator.h:64
omnetpp::nedxml::ErrorStore
Definition: errorstore.h:37