OMNeT++ NEDXML  6.0.3
yydefs.h
Go to the documentation of this file.
1 //==========================================================================
2 // YYDEFS.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_YYDEFS_H
18 #define __OMNETPP_NEDXML_YYDEFS_H
19 
20 #include "nedxmldefs.h"
21 
22 //
23 // misc bison/flex related stuff, shared among *.lex, *.y and nedparser.cc/h files
24 //
25 
26 #ifdef YYLTYPE
27 #error 'YYLTYPE defined before yydefs.h -- type clash?'
28 #endif
29 
30 namespace omnetpp {
31 namespace nedxml {
32 
33 class ErrorStore;
34 class SourceDocument;
35 class ASTNode;
36 
37 struct YYLoc {
38  int dummy;
41  char *text;
42 };
43 
44 #define YYLTYPE omnetpp::nedxml::YYLoc
45 #define YYSTYPE omnetpp::nedxml::ASTNode*
46 
47 //TODO cleanup
48 struct ParseContext {
49  bool storesrc = false; // whether to fill in sourceCode attributes
50  const char *filename = nullptr; // name of file being parsed
51  ErrorStore *errors = nullptr; // accumulates error messages
52  SourceDocument *source = nullptr; // represents the source file
53 
54  bool getStoreSourceFlag() {return storesrc;}
55  const char *getFileName() {return filename;}
58  void error(const char *msg, int line);
59 };
60 
61 typedef struct {int li; int co;} LineColumn;
62 extern LineColumn pos, prevpos; //FIXME into context!
63 
64 } // namespace nedxml
65 } // namespace omnetpp
66 
69 
70 
71 #endif
72 
73 
74 
omnetpp::nedxml::prevpos
LineColumn prevpos
Definition: yydefs.h:62
doParseNed
omnetpp::nedxml::ASTNode * doParseNed(omnetpp::nedxml::ParseContext *np, const char *text)
omnetpp::nedxml::ParseContext::source
SourceDocument * source
Definition: yydefs.h:52
omnetpp::nedxml::ParseContext::filename
const char * filename
Definition: yydefs.h:50
omnetpp::nedxml::YYLoc::last_column
int last_column
Definition: yydefs.h:40
omnetpp::nedxml::SourceDocument
Stores the full text of a NED/MSG file.
Definition: sourcedocument.h:37
omnetpp::nedxml::YYLoc::dummy
int dummy
Definition: yydefs.h:38
omnetpp::nedxml::ParseContext::getErrors
ErrorStore * getErrors()
Definition: yydefs.h:56
omnetpp::nedxml::YYLoc
Definition: yydefs.h:37
omnetpp::nedxml::ParseContext::storesrc
bool storesrc
Definition: yydefs.h:49
omnetpp::nedxml::pos
LineColumn pos
omnetpp::nedxml::LineColumn
Definition: yydefs.h:61
omnetpp
Definition: astbuilder.h:25
omnetpp::nedxml::ParseContext::getSource
SourceDocument * getSource()
Definition: yydefs.h:57
omnetpp::nedxml::YYLoc::first_column
int first_column
Definition: yydefs.h:39
omnetpp::nedxml::ParseContext::getFileName
const char * getFileName()
Definition: yydefs.h:55
omnetpp::nedxml::LineColumn::li
int li
Definition: yydefs.h:61
omnetpp::nedxml::ASTNode
Definition: astnode.h:87
omnetpp::nedxml::ParseContext::getStoreSourceFlag
bool getStoreSourceFlag()
Definition: yydefs.h:54
omnetpp::nedxml::ParseContext
Definition: yydefs.h:48
doParseMsg
omnetpp::nedxml::ASTNode * doParseMsg(omnetpp::nedxml::ParseContext *np, const char *text)
omnetpp::nedxml::YYLoc::last_line
int last_line
Definition: yydefs.h:40
omnetpp::nedxml::ParseContext::error
void error(const char *msg, int line)
omnetpp::nedxml::YYLoc::first_line
int first_line
Definition: yydefs.h:39
omnetpp::nedxml::ParseContext::errors
ErrorStore * errors
Definition: yydefs.h:51
nedxmldefs.h
omnetpp::nedxml::ErrorStore
Definition: errorstore.h:37
omnetpp::nedxml::YYLoc::text
char * text
Definition: yydefs.h:41