Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
D
doxverilog
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Commits
Open sidebar
Elphel
doxverilog
Commits
3b8fea2f
Commit
3b8fea2f
authored
Aug 11, 2014
by
Dimitri van Heesch
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Vhdl fixes
parent
7506404e
Changes
16
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
16 changed files
with
6139 additions
and
5628 deletions
+6139
-5628
vhdldocgen.cpp
src/vhdldocgen.cpp
+105
-92
vhdldocgen.h
src/vhdldocgen.h
+2
-3
vhdljjparser.cpp
src/vhdljjparser.cpp
+287
-67
vhdljjparser.h
src/vhdljjparser.h
+37
-33
ErrorHandler.h
vhdlparser/ErrorHandler.h
+43
-8
JavaCC.h
vhdlparser/JavaCC.h
+2
-1
JavaCC.h.in
vhdlparser/JavaCC.h.in
+2
-1
TokenMgrError.cc
vhdlparser/TokenMgrError.cc
+5
-5
VhdlParser.cc
vhdlparser/VhdlParser.cc
+809
-789
VhdlParser.h
vhdlparser/VhdlParser.h
+2923
-2883
VhdlParserConstants.h
vhdlparser/VhdlParserConstants.h
+363
-357
VhdlParserErrorHandler.hpp
vhdlparser/VhdlParserErrorHandler.hpp
+1
-0
VhdlParserIF.cpp
vhdlparser/VhdlParserIF.cpp
+6
-7
VhdlParserTokenManager.cc
vhdlparser/VhdlParserTokenManager.cc
+1393
-1285
VhdlParserTokenManager.h
vhdlparser/VhdlParserTokenManager.h
+10
-4
vhdlparser.jj
vhdlparser/vhdlparser.jj
+151
-93
No files found.
src/vhdldocgen.cpp
View file @
3b8fea2f
...
@@ -28,9 +28,9 @@
...
@@ -28,9 +28,9 @@
#include <qfileinfo.h>
#include <qfileinfo.h>
#include <qstringlist.h>
#include <qstringlist.h>
#ifdef DEBUGFLOW
//
#ifdef DEBUGFLOW
#include <qmap.h>
#include <qmap.h>
#endif
//
#endif
/* --------------------------------------------------------------- */
/* --------------------------------------------------------------- */
...
@@ -58,7 +58,9 @@
...
@@ -58,7 +58,9 @@
#include "namespacedef.h"
#include "namespacedef.h"
#include "filename.h"
#include "filename.h"
#include "membergroup.h"
#include "membergroup.h"
#include "memberdef.h"
#include "vhdljjparser.h"
#include "VhdlParser.h"
#include "VhdlParser.h"
#include "vhdlcode.h"
#include "vhdlcode.h"
...
@@ -712,11 +714,13 @@ ClassDef* VhdlDocGen::getPackageName(const QCString & name)
...
@@ -712,11 +714,13 @@ ClassDef* VhdlDocGen::getPackageName(const QCString & name)
return
cd
;
return
cd
;
}
}
static
QMap
<
QCString
,
MemberDef
*>
varMap
;
static
QList
<
ClassDef
>
qli
;
static
QMap
<
ClassDef
*
,
QList
<
ClassDef
>
>
packages
;
MemberDef
*
VhdlDocGen
::
findMember
(
const
QCString
&
className
,
const
QCString
&
memName
)
MemberDef
*
VhdlDocGen
::
findMember
(
const
QCString
&
className
,
const
QCString
&
memName
)
{
{
QDict
<
QCString
>
packages
(
17
,
FALSE
);
ClassDef
*
cd
,
*
ecd
;
packages
.
setAutoDelete
(
TRUE
);
ClassDef
*
cd
;
MemberDef
*
mdef
=
0
;
MemberDef
*
mdef
=
0
;
cd
=
getClass
(
className
);
cd
=
getClass
(
className
);
...
@@ -738,7 +742,7 @@ MemberDef* VhdlDocGen::findMember(const QCString& className, const QCString& mem
...
@@ -738,7 +742,7 @@ MemberDef* VhdlDocGen::findMember(const QCString& className, const QCString& mem
// searching upper/lower case names
// searching upper/lower case names
QCString
tt
=
d
->
name
();
QCString
tt
=
d
->
name
();
ClassDef
*
ecd
=
getClass
(
tt
);
ecd
=
getClass
(
tt
);
if
(
!
ecd
)
if
(
!
ecd
)
{
{
tt
=
tt
.
upper
();
tt
=
tt
.
upper
();
...
@@ -758,12 +762,9 @@ MemberDef* VhdlDocGen::findMember(const QCString& className, const QCString& mem
...
@@ -758,12 +762,9 @@ MemberDef* VhdlDocGen::findMember(const QCString& className, const QCString& mem
mdef
=
VhdlDocGen
::
findMemberDef
(
cd
,
memName
,
MemberListType_pubMethods
);
mdef
=
VhdlDocGen
::
findMemberDef
(
cd
,
memName
,
MemberListType_pubMethods
);
if
(
mdef
)
return
mdef
;
if
(
mdef
)
return
mdef
;
}
}
//cd=getClass(getClassName(cd));
}
//if (!cd) return 0;
}
// nothing found , so we are now searching all included packages
VhdlDocGen
::
findAllPackages
(
className
,
packages
);
//cd=getClass(className.data());
if
((
VhdlDocGen
::
VhdlClasses
)
cd
->
protection
()
==
VhdlDocGen
::
ARCHITECTURECLASS
||
if
((
VhdlDocGen
::
VhdlClasses
)
cd
->
protection
()
==
VhdlDocGen
::
ARCHITECTURECLASS
||
(
VhdlDocGen
::
VhdlClasses
)
cd
->
protection
()
==
VhdlDocGen
::
PACKBODYCLASS
)
(
VhdlDocGen
::
VhdlClasses
)
cd
->
protection
()
==
VhdlDocGen
::
PACKBODYCLASS
)
{
{
...
@@ -781,60 +782,88 @@ MemberDef* VhdlDocGen::findMember(const QCString& className, const QCString& mem
...
@@ -781,60 +782,88 @@ MemberDef* VhdlDocGen::findMember(const QCString& className, const QCString& mem
tt
=
tt
.
lower
();
tt
=
tt
.
lower
();
ecd
=
getClass
(
tt
);
ecd
=
getClass
(
tt
);
}
}
if
(
ecd
)
//d && d->definitionType()==Definition::TypeClass)
if
(
ecd
)
//d && d->definitionType()==Definition::TypeClass)
{
{
VhdlDocGen
::
findAllPackages
(
ecd
->
className
(),
packages
);
if
(
!
packages
.
contains
(
ecd
))
{
VhdlDocGen
::
findAllPackages
(
ecd
);
}
}
}
}
}
else
{
ecd
=
cd
;
if
(
!
packages
.
contains
(
ecd
))
VhdlDocGen
::
findAllPackages
(
ecd
);
}
QDictIterator
<
QCString
>
packli
(
packages
);
uint
len
=
packages
.
count
();
QCString
*
curString
;
for
(
uint
j
=
0
;
j
<
len
;
j
++
)
for
(
packli
.
toFirst
();(
curString
=
packli
.
current
());
++
packli
)
{
{
if
(
curString
)
for
(
QMap
<
ClassDef
*
,
QList
<
ClassDef
>
>::
Iterator
cList
=
packages
.
begin
();
cList
!=
packages
.
end
();
cList
++
)
{
{
cd
=
VhdlDocGen
::
getPackageName
(
*
curString
);
if
(
cList
.
key
()
==
0
)
continue
;
if
(
!
cd
)
QList
<
ClassDef
>
mlist
=
cList
.
data
();
for
(
uint
j
=
0
;
j
<
mlist
.
count
();
j
++
)
{
{
*
curString
=
curString
->
upper
();
mdef
=
VhdlDocGen
::
findMemberDef
(
mlist
.
at
(
j
),
memName
,
MemberListType_variableMembers
);
cd
=
VhdlDocGen
::
getPackageName
(
*
curString
);
if
(
mdef
)
return
mdef
;
mdef
=
VhdlDocGen
::
findMemberDef
(
mlist
.
at
(
j
),
memName
,
MemberListType_pubMethods
);
if
(
mdef
)
return
mdef
;
}
}
if
(
!
cd
)
{
*
curString
=
curString
->
lower
();
cd
=
VhdlDocGen
::
getPackageName
(
*
curString
);
}
}
if
(
cd
)
{
mdef
=
VhdlDocGen
::
findMemberDef
(
cd
,
memName
,
MemberListType_variableMembers
);
if
(
mdef
)
return
mdef
;
mdef
=
VhdlDocGen
::
findMemberDef
(
cd
,
memName
,
MemberListType_pubMethods
);
if
(
mdef
)
return
mdef
;
}
}
}
// for
}
return
0
;
return
0
;
}
//findMember
}
//findMember
/**
/**
* This function returns the entity|package
* This function returns the entity|package
* in which the key (type) is found
* in which the key (type) is found
*/
*/
MemberDef
*
VhdlDocGen
::
findMemberDef
(
ClassDef
*
cd
,
const
QCString
&
key
,
MemberListType
type
)
MemberDef
*
VhdlDocGen
::
findMemberDef
(
ClassDef
*
cd
,
const
QCString
&
key
,
MemberListType
type
)
{
{
// return cd->getMemberByName(key);//does not work
MemberDef
*
md
=
0
;
MemberDef
*
md
=
0
;
MemberList
*
ml
=
0
;
QCString
keyType
=
cd
->
symbolName
()
+
"@"
+
key
;
//printf("\n %s | %s | %s",cd->symbolName().data(),key.data(,),keyType.data());
MemberList
*
ml
=
cd
->
getMemberList
(
type
);
QMap
<
QCString
,
MemberDef
*>::
Iterator
it
=
varMap
.
find
(
keyType
);
if
(
ml
==
0
)
return
0
;
if
(
it
.
key
())
{
md
=
it
.
data
();
if
(
md
)
{
return
md
;
}
}
if
(
qli
.
contains
(
cd
))
{
return
0
;
}
ml
=
cd
->
getMemberList
(
type
);
qli
.
append
(
cd
);
if
(
!
ml
)
{
return
0
;
}
MemberListIterator
fmni
(
*
ml
);
MemberListIterator
fmni
(
*
ml
);
//int l=ml->count();
// fprintf(stderr,"\n loading enity %s %s: %d",cd->symbolName().data(),keyType.data(),l);
for
(
fmni
.
toFirst
();(
md
=
fmni
.
current
());
++
fmni
)
for
(
fmni
.
toFirst
();(
md
=
fmni
.
current
());
++
fmni
)
{
{
if
(
qstricmp
(
key
,
md
->
name
())
==
0
)
QCString
tkey
=
cd
->
symbolName
()
+
"@"
+
md
->
name
();
if
(
varMap
.
contains
(
tkey
))
{
continue
;
}
varMap
.
insert
(
tkey
.
data
(),
md
);
}
it
=
varMap
.
find
(
keyType
.
data
());
if
(
it
.
key
())
{
md
=
it
.
data
();
if
(
md
)
{
{
return
md
;
return
md
;
}
}
...
@@ -846,42 +875,30 @@ MemberDef* VhdlDocGen::findMemberDef(ClassDef* cd,const QCString& key,MemberList
...
@@ -846,42 +875,30 @@ MemberDef* VhdlDocGen::findMemberDef(ClassDef* cd,const QCString& key,MemberList
* finds all included packages of an Entity or Package
* finds all included packages of an Entity or Package
*/
*/
void
VhdlDocGen
::
findAllPackages
(
const
QCString
&
className
,
QDict
<
QCString
>&
qdict
)
void
VhdlDocGen
::
findAllPackages
(
ClassDef
*
cdef
)
{
{
ClassDef
*
cdef
=
getClass
(
className
);
QList
<
ClassDef
>
cList
;
if
(
cdef
)
if
(
packages
.
contains
(
cdef
))
return
;
{
MemberList
*
mem
=
cdef
->
getMemberList
(
MemberListType_variableMembers
);
MemberList
*
mem
=
cdef
->
getMemberList
(
MemberListType_variableMembers
);
MemberDef
*
md
;
MemberDef
*
md
;
if
(
mem
)
if
(
!
mem
)
return
;
MemberListIterator
fmni
(
*
mem
);
for
(
fmni
.
toFirst
();(
md
=
fmni
.
current
());
++
fmni
)
{
if
(
VhdlDocGen
::
isPackage
(
md
))
{
{
MemberListIterator
fmni
(
*
mem
);
ClassDef
*
cd
=
VhdlDocGen
::
getPackageName
(
md
->
name
()
);
for
(
fmni
.
toFirst
();(
md
=
fmni
.
current
());
++
fmni
)
if
(
cd
)
{
{
if
(
VhdlDocGen
::
isPackage
(
md
))
cList
.
append
(
cd
);
{
VhdlDocGen
::
findAllPackages
(
cd
);
QCString
*
temp1
=
new
QCString
(
md
->
name
().
data
());
packages
.
insert
(
cdef
,
cList
);
//*temp1=temp1->lower();
}
QCString
p
(
md
->
name
().
data
());
}
//p=p.lower();
}
//for
ClassDef
*
cd
=
VhdlDocGen
::
getPackageName
(
*
temp1
);
if
(
cd
)
{
QCString
*
ss
=
qdict
.
find
(
*
temp1
);
if
(
ss
==
0
)
{
qdict
.
insert
(
p
,
temp1
);
QCString
tmp
=
cd
->
className
();
VhdlDocGen
::
findAllPackages
(
tmp
,
qdict
);
}
else
delete
temp1
;
}
else
delete
temp1
;
}
}
//for
}
//if
}
//cdef
}
// findAllPackages
}
// findAllPackages
/*!
/*!
...
@@ -1939,17 +1956,6 @@ void VhdlDocGen::writeVHDLDeclaration(MemberDef* mdef,OutputList &ol,
...
@@ -1939,17 +1956,6 @@ void VhdlDocGen::writeVHDLDeclaration(MemberDef* mdef,OutputList &ol,
Definition
*
d
=
0
;
Definition
*
d
=
0
;
/* some vhdl files contain only a configuration description
library work;
configuration cfg_tb_jtag_gotoBackup of tb_jtag_gotoBackup is
for RTL
end for;
end cfg_tb_jtag_gotoBackup;
in this case library work does not belong to an entity, package ...
*/
ASSERT
(
cd
!=
0
||
nd
!=
0
||
fd
!=
0
||
gd
!=
0
||
ASSERT
(
cd
!=
0
||
nd
!=
0
||
fd
!=
0
||
gd
!=
0
||
mdef
->
getMemberSpecifiers
()
==
VhdlDocGen
::
LIBRARY
||
mdef
->
getMemberSpecifiers
()
==
VhdlDocGen
::
LIBRARY
||
...
@@ -2024,13 +2030,13 @@ void VhdlDocGen::writeVHDLDeclaration(MemberDef* mdef,OutputList &ol,
...
@@ -2024,13 +2030,13 @@ void VhdlDocGen::writeVHDLDeclaration(MemberDef* mdef,OutputList &ol,
ClassDef
*
annoClassDef
=
mdef
->
getClassDefOfAnonymousType
();
ClassDef
*
annoClassDef
=
mdef
->
getClassDefOfAnonymousType
();
// start a new member declaration
// start a new member declaration
bool
isAnonymous
=
annoClassDef
;
// || m_impl->annMemb || m_impl->annEnumType;
uint
isAnonymous
=
(
bool
)(
annoClassDef
)
;
// || m_impl->annMemb || m_impl->annEnumType;
///printf("startMemberItem for %s\n",name().data());
///printf("startMemberItem for %s\n",name().data());
int
mm
=
mdef
->
getMemberSpecifiers
();
int
mm
=
mdef
->
getMemberSpecifiers
();
if
(
mm
==
VhdlDocGen
::
MISCELLANEOUS
)
if
(
mm
==
VhdlDocGen
::
MISCELLANEOUS
)
isAnonymous
=
TRUE
;
isAnonymous
=
3
;
ol
.
startMemberItem
(
mdef
->
anchor
(),
isAnonymous
);
//? 1 : m_impl->tArgList ? 3 : 0);
ol
.
startMemberItem
(
mdef
->
anchor
(),
isAnonymous
);
//? 1 : m_impl->tArgList ? 3 : 0);
// If there is no detailed description we need to write the anchor here.
// If there is no detailed description we need to write the anchor here.
bool
detailsVisible
=
mdef
->
isDetailedSectionLinkable
();
bool
detailsVisible
=
mdef
->
isDetailedSectionLinkable
();
...
@@ -2248,8 +2254,8 @@ void VhdlDocGen::writeVHDLDeclaration(MemberDef* mdef,OutputList &ol,
...
@@ -2248,8 +2254,8 @@ void VhdlDocGen::writeVHDLDeclaration(MemberDef* mdef,OutputList &ol,
if
(
bUnit
)
ol
.
lineBreak
();
if
(
bUnit
)
ol
.
lineBreak
();
if
(
bRec
||
bUnit
)
if
(
bRec
||
bUnit
)
{
{
writeRecorUnit
(
largs
,
ol
,
mdef
);
writeRecorUnit
(
largs
,
ol
,
mdef
);
mdef
->
setType
(
""
);
mdef
->
setType
(
""
);
}
}
ol
.
endBold
();
ol
.
endBold
();
break
;
break
;
...
@@ -2274,8 +2280,8 @@ void VhdlDocGen::writeVHDLDeclaration(MemberDef* mdef,OutputList &ol,
...
@@ -2274,8 +2280,8 @@ void VhdlDocGen::writeVHDLDeclaration(MemberDef* mdef,OutputList &ol,
ol
.
endDoxyAnchor
(
cfname
,
mdef
->
anchor
());
ol
.
endDoxyAnchor
(
cfname
,
mdef
->
anchor
());
}
}
//printf("endMember %s annoClassDef=%p annEnumType=%p\n",
// name().data(),annoClassDef,annEnumType);
// name().data(),annoClassDef,annEnumType);
// if(mm!=VhdlDocGen::MISCELLANEOUS)
ol
.
endMemberItem
();
ol
.
endMemberItem
();
if
(
!
mdef
->
briefDescription
().
isEmpty
()
&&
Config_getBool
(
"BRIEF_MEMBER_DESC"
)
/* && !annMemb */
)
if
(
!
mdef
->
briefDescription
().
isEmpty
()
&&
Config_getBool
(
"BRIEF_MEMBER_DESC"
)
/* && !annMemb */
)
{
{
...
@@ -2592,7 +2598,7 @@ void VhdlDocGen::writeStringLink(const MemberDef *mdef,QCString mem, OutputList&
...
@@ -2592,7 +2598,7 @@ void VhdlDocGen::writeStringLink(const MemberDef *mdef,QCString mem, OutputList&
void
VhdlDocGen
::
writeSource
(
MemberDef
*
mdef
,
OutputList
&
ol
,
QCString
&
cname
)
void
VhdlDocGen
::
writeSource
(
MemberDef
*
mdef
,
OutputList
&
ol
,
QCString
&
cname
)
{
{
ParserInterface
*
pIntf
=
Doxygen
::
parserManager
->
getParser
(
".vhd"
);
ParserInterface
*
pIntf
=
Doxygen
::
parserManager
->
getParser
(
".vhd"
);
pIntf
->
resetCodeParserState
();
//
pIntf->resetCodeParserState();
QCString
codeFragment
=
mdef
->
documentation
();
QCString
codeFragment
=
mdef
->
documentation
();
...
@@ -3363,6 +3369,13 @@ void VhdlDocGen::createFlowChart(const MemberDef *mdef)
...
@@ -3363,6 +3369,13 @@ void VhdlDocGen::createFlowChart(const MemberDef *mdef)
pIntf
->
finishTranslationUnit
();
pIntf
->
finishTranslationUnit
();
}
}
void
VhdlDocGen
::
resetCodeVhdlParserState
()
{
varMap
.
clear
();
qli
.
clear
();
packages
.
clear
();
}
bool
VhdlDocGen
::
isConstraint
(
const
MemberDef
*
mdef
)
bool
VhdlDocGen
::
isConstraint
(
const
MemberDef
*
mdef
)
{
return
mdef
->
getMemberSpecifiers
()
==
VhdlDocGen
::
UCF_CONST
;
}
{
return
mdef
->
getMemberSpecifiers
()
==
VhdlDocGen
::
UCF_CONST
;
}
bool
VhdlDocGen
::
isConfig
(
const
MemberDef
*
mdef
)
bool
VhdlDocGen
::
isConfig
(
const
MemberDef
*
mdef
)
...
@@ -4437,7 +4450,7 @@ void FlowChart::writeFlowLinks(FTextStream &t)
...
@@ -4437,7 +4450,7 @@ void FlowChart::writeFlowLinks(FTextStream &t)
void
VHDLLanguageScanner
::
parseCode
(
CodeOutputInterface
&
codeOutIntf
,
void
VHDLLanguageScanner
::
parseCode
(
CodeOutputInterface
&
codeOutIntf
,
const
char
*
scopeName
,
const
char
*
scopeName
,
const
QCString
&
input
,
const
QCString
&
input
,
SrcLangExt
,
SrcLangExt
,
// lang
bool
isExampleBlock
,
bool
isExampleBlock
,
const
char
*
exampleName
,
const
char
*
exampleName
,
FileDef
*
fileDef
,
FileDef
*
fileDef
,
...
...
src/vhdldocgen.h
View file @
3b8fea2f
...
@@ -108,8 +108,7 @@ class VhdlDocGen
...
@@ -108,8 +108,7 @@ class VhdlDocGen
static
ClassDef
*
getPackageName
(
const
QCString
&
name
);
static
ClassDef
*
getPackageName
(
const
QCString
&
name
);
static
MemberDef
*
findMember
(
const
QCString
&
className
,
static
MemberDef
*
findMember
(
const
QCString
&
className
,
const
QCString
&
memName
);
const
QCString
&
memName
);
static
void
findAllPackages
(
const
QCString
&
className
,
static
void
findAllPackages
(
ClassDef
*
);
QDict
<
QCString
>&
);
static
MemberDef
*
findMemberDef
(
ClassDef
*
cd
,
static
MemberDef
*
findMemberDef
(
ClassDef
*
cd
,
const
QCString
&
key
,
const
QCString
&
key
,
MemberListType
type
);
MemberListType
type
);
...
@@ -246,7 +245,7 @@ class VhdlDocGen
...
@@ -246,7 +245,7 @@ class VhdlDocGen
cu
->
spec
==
VhdlDocGen
::
PACKAGE_BODY
;
cu
->
spec
==
VhdlDocGen
::
PACKAGE_BODY
;
}
}
static
void
resetCodeVhdlParserState
();
private
:
private
:
static
void
findAllArchitectures
(
QList
<
QCString
>&
ql
,
const
ClassDef
*
cd
);
static
void
findAllArchitectures
(
QList
<
QCString
>&
ql
,
const
ClassDef
*
cd
);
...
...
src/vhdljjparser.cpp
View file @
3b8fea2f
This diff is collapsed.
Click to expand it.
src/vhdljjparser.h
View file @
3b8fea2f
...
@@ -11,15 +11,17 @@
...
@@ -11,15 +11,17 @@
#include <qfile.h>
#include <qfile.h>
#include <qdict.h>
#include <qdict.h>
#include <string>
#include <string>
#include "memberlist.h"
#include "types.h"
#include "types.h"
#include "entry.h"
#include "entry.h"
#include "vhdldocgen.h"
#include "vhdldocgen.h"
#include "qstringlist.h"
#include "qstringlist.h"
#include "vhdlcode.h"
#include "vhdlcode.h"
#include "memberlist.h"
#include "config.h"
#include "config.h"
enum
{
GEN_SEC
=
0x1
,
PARAM_SEC
,
CONTEXT_SEC
,
PROTECTED_SEC
}
;
enum
{
GEN_SEC
=
0x1
,
PARAM_SEC
,
CONTEXT_SEC
,
PROTECTED_SEC
}
;
void
parserVhdlfile
(
const
char
*
inputBuffer
);
void
parserVhdlfile
(
const
char
*
inputBuffer
);
...
@@ -29,7 +31,8 @@ class FileStorage;
...
@@ -29,7 +31,8 @@ class FileStorage;
class
ClassDef
;
class
ClassDef
;
class
MemberDef
;
class
MemberDef
;
class
QStringList
;
class
QStringList
;
class
VhdlConfNode
;
struct
VhdlConfNode
;
/** \brief VHDL parser using state-based lexical scanning.
/** \brief VHDL parser using state-based lexical scanning.
*
*
...
@@ -46,8 +49,8 @@ class VHDLLanguageScanner : public ParserInterface
...
@@ -46,8 +49,8 @@ class VHDLLanguageScanner : public ParserInterface
Entry
*
root
,
Entry
*
root
,
bool
sameTranslationUnit
,
bool
sameTranslationUnit
,
QStrList
&
filesInSameTranslationUnit
);
QStrList
&
filesInSameTranslationUnit
);
void
parseCode
(
CodeOutputInterface
&
codeOutIntf
,
void
parseCode
(
CodeOutputInterface
&
codeOutIntf
,
const
char
*
scopeName
,
const
char
*
scopeName
,
const
QCString
&
input
,
const
QCString
&
input
,
SrcLangExt
lang
,
SrcLangExt
lang
,
...
@@ -60,39 +63,40 @@ class VHDLLanguageScanner : public ParserInterface
...
@@ -60,39 +63,40 @@ class VHDLLanguageScanner : public ParserInterface
MemberDef
*
memberDef
=
0
,
MemberDef
*
memberDef
=
0
,
bool
showLineNumbers
=
TRUE
,
bool
showLineNumbers
=
TRUE
,
Definition
*
searchCtx
=
0
,
Definition
*
searchCtx
=
0
,
bool
collectXRefs
=
TRUE
);
bool
collectXRefs
=
TRUE
);
bool
needsPreprocessing
(
const
QCString
&
)
{
return
TRUE
;
}
bool
needsPreprocessing
(
const
QCString
&
)
{
return
TRUE
;
}
void
resetCodeParserState
()
{}
void
resetCodeParserState
(){};
void
parsePrototype
(
const
char
*
)
{}
void
parsePrototype
(
const
char
*
text
);
};
};
class
VhdlConfNode
struct
VhdlConfNode
{
{
public
:
VhdlConfNode
(
const
char
*
a
,
const
char
*
b
,
const
char
*
config
,
const
char
*
cs
,
bool
leaf
)
VhdlConfNode
(
const
char
*
a
,
const
char
*
b
,
const
char
*
config
,
const
char
*
cs
,
bool
leaf
)
{
{
arch
=
a
;
// architecture e.g. for iobuffer
arch
=
a
;
// architecture e.g. for iobuffer
arch
=
arch
.
lower
();
arch
=
arch
.
lower
();
binding
=
b
;
// binding e.g. use entiy work.xxx(bev)
binding
=
b
;
// binding e.g. use entiy work.xxx(bev)
binding
=
binding
.
lower
();
binding
=
binding
.
lower
();
confVhdl
=
config
;
// configuration foo is bar
confVhdl
=
config
;
// configuration foo is bar
compSpec
=
cs
;
compSpec
=
cs
;
isInlineConf
=
false
;
// primary configuration?
isInlineConf
=
false
;
// primary configuration?
isLeaf
=
leaf
;
isLeaf
=
leaf
;
};
};
QCString
confVhdl
;
QCString
arch
;
QCString
binding
;
QCString
compSpec
;
int
level
;
bool
isLeaf
;
bool
isInlineConf
;
QCString
confVhdl
;
QCString
arch
;
QCString
binding
;
QCString
compSpec
;
int
level
;
bool
isLeaf
;
bool
isInlineConf
;
};
};
void
vhdlscanFreeScanner
();
void
vhdlscanFreeScanner
();
QList
<
VhdlConfNode
>&
getVhdlConfiguration
();
QList
<
VhdlConfNode
>&
getVhdlConfiguration
();
QList
<
Entry
>&
getVhdlInstList
();
QList
<
Entry
>&
getVhdlInstList
();
#endif
#endif
vhdlparser/ErrorHandler.h
View file @
3b8fea2f
/* Generated By:JavaCC: Do not edit this line. ErrorHandler.h Version 6.0 */
/* Generated By:JavaCC: Do not edit this line. ErrorHandler.h Version 6.0 */
/* JavaCCOptions:STATIC=false,SUPPORT_CLASS_VISIBILITY_PUBLIC=true */
/* JavaCCOptions:STATIC=false,SUPPORT_CLASS_VISIBILITY_PUBLIC=true
,BUILD_PARSER=true,BUILD_TOKEN_MANAGER=true
*/
#ifndef ERRORHANDLER_H
#ifndef ERRORHANDLER_H
#define ERRORHANDLER_H
#define ERRORHANDLER_H
#include <string>
//
#include <string>
#include "JavaCC.h"
#include "JavaCC.h"
#include "Token.h"
#include "Token.h"
namespace
vhdl
{
namespace
vhdl
{
namespace
parser
{
namespace
parser
{
class
VhdlParser
;
//JAVACC_SIMPLE_STRING addUnicodeEscapes(JAVACC_STRING_TYPE str);
class
VhdlParser
;
class
ErrorHandler
{
class
ErrorHandler
{
friend
class
VhdlParserTokenManager
;
friend
class
VhdlParser
;
protected
:
protected
:
int
error_count
;
int
error_count
;
public
:
public
:
...
@@ -18,26 +23,56 @@ class VhdlParser;
...
@@ -18,26 +23,56 @@ class VhdlParser;
// expectedKind - token kind that the parser was trying to consume.
// expectedKind - token kind that the parser was trying to consume.
// expectedToken - the image of the token - tokenImages[expectedKind].
// expectedToken - the image of the token - tokenImages[expectedKind].
// actual - the actual token that the parser got instead.
// actual - the actual token that the parser got instead.
virtual
void
handleUnexpectedToken
(
int
,
JAVACC_STRING_TYPE
expectedToken
,
Token
*
actual
,
VhdlParser
*
)
{
virtual
void
handleUnexpectedToken
(
int
,
JAVACC_STRING_TYPE
,
Token
*
,
VhdlParser
*
)
{
error_count
++
;
error_count
++
;
fprintf
(
stderr
,
"Expecting %s at: %d:%d but got %s
\n
"
,
addUnicodeEscapes
(
expectedToken
).
c_str
(),
actual
->
beginLine
,
actual
->
beginColumn
,
addUnicodeEscapes
(
actual
->
image
).
c_str
());
//
fprintf(stderr, "Expecting %s at: %d:%d but got %s\n", addUnicodeEscapes(expectedToken).c_str(), actual->beginLine, actual->beginColumn, addUnicodeEscapes(actual->image).c_str());
}
}
// Called when the parser cannot continue parsing.
// Called when the parser cannot continue parsing.
// last - the last token successfully parsed.
// last - the last token successfully parsed.
// unexpected - the token at which the error occurs.
// unexpected - the token at which the error occurs.
// production - the production in which this error occurrs.
// production - the production in which this error occurrs.
virtual
void
handleParseError
(
Token
*
,
Token
*
unexpected
,
JAVACC_SIMPLE_STRING
production
,
VhdlParser
*
)
{
virtual
void
handleParseError
(
Token
*
,
Token
*
,
JAVACC_SIMPLE_STRING
,
VhdlParser
*
)
{
error_count
++
;
error_count
++
;
fprintf
(
stderr
,
"Encountered: %s at: %d:%d while parsing: %s
\n
"
,
addUnicodeEscapes
(
unexpected
->
image
).
c_str
(),
unexpected
->
beginLine
,
unexpected
->
beginColumn
,
production
.
c_str
());
//
fprintf(stderr, "Encountered: %s at: %d:%d while parsing: %s\n", addUnicodeEscapes(unexpected->image).c_str(), unexpected->beginLine, unexpected->beginColumn, production.c_str());
}
}
virtual
int
getErrorCount
()
{
virtual
int
getErrorCount
()
{
return
error_count
;
return
error_count
;
}
}
virtual
void
handleOtherError
(
JAVACC_STRING_TYPE
message
,
VhdlParser
*
)
{
fprintf
(
stderr
,
"Error: %s
\n
"
,
(
char
*
)
message
.
c_str
());
}
virtual
~
ErrorHandler
()
{}
virtual
~
ErrorHandler
()
{}
ErrorHandler
()
{
error_count
=
0
;
}
ErrorHandler
()
{
error_count
=
0
;
}
};
};
class
VhdlParserTokenManager
;
class
TokenManagerErrorHandler
{
friend
class
VhdlParserTokenManager
;
protected
:
int
error_count
;
public
:
// Returns a detailed message for the Error when it is thrown by the
// token manager to indicate a lexical error.
// Parameters :
// EOFSeen : indicates if EOF caused the lexical error
// curLexState : lexical state in which this error occurred
// errorLine : line number when the error occurred
// errorColumn : column number when the error occurred
// errorAfter : prefix that was seen before this error occurred
// curchar : the offending character
//
virtual
void
lexicalError
(
bool
EOFSeen
,
int
/*lexState*/
,
int
errorLine
,
int
errorColumn
,
JAVACC_STRING_TYPE
errorAfter
,
JAVACC_CHAR_TYPE
curChar
,
VhdlParserTokenManager
*
)
{
// by default, we just print an error message and return.
fprintf
(
stderr
,
"Lexical error at: %d:%d. Encountered: %c after: %s.
\n
"
,
errorLine
,
errorColumn
,
curChar
,
(
EOFSeen
?
"EOF"
:
(
const
char
*
)
errorAfter
.
c_str
()));
}
virtual
void
lexicalError
(
JAVACC_STRING_TYPE
errorMessage
,
VhdlParserTokenManager
*
)
{
fprintf
(
stderr
,
"%s
\n
"
,
(
char
*
)
errorMessage
.
c_str
());
}
virtual
~
TokenManagerErrorHandler
()
{}
};
}
}
}
}
#endif
#endif
/* JavaCC - OriginalChecksum=
282223c3bcb53b7ff385aed35944d185
(do not edit this line) */
/* JavaCC - OriginalChecksum=
685d19cb4cd943b60089f599e45f23ad
(do not edit this line) */
vhdlparser/JavaCC.h
View file @
3b8fea2f
...
@@ -3,7 +3,7 @@
...
@@ -3,7 +3,7 @@
#ifndef __JAVACC_H
#ifndef __JAVACC_H
#define __JAVACC_H
#define __JAVACC_H
#include <stdio.h>
#include <stdio.h>
#include <string>
#include <string
.h
>
#include <memory.h>
#include <memory.h>
#include <assert.h>
#include <assert.h>
#include <cstring>
#include <cstring>
...
@@ -24,6 +24,7 @@
...
@@ -24,6 +24,7 @@
JAVACC_SIMPLE_STRING
addUnicodeEscapes
(
JAVACC_STRING_TYPE
str
);
JAVACC_SIMPLE_STRING
addUnicodeEscapes
(
JAVACC_STRING_TYPE
str
);
typedef
JAVACC_STRING_TYPE
StringBuffer
;
typedef
JAVACC_STRING_TYPE
StringBuffer
;
typedef
JAVACC_STRING_TYPE
String
;
typedef
JAVACC_STRING_TYPE
String
;
...
...
vhdlparser/JavaCC.h.in
View file @
3b8fea2f
...
@@ -3,7 +3,7 @@
...
@@ -3,7 +3,7 @@
#ifndef __JAVACC_H
#ifndef __JAVACC_H
#define __JAVACC_H
#define __JAVACC_H
#include <stdio.h>
#include <stdio.h>
#include <string>
#include <string
.h
>
#include <memory.h>
#include <memory.h>
#include <assert.h>
#include <assert.h>
#include <cstring>
#include <cstring>
...
@@ -24,6 +24,7 @@
...
@@ -24,6 +24,7 @@
JAVACC_SIMPLE_STRING addUnicodeEscapes(JAVACC_STRING_TYPE str);
JAVACC_SIMPLE_STRING addUnicodeEscapes(JAVACC_STRING_TYPE str);
typedef JAVACC_STRING_TYPE StringBuffer;
typedef JAVACC_STRING_TYPE StringBuffer;
typedef JAVACC_STRING_TYPE String;
typedef JAVACC_STRING_TYPE String;
...
...
vhdlparser/TokenMgrError.cc
View file @
3b8fea2f
...
@@ -61,11 +61,8 @@ namespace parser {
...
@@ -61,11 +61,8 @@ namespace parser {
errorCode
=
reason
;
errorCode
=
reason
;
}
}
}
}
// i < 16 - guaranteed
// i < 16 - guaranteed
static
char
hexChar
(
int
i
)
{
char
hexChar
(
int
i
)
{
if
(
i
<
10
)
{
if
(
i
<
10
)
{
return
i
-
'0'
;
return
i
-
'0'
;
}
}
...
@@ -118,4 +115,7 @@ JAVACC_SIMPLE_STRING addUnicodeEscapes(JAVACC_STRING_TYPE str) {
...
@@ -118,4 +115,7 @@ JAVACC_SIMPLE_STRING addUnicodeEscapes(JAVACC_STRING_TYPE str) {
}
}
return
retval
;
return
retval
;
}
}
/* JavaCC - OriginalChecksum=7f80e3c4eac120168f5e81d4ddb72e4b (do not edit this line) */
}
}
/* JavaCC - OriginalChecksum=2bf63f131c8e60fd30c70d0b4f660016 (do not edit this line) */
vhdlparser/VhdlParser.cc
View file @
3b8fea2f
This diff is collapsed.
Click to expand it.
vhdlparser/VhdlParser.h
View file @
3b8fea2f
This diff is collapsed.
Click to expand it.
vhdlparser/VhdlParserConstants.h
View file @
3b8fea2f
This diff is collapsed.
Click to expand it.
vhdlparser/VhdlParserErrorHandler.hpp
View file @
3b8fea2f
...
@@ -6,6 +6,7 @@
...
@@ -6,6 +6,7 @@
#include <exception>
#include <exception>
#include "VhdlParser.h"
#include "VhdlParser.h"
#include "ErrorHandler.h"
#include "ErrorHandler.h"
#include "vhdlstring.h"
namespace
vhdl
{
namespace
parser
{
namespace
vhdl
{
namespace
parser
{
...
...
vhdlparser/VhdlParserIF.cpp
View file @
3b8fea2f
...
@@ -7,7 +7,7 @@
...
@@ -7,7 +7,7 @@
using
namespace
vhdl
::
parser
;
using
namespace
vhdl
::
parser
;
static
VhdlParser
*
myParser
;
static
VhdlParser
*
myParser
=
0
;
void
VhdlParserIF
::
parseVhdlfile
(
const
char
*
inputBuffer
,
bool
inLine
)
void
VhdlParserIF
::
parseVhdlfile
(
const
char
*
inputBuffer
,
bool
inLine
)
{
{
...
@@ -28,13 +28,11 @@ void VhdlParserIF::parseVhdlfile(const char* inputBuffer,bool inLine)
...
@@ -28,13 +28,11 @@ void VhdlParserIF::parseVhdlfile(const char* inputBuffer,bool inLine)
myParser
->
design_file
();
myParser
->
design_file
();
}
}
}
}
catch
(
std
::
exception
&
)
catch
(
std
::
exception
&
){
/* fprintf(stderr,"\n[%s]",e.what()); */
}
{
/* fprintf(stderr,"\n[%s]",e.what()); */
}
// fprintf(stderr,"\n\nparsed lines: %d\n",yyLineNr);
// fprintf(stderr,"\n\nparsed lines: %d\n",yyLineNr);
// fprintf(stderr,"\n\nerrors : %d\n\n",myErr->getErrorCount());
// fprintf(stderr,"\n\nerrors : %d\n\n",myErr->getErrorCount());
delete
myParser
;
delete
myParser
;
}
}
void
VhdlParser
::
error_skipto
(
int
kind
)
void
VhdlParser
::
error_skipto
(
int
kind
)
...
@@ -42,8 +40,9 @@ void VhdlParser::error_skipto(int kind)
...
@@ -42,8 +40,9 @@ void VhdlParser::error_skipto(int kind)
Token
*
op
;
Token
*
op
;
do
do
{
{
op
=
myParser
->
getToken
(
1
);
Token
*
t
=
myParser
->
getNextToken
();
// step to next token
if
(
op
==
0
)
break
;
op
=
myParser
->
getToken
(
1
);
// get first token
if
(
op
==
0
)
break
;
//fprintf(stderr,"\n %s",t->image.data());
//fprintf(stderr,"\n %s",t->image.data());
}
while
(
op
->
kind
!=
kind
);
}
while
(
op
->
kind
!=
kind
);
myParser
->
hasError
=
false
;
myParser
->
hasError
=
false
;
...
...
vhdlparser/VhdlParserTokenManager.cc
View file @
3b8fea2f
This diff is collapsed.
Click to expand it.
vhdlparser/VhdlParserTokenManager.h
View file @
3b8fea2f
...
@@ -3,6 +3,7 @@
...
@@ -3,6 +3,7 @@
#include "JavaCC.h"
#include "JavaCC.h"
#include "CharStream.h"
#include "CharStream.h"
#include "Token.h"
#include "Token.h"
#include "ErrorHandler.h"
#include "TokenManager.h"
#include "TokenManager.h"
#include "VhdlParserConstants.h"
#include "VhdlParserConstants.h"
#include "VhdlParser.h"
#include "VhdlParser.h"
...
@@ -78,8 +79,6 @@ Token * getNextToken();
...
@@ -78,8 +79,6 @@ Token * getNextToken();
void
SkipLexicalActions
(
Token
*
matchedToken
);
void
SkipLexicalActions
(
Token
*
matchedToken
);
void
MoreLexicalActions
();
void
TokenLexicalActions
(
Token
*
matchedToken
);
void
TokenLexicalActions
(
Token
*
matchedToken
);
#define jjCheckNAdd(state)\
#define jjCheckNAdd(state)\
{\
{\
...
@@ -120,13 +119,20 @@ void TokenLexicalActions(Token *matchedToken);
...
@@ -120,13 +119,20 @@ void TokenLexicalActions(Token *matchedToken);
const
JAVACC_SIMPLE_STRING
jjKindsForBitVector
(
int
i
,
unsigned
long
long
vec
);
const
JAVACC_SIMPLE_STRING
jjKindsForBitVector
(
int
i
,
unsigned
long
long
vec
);
const
JAVACC_SIMPLE_STRING
jjKindsForStateVector
(
int
lexState
,
int
vec
[],
int
start
,
int
end
);
const
JAVACC_SIMPLE_STRING
jjKindsForStateVector
(
int
lexState
,
int
vec
[],
int
start
,
int
end
);
JAVACC_CHARSTREAM
*
input_stream
;
JAVACC_CHARSTREAM
*
input_stream
;
int
jjrounds
[
6
5
];
int
jjrounds
[
7
5
];
int
jjstateSet
[
2
*
6
5
];
int
jjstateSet
[
2
*
7
5
];
JAVACC_STRING_TYPE
jjimage
;
JAVACC_STRING_TYPE
jjimage
;
JAVACC_STRING_TYPE
image
;
JAVACC_STRING_TYPE
image
;
int
jjimageLen
;
int
jjimageLen
;
int
lengthOfMatch
;
int
lengthOfMatch
;
JAVACC_CHAR_TYPE
curChar
;
JAVACC_CHAR_TYPE
curChar
;
TokenManagerErrorHandler
*
errorHandler
;
bool
errorHandlerCreated
;
public
:
void
setErrorHandler
(
TokenManagerErrorHandler
*
eh
)
{
if
(
errorHandlerCreated
&&
errorHandler
!=
NULL
)
delete
errorHandler
;
errorHandler
=
eh
;
errorHandlerCreated
=
false
;
}
};
};
}
}
}
}
...
...
vhdlparser/vhdlparser.jj
View file @
3b8fea2f
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment