Imported Upstream version 1.8.7
[platform/upstream/doxygen.git] / src / vhdlscanner.h
1 /******************************************************************************
2  *
3  * 
4  *
5  * Copyright (C) 1997-2014 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 #include "vhdldocgen.h"
32 #include "entry.h"
33
34 class Entry;
35 class ClassSDict;
36 class FileStorage;
37 class ClassDef;
38 class MemberDef;
39 class QStringList;
40 class MemberList;
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 startTranslationUnit(const char *) {}
52     void finishTranslationUnit() {}
53     void parseInput(const char * fileName, 
54                     const char *fileBuf, 
55                     Entry *root,
56                     bool sameTranslationUnit,
57                     QStrList &filesInSameTranslationUnit);
58     bool needsPreprocessing(const QCString &extension);
59     void parseCode(CodeOutputInterface &codeOutIntf,
60                    const char *scopeName,
61                    const QCString &input,
62                    SrcLangExt lang,
63                    bool isExampleBlock,
64                    const char *exampleName=0,
65                    FileDef *fileDef=0,
66                    int startLine=-1,
67                    int endLine=-1,
68                    bool inlineFragment=FALSE,
69                    MemberDef *memberDef=0,
70                    bool showLineNumbers=TRUE,
71                    Definition *searchCtx=0,
72                    bool collectXRefs=TRUE
73                   );
74     void resetCodeParserState();
75     void parsePrototype(const char *text);
76 };
77
78 /** Container for vhdlscanner */
79 struct VhdlContainer
80 {
81   int yyLineNr;          // current line no
82   int iLine;             // line no of last t_identifier  
83   QCString qstr;         //  t_identifier 
84   QCString fileName;     // current file
85   Entry*  root;          // root
86 };   
87
88 /** Configuration node for VHDL */
89 struct VhdlConfNode
90
91   VhdlConfNode(const char*  a,const char*  b,const char* config,const char* cs,bool leaf) 
92   { 
93     arch=a;              // architecture  e.g. for iobuffer
94     arch=arch.lower();
95     binding=b;           // binding e.g.  use entiy work.xxx(bev)
96     binding=binding.lower();
97     confVhdl=config;     // configuration foo is bar
98     compSpec=cs;        
99     isInlineConf=false;  // primary configuration?
100     isLeaf=leaf;
101   };
102
103   QCString confVhdl;
104   QCString arch;
105   QCString binding;
106   QCString compSpec;
107   int level;
108   bool isLeaf;
109   bool isInlineConf;
110
111 };
112
113
114
115 // returns the current conpound entity,architecture, package,package body 
116 Entry* getVhdlCompound();
117
118 // return the current parsed entry
119 Entry* getCurrentVhdlEntry();
120
121 void newVhdlEntry();
122
123 void initVhdlParser();
124
125 struct VhdlContainer* getVhdlCont();
126
127 // returns the  parsed line 
128 // @ param object index of vhdl keyword like t_Identifier t_Entity 
129 int getParsedLine(int object);
130
131 void vhdlscanFreeScanner();
132
133 void vhdlParse();
134
135 // return the list of component instantiations e.g. foo: component bar 
136 QList<Entry> &  getVhdlInstList();
137
138 // returns   configuration list
139 QList<VhdlConfNode>& getVhdlConfiguration();
140
141 // returns library/used list
142 QList<Entry> &  getLibUse();
143
144 void isVhdlDocPending();
145
146
147 #endif