yydefs.h Source File

NEDXML API: yydefs.h Source File
NEDXML API
yydefs.h
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
30namespace omnetpp {
31namespace nedxml {
32
33class ErrorStore;
34class SourceDocument;
35class ASTNode;
36
37struct YYLoc {
38 int dummy;
39 int first_line, first_column;
40 int last_line, last_column;
41 char *text;
42};
43
44#define YYLTYPE omnetpp::nedxml::YYLoc
45#define YYSTYPE omnetpp::nedxml::ASTNode*
46
47//TODO cleanup
48struct 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;}
56 ErrorStore *getErrors() {return errors;}
57 SourceDocument *getSource() {return source;}
58 void error(const char *msg, int line);
59};
60
61struct LineColumn {
62 int li;
63 int co;
64};
65
66extern LineColumn pos;
67
68} // namespace nedxml
69} // namespace omnetpp
70
71omnetpp::nedxml::ASTNode *doParseNed(omnetpp::nedxml::ParseContext *np);
72omnetpp::nedxml::ASTNode *doParseMsg(omnetpp::nedxml::ParseContext *np);
73
74
75#endif
76
77
78
Definition astnode.h:88
Definition errorstore.h:38
Stores the full text of a NED/MSG file.
Definition sourcedocument.h:38