Fix for UBSan build
[platform/upstream/doxygen.git] / src / vhdlscanner.h
1 /******************************************************************************
2  *
3  * $Id: vhdlscanner.h,v 1.9 2001/03/19 19:27:39 root Exp $
4  *
5  * Copyright (C) 1997-2012 by Dimitri van Heesch.
6  *
7  * Permission to use, copy, modify, and distribute this software and its
8  * documentation under the terms of the GNU General Public License is hereby 
9  * granted. No representations are made about the suitability of this software 
10  * for any purpose. It is provided "as is" without express or implied warranty.
11  * See the GNU General Public License for more details.
12  *
13  * Documents produced by Doxygen are derivative works derived from the
14  * input used in their production; they are not affected by this license.
15  *
16  */
17
18 #ifndef VHDLSCANNER_H
19 #define VHDLSCANNER_H
20
21 #include "parserintf.h"
22 #include <stdio.h>
23 #include <stdlib.h>
24 #include <assert.h>
25 #include <ctype.h>
26
27 #include <qarray.h>
28 #include <unistd.h>
29 #include <qfile.h>
30 #include <qdict.h>
31
32 #include "entry.h"
33 #include "memberlist.h"
34
35 class Entry;
36 class ClassSDict;
37 class FileStorage;
38 class ClassDef;
39 class MemberDef;
40 class QStringList;
41
42
43 /** VHDL parser using state-based lexical scanning.
44  *
45  * This is the VHDL language parser for doxygen.
46  */
47 class VHDLLanguageScanner : public ParserInterface
48 {
49   public:
50     virtual ~VHDLLanguageScanner() {}
51     void parseInput(const char * fileName, 
52                     const char *fileBuf, 
53                     Entry *root);
54     bool needsPreprocessing(const QCString &extension);
55     void parseCode(CodeOutputInterface &codeOutIntf,
56                    const char *scopeName,
57                    const QCString &input,
58                    bool isExampleBlock,
59                    const char *exampleName=0,
60                    FileDef *fileDef=0,
61                    int startLine=-1,
62                    int endLine=-1,
63                    bool inlineFragment=FALSE,
64                    MemberDef *memberDef=0,
65                    bool showLineNumbers=TRUE,
66                    Definition *searchCtx=0
67                   );
68     void resetCodeParserState();
69     void parsePrototype(const char *text);
70 };
71
72 /** Container for vhdlscanner */
73 struct VhdlContainer
74 {
75   int yyLineNr;          // current line no
76   int iLine;             // line no of last t_identifier  
77   QCString qstr;         //  t_identifier 
78   QCString fileName;     // current file
79   Entry*  root;          // root
80 };   
81
82 /** Configuation node for VHDL */
83 struct VhdlConfNode
84
85   VhdlConfNode *prevNode;
86   VhdlConfNode(const char*  a,const char*  b,const char* config) 
87   { 
88     arch=a;              // architecture  e.g. for iobuffer
89     binding=b;           // binding e.g.  use entiy work.xxx(bev)
90     confVhdl=config;     // configuration foo is bar
91     isBind=false;
92     prevNode=NULL;
93     isRoot=false;          
94     isInlineConf=false;  // primary configuration?
95   };
96
97   QCString confVhdl;
98   QCString arch;
99   QCString binding;
100   QList<VhdlConfNode> confN;
101   bool isBind;
102   bool isInlineConf;
103   bool isRoot;
104
105   void addNode(VhdlConfNode* n) { confN.append(n); }
106   bool isBinding()          { return binding.isEmpty(); }
107 };
108
109 // returns the current conpound entity,architecture, package,package body 
110 Entry* getVhdlCompound();
111
112 // return the current parsed entry
113 Entry* getCurrentVhdlEntry();
114
115 void newVhdlEntry();
116
117 void initVhdlParser();
118
119 struct VhdlContainer* getVhdlCont();
120
121 // returns the  parsed line 
122 // @ param object index of vhdl keyword like t_Identifier t_Entity 
123 int getParsedLine(int object);
124
125 void vhdlscanFreeScanner();
126
127 void vhdlParse();
128
129 // return the list of component instantiations e.g. foo: component bar 
130 QList<Entry> &  getVhdlInstList();
131
132 // returns the list of found configurations
133 QList<VhdlConfNode>& getVhdlConfiguration();
134
135 void isVhdlDocPending();
136 #endif