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
475b0c51
Commit
475b0c51
authored
Nov 06, 2014
by
Dimitri van Heesch
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Various VHDL fixes
parent
e5076edf
Changes
24
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
24 changed files
with
1248 additions
and
1217 deletions
+1248
-1217
classdef.cpp
src/classdef.cpp
+7
-1
libdoxygen.pro.in
src/libdoxygen.pro.in
+1
-1
vhdldocgen.cpp
src/vhdldocgen.cpp
+0
-15
vhdljjparser.cpp
src/vhdljjparser.cpp
+51
-40
CharStream.cc
vhdlparser/CharStream.cc
+2
-2
CharStream.h
vhdlparser/CharStream.h
+94
-100
ErrorHandler.h
vhdlparser/ErrorHandler.h
+12
-11
JavaCC.h
vhdlparser/JavaCC.h
+8
-17
JavaCC.h.in
vhdlparser/JavaCC.h.in
+8
-17
Makefile.in
vhdlparser/Makefile.in
+1
-2
ParseException.cc
vhdlparser/ParseException.cc
+2
-4
ParseException.h
vhdlparser/ParseException.h
+2
-2
Token.cc
vhdlparser/Token.cc
+2
-2
Token.h
vhdlparser/Token.h
+4
-3
TokenManager.h
vhdlparser/TokenManager.h
+6
-6
TokenMgrError.cc
vhdlparser/TokenMgrError.cc
+2
-5
TokenMgrError.h
vhdlparser/TokenMgrError.h
+12
-11
VhdlParser.cc
vhdlparser/VhdlParser.cc
+118
-112
VhdlParser.h
vhdlparser/VhdlParser.h
+286
-271
VhdlParserTokenManager.cc
vhdlparser/VhdlParserTokenManager.cc
+41
-15
VhdlParserTokenManager.h
vhdlparser/VhdlParserTokenManager.h
+16
-11
vhdlparser.jj
vhdlparser/vhdlparser.jj
+571
-558
vhdlparser.patch
vhdlparser/vhdlparser.patch
+0
-10
vhdlstring.h
vhdlparser/vhdlstring.h
+2
-1
No files found.
src/classdef.cpp
View file @
475b0c51
...
@@ -4235,6 +4235,12 @@ void ClassDef::writeMemberDeclarations(OutputList &ol,MemberListType lt,const QC
...
@@ -4235,6 +4235,12 @@ void ClassDef::writeMemberDeclarations(OutputList &ol,MemberListType lt,const QC
MemberList
*
ml2
=
getMemberList
((
MemberListType
)
lt2
);
MemberList
*
ml2
=
getMemberList
((
MemberListType
)
lt2
);
if
(
getLanguage
()
==
SrcLangExt_VHDL
)
// use specific declarations function
if
(
getLanguage
()
==
SrcLangExt_VHDL
)
// use specific declarations function
{
{
static
ClassDef
*
cdef
;
if
(
cdef
!=
this
)
{
// only one inline link
VhdlDocGen
::
writeInlineClassLink
(
this
,
ol
);
cdef
=
this
;
}
if
(
ml
)
if
(
ml
)
{
{
VhdlDocGen
::
writeVhdlDeclarations
(
ml
,
ol
,
0
,
this
,
0
,
0
);
VhdlDocGen
::
writeVhdlDeclarations
(
ml
,
ol
,
0
,
this
,
0
,
0
);
...
...
src/libdoxygen.pro.in
View file @
475b0c51
...
@@ -231,7 +231,7 @@ linux-g++:TMAKE_CXXFLAGS += -fno-exceptions
...
@@ -231,7 +231,7 @@ linux-g++:TMAKE_CXXFLAGS += -fno-exceptions
INCLUDEPATH += ../generated_src/doxygen ../src ../qtools ../libmd5 ../vhdlparser
INCLUDEPATH += ../generated_src/doxygen ../src ../qtools ../libmd5 ../vhdlparser
INCLUDEPATH += %%SQLITE3_INC%%
INCLUDEPATH += %%SQLITE3_INC%%
INCLUDEPATH += %%LIBCLANG_INC%%
INCLUDEPATH += %%LIBCLANG_INC%%
DEPENDPATH += ../generated_src/doxygen
DEPENDPATH += ../generated_src/doxygen
../qtools ../libmd5 ../vhdlparser
win32:INCLUDEPATH += .
win32:INCLUDEPATH += .
DESTDIR = ../lib
DESTDIR = ../lib
TARGET = doxygen
TARGET = doxygen
...
...
src/vhdldocgen.cpp
View file @
475b0c51
...
@@ -1785,21 +1785,6 @@ QCString VhdlDocGen::convertArgumentListToString(const ArgumentList* al,bool fun
...
@@ -1785,21 +1785,6 @@ QCString VhdlDocGen::convertArgumentListToString(const ArgumentList* al,bool fun
void
VhdlDocGen
::
writeVhdlDeclarations
(
MemberList
*
ml
,
void
VhdlDocGen
::
writeVhdlDeclarations
(
MemberList
*
ml
,
OutputList
&
ol
,
GroupDef
*
gd
,
ClassDef
*
cd
,
FileDef
*
fd
,
NamespaceDef
*
nd
)
OutputList
&
ol
,
GroupDef
*
gd
,
ClassDef
*
cd
,
FileDef
*
fd
,
NamespaceDef
*
nd
)
{
{
static
ClassDef
*
cdef
;
//static GroupDef* gdef;
if
(
cd
&&
cdef
!=
cd
)
{
// only one inline link
VhdlDocGen
::
writeInlineClassLink
(
cd
,
ol
);
cdef
=
cd
;
}
/*
if (gd && gdef==gd) return;
if (gd && gdef!=gd)
{
gdef=gd;
}
*/
VhdlDocGen
::
writeVHDLDeclarations
(
ml
,
ol
,
cd
,
nd
,
fd
,
gd
,
theTranslator_vhdlType
(
VhdlDocGen
::
LIBRARY
,
FALSE
),
0
,
FALSE
,
VhdlDocGen
::
LIBRARY
);
VhdlDocGen
::
writeVHDLDeclarations
(
ml
,
ol
,
cd
,
nd
,
fd
,
gd
,
theTranslator_vhdlType
(
VhdlDocGen
::
LIBRARY
,
FALSE
),
0
,
FALSE
,
VhdlDocGen
::
LIBRARY
);
VhdlDocGen
::
writeVHDLDeclarations
(
ml
,
ol
,
cd
,
nd
,
fd
,
gd
,
theTranslator_vhdlType
(
VhdlDocGen
::
USE
,
FALSE
),
0
,
FALSE
,
VhdlDocGen
::
USE
);
VhdlDocGen
::
writeVHDLDeclarations
(
ml
,
ol
,
cd
,
nd
,
fd
,
gd
,
theTranslator_vhdlType
(
VhdlDocGen
::
USE
,
FALSE
),
0
,
FALSE
,
VhdlDocGen
::
USE
);
VhdlDocGen
::
writeVHDLDeclarations
(
ml
,
ol
,
cd
,
nd
,
fd
,
gd
,
theTranslator_vhdlType
(
VhdlDocGen
::
FUNCTION
,
FALSE
),
0
,
FALSE
,
VhdlDocGen
::
FUNCTION
);
VhdlDocGen
::
writeVHDLDeclarations
(
ml
,
ol
,
cd
,
nd
,
fd
,
gd
,
theTranslator_vhdlType
(
VhdlDocGen
::
FUNCTION
,
FALSE
),
0
,
FALSE
,
VhdlDocGen
::
FUNCTION
);
...
...
src/vhdljjparser.cpp
View file @
475b0c51
...
@@ -42,26 +42,6 @@ static int iDocLine = -1;
...
@@ -42,26 +42,6 @@ static int iDocLine = -1;
static
QCString
inputString
;
static
QCString
inputString
;
static
Entry
gBlock
;
static
Entry
gBlock
;
static
Entry
*
previous
=
0
;
static
Entry
*
previous
=
0
;
#if 0
int iLine;
QStringList qrl;
ParserInterface *g_thisParser;
int inputPosition;
int inputLen;
int startComment = 0;
QFile inputFile;
QCString inbuf;
QCString yyFileName;
bool g_lexInit = FALSE;
int yyLineNr = 1;
int g_lastCommentContext = 0;
bool docBlockAutoBrief;
char docBlockTerm;
int iDocLine = -1;
int num_chars;
int* lineParse;
#endif
//-------------------------------------------------------
//-------------------------------------------------------
static
Entry
*
oldEntry
;
static
Entry
*
oldEntry
;
...
@@ -124,7 +104,6 @@ void startCodeBlock(int index)
...
@@ -124,7 +104,6 @@ void startCodeBlock(int index)
int
ll
=
strComment
.
length
();
int
ll
=
strComment
.
length
();
iCodeLen
=
inputString
.
findRev
(
strComment
.
data
())
+
ll
;
iCodeLen
=
inputString
.
findRev
(
strComment
.
data
())
+
ll
;
// fprintf(stderr,"\n startin code..%d %d %d\n",iCodeLen,num_chars,ll);
// fprintf(stderr,"\n startin code..%d %d %d\n",iCodeLen,num_chars,ll);
//assert(false);
gBlock
.
reset
();
gBlock
.
reset
();
int
len
=
strComment
.
length
();
int
len
=
strComment
.
length
();
QCString
name
=
strComment
.
right
(
len
-
index
);
//
QCString
name
=
strComment
.
right
(
len
-
index
);
//
...
@@ -134,8 +113,6 @@ void startCodeBlock(int index)
...
@@ -134,8 +113,6 @@ void startCodeBlock(int index)
else
else
gBlock
.
name
=
name
;
gBlock
.
name
=
name
;
//int li=strComment.contains('\n');
gBlock
.
startLine
=
yyLineNr
;
gBlock
.
startLine
=
yyLineNr
;
gBlock
.
bodyLine
=
yyLineNr
;
gBlock
.
bodyLine
=
yyLineNr
;
...
@@ -232,7 +209,10 @@ void VHDLLanguageScanner::parseInput(const char *fileName,const char *fileBuf,En
...
@@ -232,7 +209,10 @@ void VHDLLanguageScanner::parseInput(const char *fileName,const char *fileBuf,En
VhdlDocGen
::
resetCodeVhdlParserState
();
VhdlDocGen
::
resetCodeVhdlParserState
();
}
}
void
VhdlParser
::
lineCount
(){
yyLineNr
++
;
}
void
VhdlParser
::
lineCount
()
{
yyLineNr
++
;
}
void
VhdlParser
::
lineCount
(
const
char
*
text
)
void
VhdlParser
::
lineCount
(
const
char
*
text
)
{
{
...
@@ -309,7 +289,6 @@ bool checkInlineCode(QCString & doc)
...
@@ -309,7 +289,6 @@ bool checkInlineCode(QCString & doc)
void
VhdlParser
::
handleFlowComment
(
const
char
*
doc
)
void
VhdlParser
::
handleFlowComment
(
const
char
*
doc
)
{
{
lineCount
(
doc
);
if
(
VhdlDocGen
::
getFlowMember
())
if
(
VhdlDocGen
::
getFlowMember
())
{
{
QCString
qcs
(
doc
);
QCString
qcs
(
doc
);
...
@@ -319,6 +298,7 @@ void VhdlParser::handleFlowComment(const char* doc)
...
@@ -319,6 +298,7 @@ void VhdlParser::handleFlowComment(const char* doc)
}
}
}
}
void
VhdlParser
::
handleCommentBlock
(
const
char
*
doc1
,
bool
brief
)
void
VhdlParser
::
handleCommentBlock
(
const
char
*
doc1
,
bool
brief
)
{
{
int
position
=
0
;
int
position
=
0
;
...
@@ -328,7 +308,7 @@ void VhdlParser::handleCommentBlock(const char* doc1,bool brief)
...
@@ -328,7 +308,7 @@ void VhdlParser::handleCommentBlock(const char* doc1,bool brief)
if
(
checkMultiComment
(
doc
,
yyLineNr
))
if
(
checkMultiComment
(
doc
,
yyLineNr
))
{
{
lineCount
(
doc1
);
strComment
.
resize
(
0
);
return
;
return
;
}
}
...
@@ -345,7 +325,6 @@ void VhdlParser::handleCommentBlock(const char* doc1,bool brief)
...
@@ -345,7 +325,6 @@ void VhdlParser::handleCommentBlock(const char* doc1,bool brief)
if
(
isIn
)
if
(
isIn
)
{
{
isIn
=
false
;
isIn
=
false
;
lineCount
(
doc1
);
return
;
return
;
}
}
...
@@ -353,7 +332,9 @@ void VhdlParser::handleCommentBlock(const char* doc1,bool brief)
...
@@ -353,7 +332,9 @@ void VhdlParser::handleCommentBlock(const char* doc1,bool brief)
bool
needsEntry
=
FALSE
;
bool
needsEntry
=
FALSE
;
Protection
protection
=
Public
;
Protection
protection
=
Public
;
int
lineNr
=
iDocLine
;
int
lineNr
;
if
(
iDocLine
==-
1
)
lineNr
=
yyLineNr
;
if
(
oldEntry
==
current
)
if
(
oldEntry
==
current
)
{
{
...
@@ -375,13 +356,13 @@ void VhdlParser::handleCommentBlock(const char* doc1,bool brief)
...
@@ -375,13 +356,13 @@ void VhdlParser::handleCommentBlock(const char* doc1,bool brief)
{
{
current
->
docLine
=
yyLineNr
;
current
->
docLine
=
yyLineNr
;
}
}
// printf("parseCommentBlock file<%s>\n [%s]\n
",yyFileName.data(),doc.data()
);
// printf("parseCommentBlock file<%s>\n [%s]\n
at line [%d] \n ",yyFileName.data(),doc.data(),iDocLine
);
while
(
parseCommentBlock
(
while
(
parseCommentBlock
(
g_thisParser
,
g_thisParser
,
current
,
current
,
doc
,
// text
doc
,
// text
yyFileName
,
// file
yyFileName
,
// file
lineNr
,
// line of block start
iDocLine
,
// line of block start
brief
,
brief
,
0
,
0
,
FALSE
,
FALSE
,
...
@@ -405,7 +386,8 @@ void VhdlParser::handleCommentBlock(const char* doc1,bool brief)
...
@@ -405,7 +386,8 @@ void VhdlParser::handleCommentBlock(const char* doc1,bool brief)
}
}
newEntry
();
newEntry
();
}
}
lineCount
(
doc1
);
iDocLine
=-
1
;
strComment
.
resize
(
0
);
}
}
void
VHDLLanguageScanner
::
parsePrototype
(
const
char
*
text
)
void
VHDLLanguageScanner
::
parsePrototype
(
const
char
*
text
)
...
@@ -571,12 +553,10 @@ void VhdlParser::addConfigureNode(const char* a,const char*b, bool,bool isLeaf,b
...
@@ -571,12 +553,10 @@ void VhdlParser::addConfigureNode(const char* a,const char*b, bool,bool isLeaf,b
QCString
ent
,
arch
,
lab
;
QCString
ent
,
arch
,
lab
;
QCString
l
=
genLabels
;
QCString
l
=
genLabels
;
ent
=
a
;
ent
=
a
;
// lab = VhdlDocGen::parseForConfig(ent,arch);
if
(
b
)
if
(
b
)
{
{
ent
=
b
;
ent
=
b
;
// lab=VhdlDocGen::parseForBinding(ent,arch);
}
}
int
level
=
0
;
int
level
=
0
;
...
@@ -619,8 +599,7 @@ void VhdlParser::addConfigureNode(const char* a,const char*b, bool,bool isLeaf,b
...
@@ -619,8 +599,7 @@ void VhdlParser::addConfigureNode(const char* a,const char*b, bool,bool isLeaf,b
}
}
configL
.
append
(
co
);
configL
.
append
(
co
);
}
}
// addConfigure
void
VhdlParser
::
addProto
(
const
char
*
s1
,
const
char
*
s2
,
const
char
*
s3
,
void
VhdlParser
::
addProto
(
const
char
*
s1
,
const
char
*
s2
,
const
char
*
s3
,
...
@@ -788,23 +767,55 @@ void VhdlParser::createFlow()
...
@@ -788,23 +767,55 @@ void VhdlParser::createFlow()
currP
=
0
;
currP
=
0
;
}
}
void
VhdlParser
::
setMultCommentLine
()
{
iDocLine
=
yyLineNr
;
}
void
VhdlParser
::
oneLineComment
(
QCString
qcs
)
{
bool
isEndCode
=
qcs
.
contains
(
"
\\
endcode"
);
int
index
=
qcs
.
find
(
"
\\
code"
);
if
(
isEndCode
)
{
int
end
=
inputString
.
find
(
qcs
.
data
(),
iCodeLen
);
makeInlineDoc
(
end
);
}
else
if
(
index
>
0
)
{
// assert(false);
strComment
=
qcs
;
startCodeBlock
(
index
);
strComment
.
resize
(
0
);
}
if
(
!
isEndCode
&&
index
==-
1
)
{
int
j
=
qcs
.
find
(
"--!"
);
qcs
=
qcs
.
right
(
qcs
.
length
()
-
3
-
j
);
if
(
!
checkMultiComment
(
qcs
,
iDocLine
))
{
handleCommentBlock
(
qcs
,
TRUE
);
}
}
}
bool
checkMultiComment
(
QCString
&
qcs
,
int
line
)
bool
checkMultiComment
(
QCString
&
qcs
,
int
line
)
{
{
QList
<
Entry
>
*
pTemp
=
getEntryAtLine
(
VhdlParser
::
current_root
,
line
);
QList
<
Entry
>
*
pTemp
=
getEntryAtLine
(
VhdlParser
::
current_root
,
line
);
if
(
pTemp
->
isEmpty
())
return
false
;
if
(
pTemp
->
isEmpty
())
return
false
;
//int ii=pTemp->count();
// qcs.stripPrefix("--!");
VhdlDocGen
::
prepareComment
(
qcs
);
VhdlDocGen
::
prepareComment
(
qcs
);
while
(
!
pTemp
->
isEmpty
())
while
(
!
pTemp
->
isEmpty
())
{
{
Entry
*
e
=
(
Entry
*
)
pTemp
->
getFirst
();
Entry
*
e
=
(
Entry
*
)
pTemp
->
getFirst
();
e
->
briefLine
=
line
;
e
->
briefLine
=
line
;
e
->
brief
+=
qcs
;
e
->
brief
+=
qcs
;
iDocLine
=-
1
;
pTemp
->
removeFirst
();
pTemp
->
removeFirst
();
//ii=pTemp->count();
}
}
return
true
;
return
true
;
}
}
...
@@ -819,7 +830,7 @@ QList<Entry>* getEntryAtLine(const Entry* ce,int line)
...
@@ -819,7 +830,7 @@ QList<Entry>* getEntryAtLine(const Entry* ce,int line)
if
(
rt
->
bodyLine
==
line
)
if
(
rt
->
bodyLine
==
line
)
{
{
lineEntry
.
insert
(
0
,
rt
);
lineEntry
.
insert
(
0
,
rt
);
}
// if
}
getEntryAtLine
(
rt
,
line
);
getEntryAtLine
(
rt
,
line
);
}
}
...
...
vhdlparser/CharStream.cc
View file @
475b0c51
/* Generated By:JavaCC: Do not edit this line. CharStream.cc Version 6.
0
*/
/* Generated By:JavaCC: Do not edit this line. CharStream.cc Version 6.
2
*/
/* JavaCCOptions:STATIC=false,SUPPORT_CLASS_VISIBILITY_PUBLIC=true */
/* JavaCCOptions:STATIC=false,SUPPORT_CLASS_VISIBILITY_PUBLIC=true */
#include "CharStream.h"
#include "CharStream.h"
...
@@ -209,4 +209,4 @@ void CharStream::UpdateLineColumn(JAVACC_CHAR_TYPE c) {
...
@@ -209,4 +209,4 @@ void CharStream::UpdateLineColumn(JAVACC_CHAR_TYPE c) {
}
}
}
}
/* JavaCC - OriginalChecksum=
e709b9ee1adf0fcb6b1c5e1641f10348
(do not edit this line) */
/* JavaCC - OriginalChecksum=
ade3c1b57a731a003629de593814ffa6
(do not edit this line) */
vhdlparser/CharStream.h
View file @
475b0c51
/* Generated By:JavaCC: Do not edit this line. CharStream.h Version 6.
0
*/
/* Generated By:JavaCC: Do not edit this line. CharStream.h Version 6.
2
*/
/* JavaCCOptions:STATIC=false,SUPPORT_CLASS_VISIBILITY_PUBLIC=true */
/* JavaCCOptions:STATIC=false,SUPPORT_CLASS_VISIBILITY_PUBLIC=true */
#ifndef CHARSTREAM_H
#ifndef CHARSTREAM_H
#define CHARSTREAM_H
#define CHARSTREAM_H
...
@@ -28,7 +28,7 @@ namespace parser {
...
@@ -28,7 +28,7 @@ namespace parser {
class
CharStream
{
class
CharStream
{
public
:
public
:
void
setTabSize
(
int
i
)
{
tabSize
=
i
;
}
void
setTabSize
(
int
i
)
{
tabSize
=
i
;
}
int
getTabSize
(
int
)
{
return
tabSize
;
}
int
getTabSize
(
int
)
{
return
tabSize
;
}
virtual
int
getColumn
()
{
return
trackLineColumn
?
bufcolumn
[
bufpos
]
:
-
1
;
}
virtual
int
getColumn
()
{
return
trackLineColumn
?
bufcolumn
[
bufpos
]
:
-
1
;
}
...
@@ -47,25 +47,25 @@ class CharStream {
...
@@ -47,25 +47,25 @@ class CharStream {
* (longer) token. So, they will be used again as the prefix of the next
* (longer) token. So, they will be used again as the prefix of the next
* token and it is the implemetation's responsibility to do this right.
* token and it is the implemetation's responsibility to do this right.
*/
*/
virtual
inline
void
backup
(
int
amount
)
{
virtual
inline
void
backup
(
int
amount
)
{
inBuf
+=
amount
;
inBuf
+=
amount
;
bufpos
-=
amount
;
bufpos
-=
amount
;
if
(
bufpos
<
0
)
{
if
(
bufpos
<
0
)
{
bufpos
+=
bufsize
;
bufpos
+=
bufsize
;
}
}
}
}
/**
/**
* Returns the next character that marks the beginning of the next token.
* Returns the next character that marks the beginning of the next token.
* All characters must remain in the buffer between two successive calls
* All characters must remain in the buffer between two successive calls
* to this method to implement backup correctly.
* to this method to implement backup correctly.
*/
*/
virtual
inline
JAVACC_CHAR_TYPE
BeginToken
()
{
virtual
inline
JAVACC_CHAR_TYPE
BeginToken
()
{
tokenBegin
=
-
1
;
tokenBegin
=
-
1
;
JAVACC_CHAR_TYPE
c
=
readChar
();
JAVACC_CHAR_TYPE
c
=
readChar
();
tokenBegin
=
bufpos
;
tokenBegin
=
bufpos
;
return
c
;
return
c
;
}
}
/**
/**
...
@@ -73,14 +73,13 @@ virtual inline JAVACC_CHAR_TYPE BeginToken() {
...
@@ -73,14 +73,13 @@ virtual inline JAVACC_CHAR_TYPE BeginToken() {
* of selecting the input is the responsibility of the class
* of selecting the input is the responsibility of the class
* implementing this class.
* implementing this class.
*/
*/
virtual
inline
JAVACC_CHAR_TYPE
readChar
()
{
virtual
inline
JAVACC_CHAR_TYPE
readChar
()
{
if
(
inBuf
>
0
)
{
if
(
inBuf
>
0
)
{
--
inBuf
;
--
inBuf
;
++
bufpos
;
++
bufpos
;
if
(
bufpos
==
bufsize
)
{
if
(
bufpos
==
bufsize
)
{
bufpos
=
0
;
bufpos
=
0
;
}
}
return
buffer
[
bufpos
];
return
buffer
[
bufpos
];
}
}
...
@@ -96,7 +95,7 @@ virtual inline JAVACC_CHAR_TYPE readChar() {
...
@@ -96,7 +95,7 @@ virtual inline JAVACC_CHAR_TYPE readChar() {
}
}
return
c
;
return
c
;
}
}
virtual
void
ExpandBuff
(
bool
wrapAround
);
virtual
void
ExpandBuff
(
bool
wrapAround
);
...
@@ -112,8 +111,7 @@ virtual inline JAVACC_CHAR_TYPE readChar() {
...
@@ -112,8 +111,7 @@ virtual inline JAVACC_CHAR_TYPE readChar() {
if
(
bufpos
>=
tokenBegin
)
if
(
bufpos
>=
tokenBegin
)
return
JAVACC_STRING_TYPE
(
buffer
+
tokenBegin
,
bufpos
-
tokenBegin
+
1
);
return
JAVACC_STRING_TYPE
(
buffer
+
tokenBegin
,
bufpos
-
tokenBegin
+
1
);
else
else
return
JAVACC_STRING_TYPE
(
buffer
+
tokenBegin
,
bufsize
-
tokenBegin
)
return
JAVACC_STRING_TYPE
(
buffer
+
tokenBegin
,
bufsize
-
tokenBegin
).
append
(
buffer
,
bufpos
+
1
);
.
append
(
buffer
,
bufpos
+
1
);
}
}
/**
/**
...
@@ -126,8 +124,7 @@ virtual inline JAVACC_CHAR_TYPE readChar() {
...
@@ -126,8 +124,7 @@ virtual inline JAVACC_CHAR_TYPE readChar() {
if
((
bufpos
+
1
)
>=
len
)
{
if
((
bufpos
+
1
)
>=
len
)
{
return
JAVACC_STRING_TYPE
(
buffer
+
bufpos
-
len
+
1
,
len
);
return
JAVACC_STRING_TYPE
(
buffer
+
bufpos
-
len
+
1
,
len
);
}
}
return
JAVACC_STRING_TYPE
(
buffer
+
bufsize
-
(
len
-
bufpos
-
1
),
len
-
bufpos
-
1
)
return
JAVACC_STRING_TYPE
(
buffer
+
bufsize
-
(
len
-
bufpos
-
1
),
len
-
bufpos
-
1
).
append
(
buffer
,
bufpos
+
1
);
.
append
(
buffer
,
bufpos
+
1
);
}
}
/**
/**
...
@@ -144,74 +141,71 @@ virtual inline JAVACC_CHAR_TYPE readChar() {
...
@@ -144,74 +141,71 @@ virtual inline JAVACC_CHAR_TYPE readChar() {
}
}
bool
endOfInput
()
{
bool
endOfInput
()
{
return
inBuf
==
0
&&
bufpos
+
1
>=
maxNextCharInd
&&
return
inBuf
==
0
&&
bufpos
+
1
>=
maxNextCharInd
&&
inputStream
->
endOfInput
();
inputStream
->
endOfInput
();
}
}
CharStream
(
const
JAVACC_CHAR_TYPE
*
buf
,
int
sz
,
int
startline
,
CharStream
(
const
JAVACC_CHAR_TYPE
*
buf
,
int
sz
,
int
startline
,
int
startcolumn
,
int
buffersize
)
:
int
startcolumn
,
int
buffersize
)
:
bufline
(
NULL
),
bufcolumn
(
NULL
),
inputStream
(
NULL
),
deleteStream
(
false
),
bufline
(
NULL
),
bufcolumn
(
NULL
),
buffer
(
NULL
),
bufpos
(
0
),
bufsize
(
0
),
buffer
(
NULL
),
bufpos
(
0
),
bufsize
(
0
),
tokenBegin
(
0
),
column
(
0
),
line
(
0
),
tokenBegin
(
0
),
column
(
0
),
line
(
0
),
prevCharIsCR
(
false
),
prevCharIsLF
(
false
),
prevCharIsCR
(
false
),
prevCharIsLF
(
false
),
available
(
0
),
maxNextCharInd
(
0
),
available
(
0
),
maxNextCharInd
(
0
),
inBuf
(
0
),
tabSize
(
1
),
trackLineColumn
(
true
),
in
Buf
(
0
),
tabSize
(
8
),
trackLineColumn
(
tru
e
)
{
in
putStream
(
NULL
),
deleteStream
(
fals
e
)
{
ReInit
(
JAVACC_STRING_TYPE
(
buf
,
sz
),
startline
,
startcolumn
,
buffersize
);
ReInit
(
JAVACC_STRING_TYPE
(
buf
,
sz
),
startline
,
startcolumn
,
buffersize
);
}
}
CharStream
(
const
JAVACC_CHAR_TYPE
*
buf
,
int
sz
,
int
startline
,
int
startcolumn
)
:
CharStream
(
const
JAVACC_CHAR_TYPE
*
buf
,
int
sz
,
int
startline
,
int
startcolumn
)
:
bufline
(
NULL
),
bufcolumn
(
NULL
),
inputStream
(
NULL
),
deleteStream
(
false
),
bufline
(
NULL
),
bufcolumn
(
NULL
),
buffer
(
NULL
),
bufpos
(
0
),
bufsize
(
0
),
buffer
(
NULL
),
bufpos
(
0
),
bufsize
(
0
),
tokenBegin
(
0
),
column
(
0
),
line
(
0
),
tokenBegin
(
0
),
column
(
0
),
line
(
0
),
prevCharIsCR
(
false
),
prevCharIsLF
(
false
),
prevCharIsCR
(
false
),
prevCharIsLF
(
false
),
available
(
0
),
maxNextCharInd
(
0
),
available
(
0
),
maxNextCharInd
(
0
),
inBuf
(
0
),
tabSize
(
1
),
trackLineColumn
(
true
),
in
Buf
(
0
),
tabSize
(
8
),
trackLineColumn
(
tru
e
)
{
in
putStream
(
NULL
),
deleteStream
(
fals
e
)
{
ReInit
(
JAVACC_STRING_TYPE
(
buf
,
sz
),
startline
,
startcolumn
,
INITIAL_BUFFER_SIZE
);
ReInit
(
JAVACC_STRING_TYPE
(
buf
,
sz
),
startline
,
startcolumn
,
INITIAL_BUFFER_SIZE
);
}
}
CharStream
(
const
JAVACC_STRING_TYPE
&
str
,
int
startline
,
CharStream
(
const
JAVACC_STRING_TYPE
&
str
,
int
startline
,
int
startcolumn
,
int
buffersize
)
:
int
startcolumn
,
int
buffersize
)
:
bufline
(
NULL
),
bufcolumn
(
NULL
),
inputStream
(
NULL
),
deleteStream
(
false
),
bufline
(
NULL
),
bufcolumn
(
NULL
),
buffer
(
NULL
),
bufpos
(
0
),
bufsize
(
0
),
buffer
(
NULL
),
bufpos
(
0
),
bufsize
(
0
),
tokenBegin
(
0
),
column
(
0
),
line
(
0
),
tokenBegin
(
0
),
column
(
0
),
line
(
0
),
prevCharIsCR
(
false
),
prevCharIsLF
(
false
),
prevCharIsCR
(
false
),
prevCharIsLF
(
false
),
available
(
0
),
maxNextCharInd
(
0
),
available
(
0
),
maxNextCharInd
(
0
),
inBuf
(
0
),
tabSize
(
1
),
trackLineColumn
(
true
),
in
Buf
(
0
),
tabSize
(
8
),
trackLineColumn
(
tru
e
)
{
in
putStream
(
NULL
),
deleteStream
(
fals
e
)
{
ReInit
(
str
,
startline
,
startcolumn
,
buffersize
);
ReInit
(
str
,
startline
,
startcolumn
,
buffersize
);
}
}
CharStream
(
const
JAVACC_STRING_TYPE
&
str
,
int
startline
,
int
startcolumn
)
:
CharStream
(
const
JAVACC_STRING_TYPE
&
str
,
int
startline
,
int
startcolumn
)
:
bufline
(
NULL
),
bufcolumn
(
NULL
),
inputStream
(
NULL
),
deleteStream
(
false
),
bufline
(
NULL
),
bufcolumn
(
NULL
),
buffer
(
NULL
),
bufpos
(
0
),
bufsize
(
0
),
buffer
(
NULL
),
bufpos
(
0
),
bufsize
(
0
),
tokenBegin
(
0
),
column
(
0
),
line
(
0
),
tokenBegin
(
0
),
column
(
0
),
line
(
0
),
prevCharIsCR
(
false
),
prevCharIsLF
(
false
),
prevCharIsCR
(
false
),
prevCharIsLF
(
false
),
available
(
0
),
maxNextCharInd
(
0
),
available
(
0
),
maxNextCharInd
(
0
),
inBuf
(
0
),
tabSize
(
1
),
trackLineColumn
(
true
),
in
Buf
(
0
)
,
tabSize
(
8
),
trackLineColumn
(
true
)
{
in
putStream
(
NULL
),
deleteStream
(
false
)
{
ReInit
(
str
,
startline
,
startcolumn
,
INITIAL_BUFFER_SIZE
);
ReInit
(
str
,
startline
,
startcolumn
,
INITIAL_BUFFER_SIZE
);
}
}
CharStream
(
ReaderStream
*
input_stream
,
int
startline
,
CharStream
(
ReaderStream
*
input_stream
,
int
startline
,
int
startcolumn
,
int
)
:
int
startcolumn
,
int
buffersize
)
:
bufline
(
NULL
),
bufcolumn
(
NULL
),
inputStream
(
NULL
),
deleteStream
(
false
),
bufline
(
NULL
),
bufcolumn
(
NULL
),
buffer
(
NULL
),
bufpos
(
0
),
bufsize
(
0
),
buffer
(
NULL
),
bufpos
(
0
),
bufsize
(
0
),
tokenBegin
(
0
),
column
(
0
),
line
(
0
),
tokenBegin
(
0
),
column
(
0
),
line
(
0
),
prevCharIsCR
(
false
),
prevCharIsLF
(
false
),
prevCharIsCR
(
false
),
prevCharIsLF
(
false
),
available
(
0
),
maxNextCharInd
(
0
),
available
(
0
),
maxNextCharInd
(
0
),
inBuf
(
0
),
tabSize
(
1
),
trackLineColumn
(
true
),
in
Buf
(
0
),
tabSize
(
8
),
trackLineColumn
(
tru
e
)
{
in
putStream
(
NULL
),
deleteStream
(
fals
e
)
{
ReInit
(
input_stream
,
startline
,
startcolumn
,
INITIAL_BUFFER_SIZE
);
ReInit
(
input_stream
,
startline
,
startcolumn
,
buffersize
);
}
}
CharStream
(
ReaderStream
*
input_stream
,
int
startline
,
int
startcolumn
)
:
CharStream
(
ReaderStream
*
input_stream
,
int
startline
,
int
startcolumn
)
:
bufline
(
NULL
),
bufcolumn
(
NULL
),
inputStream
(
NULL
),
deleteStream
(
false
),
bufline
(
NULL
),
bufcolumn
(
NULL
),
buffer
(
NULL
),
bufpos
(
0
),
bufsize
(
0
),
buffer
(
NULL
),
bufpos
(
0
),
bufsize
(
0
),
tokenBegin
(
0
),
column
(
0
),
line
(
0
),
tokenBegin
(
0
),
column
(
0
),
line
(
0
),
prevCharIsCR
(
false
),
prevCharIsLF
(
false
),
prevCharIsCR
(
false
),
prevCharIsLF
(
false
),
available
(
0
),
maxNextCharInd
(
0
),
available
(
0
),
maxNextCharInd
(
0
),
inBuf
(
0
),
tabSize
(
1
),
trackLineColumn
(
true
),
in
Buf
(
0
),
tabSize
(
8
),
trackLineColumn
(
tru
e
)
{
in
putStream
(
NULL
),
deleteStream
(
fals
e
)
{
ReInit
(
input_stream
,
startline
,
startcolumn
,
INITIAL_BUFFER_SIZE
);
ReInit
(
input_stream
,
startline
,
startcolumn
,
INITIAL_BUFFER_SIZE
);
}
}
CharStream
(
ReaderStream
*
input_stream
)
:
CharStream
(
ReaderStream
*
input_stream
)
:
bufline
(
NULL
),
bufcolumn
(
NULL
),
inputStream
(
NULL
),
deleteStream
(
false
),
bufline
(
NULL
),
bufcolumn
(
NULL
),
buffer
(
NULL
),
bufpos
(
0
),
bufsize
(
0
),
buffer
(
NULL
),
bufpos
(
0
),
bufsize
(
0
),
tokenBegin
(
0
),
column
(
0
),
line
(
0
),
tokenBegin
(
0
),
column
(
0
),
line
(
0
),
prevCharIsCR
(
false
),
prevCharIsLF
(
false
),
prevCharIsCR
(
false
),
prevCharIsLF
(
false
),
available
(
0
),
maxNextCharInd
(
0
),
available
(
0
),
maxNextCharInd
(
0
),
inBuf
(
0
),
tabSize
(
1
),
trackLineColumn
(
true
),
in
Buf
(
0
),
tabSize
(
8
),
trackLineColumn
(
tru
e
)
{
in
putStream
(
NULL
),
deleteStream
(
fals
e
)
{
ReInit
(
input_stream
,
1
,
1
,
INITIAL_BUFFER_SIZE
);
ReInit
(
input_stream
,
1
,
1
,
INITIAL_BUFFER_SIZE
);
}
}
virtual
void
ReInit
(
ReaderStream
*
input_stream
,
int
startline
,
int
startcolumn
,
virtual
void
ReInit
(
ReaderStream
*
input_stream
,
int
startline
,
int
startcolumn
,
int
buffersize
);
int
buffersize
);
virtual
void
ReInit
(
ReaderStream
*
input_stream
,
int
startline
,
virtual
void
ReInit
(
ReaderStream
*
input_stream
,
int
startline
,
int
startcolumn
)
{
int
startcolumn
)
{
ReInit
(
input_stream
,
startline
,
startcolumn
,
INITIAL_BUFFER_SIZE
);
ReInit
(
input_stream
,
startline
,
startcolumn
,
INITIAL_BUFFER_SIZE
);
}
}
...
@@ -232,26 +226,26 @@ virtual inline JAVACC_CHAR_TYPE readChar() {
...
@@ -232,26 +226,26 @@ virtual inline JAVACC_CHAR_TYPE readChar() {
protected
:
protected
:
virtual
void
UpdateLineColumn
(
JAVACC_CHAR_TYPE
c
);
virtual
void
UpdateLineColumn
(
JAVACC_CHAR_TYPE
c
);
int
*
bufline
;
int
*
bufline
;
int
*
bufcolumn
;
int
*
bufcolumn
;
ReaderStream
*
inputStream
;
JAVACC_CHAR_TYPE
*
buffer
;
bool
deleteStream
;
JAVACC_CHAR_TYPE
*
buffer
;
int
bufpos
;
int
bufpos
;
int
bufsize
;
int
bufsize
;
int
tokenBegin
;
int
tokenBegin
;
int
column
;
int
column
;
int
line
;
int
line
;
bool
prevCharIsCR
;
bool
prevCharIsCR
;
bool
prevCharIsLF
;
bool
prevCharIsLF
;
int
available
;
int
available
;
int
maxNextCharInd
;
int
maxNextCharInd
;
int
inBuf
;
int
inBuf
;
int
tabSize
;
int
tabSize
;
bool
trackLineColumn
;
bool
trackLineColumn
;
ReaderStream
*
inputStream
;
bool
deleteStream
;
};
};
}
}
}
}
#endif
#endif
/* JavaCC - OriginalChecksum=
5eaf75ef6a2c7859369c80cf6fd037e0
(do not edit this line) */
/* JavaCC - OriginalChecksum=
89f4cb30f0d3487ee809cca18a2924f2
(do not edit this line) */
vhdlparser/ErrorHandler.h
View file @
475b0c51
/* 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.
2
*/
/* JavaCCOptions:STATIC=false,SUPPORT_CLASS_VISIBILITY_PUBLIC=true,BUILD_PARSER=true,BUILD_TOKEN_MANAGER=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 <stdio.h>
#include <string>
#include "JavaCC.h"
#include "JavaCC.h"
#include "Token.h"
#include "Token.h"
namespace
vhdl
{
namespace
vhdl
{
namespace
parser
{
namespace
parser
{
//
JAVACC_SIMPLE_STRING addUnicodeEscapes(JAVACC_STRING_TYPE str);
JAVACC_SIMPLE_STRING
addUnicodeEscapes
(
JAVACC_STRING_TYPE
str
);
class
VhdlParser
;
class
VhdlParser
;
class
ErrorHandler
{
class
ErrorHandler
{
...
@@ -23,22 +24,22 @@ namespace parser {
...
@@ -23,22 +24,22 @@ namespace parser {
// 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
,
Token
*
,
VhdlParser
*
)
{
virtual
void
handleUnexpectedToken
(
int
/*expectedKind*/
,
JAVACC_STRING_TYPE
expectedToken
,
Token
*
actual
,
VhdlParser
*
/*parser*/
)
{
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
*
,
JAVACC_SIMPLE_STRING
,
VhdlParser
*
)
{
virtual
void
handleParseError
(
Token
*
/*last*/
,
Token
*
unexpected
,
JAVACC_SIMPLE_STRING
production
,
VhdlParser
*
/*parser*/
)
{
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
*
)
{
virtual
void
handleOtherError
(
JAVACC_STRING_TYPE
message
,
VhdlParser
*
/*parser*/
)
{
fprintf
(
stderr
,
"Error: %s
\n
"
,
(
char
*
)
message
.
c_str
());
fprintf
(
stderr
,
"Error: %s
\n
"
,
(
char
*
)
message
.
c_str
());
}
}
virtual
~
ErrorHandler
()
{}
virtual
~
ErrorHandler
()
{}
...
@@ -61,11 +62,11 @@ namespace parser {
...
@@ -61,11 +62,11 @@ namespace parser {
// errorAfter : prefix that was seen before this error occurred
// errorAfter : prefix that was seen before this error occurred
// curchar : the offending character
// curchar : the offending character
//
//
virtual
void
lexicalError
(
bool
EOFSeen
,
int
/*lexState*/
,
int
errorLine
,
int
errorColumn
,
JAVACC_STRING_TYPE
errorAfter
,
JAVACC_CHAR_TYPE
curChar
,
VhdlParserTokenManager
*
)
{
virtual
void
lexicalError
(
bool
EOFSeen
,
int
/*lexState*/
,
int
errorLine
,
int
errorColumn
,
JAVACC_STRING_TYPE
errorAfter
,
JAVACC_CHAR_TYPE
curChar
,
VhdlParserTokenManager
*
/*token_manager*/
)
{
// by default, we just print an error message and return.
// 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
()));
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
*
)
{
virtual
void
lexicalError
(
JAVACC_STRING_TYPE
errorMessage
,
VhdlParserTokenManager
*
/*token_manager*/
)
{
fprintf
(
stderr
,
"%s
\n
"
,
(
char
*
)
errorMessage
.
c_str
());
fprintf
(
stderr
,
"%s
\n
"
,
(
char
*
)
errorMessage
.
c_str
());
}
}
virtual
~
TokenManagerErrorHandler
()
{}
virtual
~
TokenManagerErrorHandler
()
{}
...
@@ -75,4 +76,4 @@ namespace parser {
...
@@ -75,4 +76,4 @@ namespace parser {
}
}
#endif
#endif
/* JavaCC - OriginalChecksum=
685d19cb4cd943b60089f599e45f23ad
(do not edit this line) */
/* JavaCC - OriginalChecksum=
c18f1105ba178be8e21cc9f279f94496
(do not edit this line) */
vhdlparser/JavaCC.h
View file @
475b0c51
/* Generated By:JavaCC: Do not edit this line. JavaCC.h Version 6.
0
*/
/* Generated By:JavaCC: Do not edit this line. JavaCC.h Version 6.
2
*/
/* JavaCCOptions:STATIC=false,SUPPORT_CLASS_VISIBILITY_PUBLIC=true */
/* JavaCCOptions:STATIC=false,SUPPORT_CLASS_VISIBILITY_PUBLIC=true */
#ifndef
__JAVACC_H
#ifndef
JAVACC_H_
#define
__JAVACC_H
#define
JAVACC_H_
#include <stdio.h>
#include <stdio.h>
#include <string
.h
>
#include <string>
#include <memory.h>
#include <memory.h>
#include <assert.h>
#include <assert.h>
#include <cstring>
#include "vhdlstring.h"
#include "vhdlstring.h"
#ifndef JAVACC_CHAR_TYPE
#ifndef JAVACC_CHAR_TYPE
...
@@ -18,23 +16,16 @@
...
@@ -18,23 +16,16 @@
#define JAVACC_STRING_TYPE VhdlString
#define JAVACC_STRING_TYPE VhdlString
#endif
#endif
#define finally // TODO(Sreeni): Get rid of when we fix jjtree
#define JAVACC_SIMPLE_STRING VhdlString
#define JAVACC_SIMPLE_STRING VhdlString
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
;
// Abstraction on stream classes to read a block of data into a buffer.
// Abstraction on stream classes to read a block of data into a buffer.
class
ReaderStream
{
class
ReaderStream
{
public
:
public
:
// Read block of data into a buffer and return the actual number read.
// Read block of data into a buffer and return the actual number read.
virtual
size_t
read
(
JAVACC_CHAR_TYPE
*
,
int
,
size_t
)
{
virtual
size_t
read
(
JAVACC_CHAR_TYPE
*
/*bufptr*/
,
int
/*offset*/
,
size_t
/*len*/
)
{
return
0
;
}
return
0
;
}
virtual
bool
endOfInput
()
{
return
true
;
}
virtual
bool
endOfInput
()
{
return
true
;
}
virtual
~
ReaderStream
()
{}
virtual
~
ReaderStream
()
{}
};
};
...
@@ -49,4 +40,4 @@ const JAVACC_CHAR_TYPE EMPTY[] = { 0 };
...
@@ -49,4 +40,4 @@ const JAVACC_CHAR_TYPE EMPTY[] = { 0 };
#endif
#endif
#endif
#endif
/* JavaCC - OriginalChecksum=
775c677272b259e2a33aac80851ba9f1
(do not edit this line) */
/* JavaCC - OriginalChecksum=
eb066370c81bb58bb68713327da9719f
(do not edit this line) */
vhdlparser/JavaCC.h.in
View file @
475b0c51
/* Generated By:JavaCC: Do not edit this line. JavaCC.h Version 6.
0
*/
/* Generated By:JavaCC: Do not edit this line. JavaCC.h Version 6.
2
*/
/* JavaCCOptions:STATIC=false,SUPPORT_CLASS_VISIBILITY_PUBLIC=true */
/* JavaCCOptions:STATIC=false,SUPPORT_CLASS_VISIBILITY_PUBLIC=true */
#ifndef
__JAVACC_H
#ifndef
JAVACC_H_
#define
__JAVACC_H
#define
JAVACC_H_
#include <stdio.h>
#include <stdio.h>
#include <string
.h
>
#include <string>
#include <memory.h>
#include <memory.h>
#include <assert.h>
#include <assert.h>
#include <cstring>
#include "vhdlstring.h"
#include "vhdlstring.h"
#ifndef JAVACC_CHAR_TYPE
#ifndef JAVACC_CHAR_TYPE
...
@@ -18,23 +16,16 @@
...
@@ -18,23 +16,16 @@
#define JAVACC_STRING_TYPE VhdlString
#define JAVACC_STRING_TYPE VhdlString
#endif
#endif
#define finally // TODO(Sreeni): Get rid of when we fix jjtree
#define JAVACC_SIMPLE_STRING VhdlString
#define JAVACC_SIMPLE_STRING VhdlString
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;
// Abstraction on stream classes to read a block of data into a buffer.
// Abstraction on stream classes to read a block of data into a buffer.
class ReaderStream {
class ReaderStream {
public:
public:
// Read block of data into a buffer and return the actual number read.
// Read block of data into a buffer and return the actual number read.
virtual size_t read(JAVACC_CHAR_TYPE *, int, size_t) {
virtual size_t read(JAVACC_CHAR_TYPE * /*bufptr*/, int /*offset*/, size_t /*len*/) { return 0; }
return 0;
}
virtual bool endOfInput() { return true; }
virtual bool endOfInput() { return true; }
virtual ~ReaderStream() {}
virtual ~ReaderStream() {}
};
};
...
@@ -49,4 +40,4 @@ const JAVACC_CHAR_TYPE EMPTY[] = { 0 };
...
@@ -49,4 +40,4 @@ const JAVACC_CHAR_TYPE EMPTY[] = { 0 };
#endif
#endif
#endif
#endif
/* JavaCC - OriginalChecksum=
775c677272b259e2a33aac80851ba9f1
(do not edit this line) */
/* JavaCC - OriginalChecksum=
eb066370c81bb58bb68713327da9719f
(do not edit this line) */
vhdlparser/Makefile.in
View file @
475b0c51
...
@@ -31,7 +31,6 @@ regenerate:
...
@@ -31,7 +31,6 @@ regenerate:
VhdlParserConstants.h VhdlParserTokenManager.cc VhdlParserTokenManager.h
\
VhdlParserConstants.h VhdlParserTokenManager.cc VhdlParserTokenManager.h
\
JavaCC.h
JavaCC.h
javacc vhdlparser.jj
javacc vhdlparser.jj
patch <vhdlparser.patch
$(CP)
JavaCC.h.in JavaCC.h
$(CP)
JavaCC.h.in JavaCC.h
distclean
:
clean
distclean
:
clean
...
...
vhdlparser/ParseException.cc
View file @
475b0c51
/* Generated By:JavaCC: Do not edit this line. ParseException.cc Version 6.
0
*/
/* Generated By:JavaCC: Do not edit this line. ParseException.cc Version 6.
2
*/
/* JavaCCOptions:STATIC=false,SUPPORT_CLASS_VISIBILITY_PUBLIC=true */
/* JavaCCOptions:STATIC=false,SUPPORT_CLASS_VISIBILITY_PUBLIC=true */
#include "ParseException.h"
#include "ParseException.h"
...
@@ -141,8 +141,6 @@ namespace parser {
...
@@ -141,8 +141,6 @@ namespace parser {
for (int i = 0; i < str.length(); i++) {
for (int i = 0; i < str.length(); i++) {
switch (str.charAt(i))
switch (str.charAt(i))
{
{
case 0 :
continue;
case '\b':
case '\b':
retval.append("\\b");
retval.append("\\b");
continue;
continue;
...
@@ -183,4 +181,4 @@ namespace parser {
...
@@ -183,4 +181,4 @@ namespace parser {
}
}
}
}
/* JavaCC - OriginalChecksum=9
9d488e13335cf377284c90700f070ed
(do not edit this line) */
/* JavaCC - OriginalChecksum=9
f6af8fd72f5fe3e4210cf02acbd8387
(do not edit this line) */
vhdlparser/ParseException.h
View file @
475b0c51
/* Generated By:JavaCC: Do not edit this line. ParseException.h Version 6.
0
*/
/* Generated By:JavaCC: Do not edit this line. ParseException.h Version 6.
2
*/
/* JavaCCOptions:STATIC=false,SUPPORT_CLASS_VISIBILITY_PUBLIC=true */
/* JavaCCOptions:STATIC=false,SUPPORT_CLASS_VISIBILITY_PUBLIC=true */
#ifndef _PARSE_EXCEPTION_H
#ifndef _PARSE_EXCEPTION_H
#define _PARSE_EXCEPTION_H
#define _PARSE_EXCEPTION_H
...
@@ -96,4 +96,4 @@ class ParseException {
...
@@ -96,4 +96,4 @@ class ParseException {
}
}
}
}
#endif
#endif
/* JavaCC - OriginalChecksum=
8c47c56fc2030f05b43e20cae6ca5d66
(do not edit this line) */
/* JavaCC - OriginalChecksum=
bd87c2fc11a4306bd2c2482fd1025b7c
(do not edit this line) */
vhdlparser/Token.cc
View file @
475b0c51
/* Generated By:JavaCC: Do not edit this line. Token.cc Version 6.
0
*/
/* Generated By:JavaCC: Do not edit this line. Token.cc Version 6.
2
*/
/* JavaCCOptions:STATIC=false,SUPPORT_CLASS_VISIBILITY_PUBLIC=true,TOKEN_INCLUDES=,TOKEN_EXTENDS= */
/* JavaCCOptions:STATIC=false,SUPPORT_CLASS_VISIBILITY_PUBLIC=true,TOKEN_INCLUDES=,TOKEN_EXTENDS= */
#include "Token.h"
#include "Token.h"
...
@@ -89,4 +89,4 @@ namespace parser {
...
@@ -89,4 +89,4 @@ namespace parser {
}
}
}
}
/* JavaCC - OriginalChecksum=
9db9ca693072c4c37bb7cc933c0c5e35
(do not edit this line) */
/* JavaCC - OriginalChecksum=
dcb0f64486aa6455ae5af05d6bb539ec
(do not edit this line) */
vhdlparser/Token.h
View file @
475b0c51
/* Generated By:JavaCC: Do not edit this line. Token.h Version 6.
0
*/
/* Generated By:JavaCC: Do not edit this line. Token.h Version 6.
2
*/
/* JavaCCOptions:STATIC=false,SUPPORT_CLASS_VISIBILITY_PUBLIC=true,TOKEN_INCLUDES=,TOKEN_EXTENDS= */
/* JavaCCOptions:STATIC=false,SUPPORT_CLASS_VISIBILITY_PUBLIC=true,TOKEN_INCLUDES=,TOKEN_EXTENDS= */
#ifndef TOKEN_H
#ifndef TOKEN_H
#define TOKEN_H
#define TOKEN_H
...
@@ -86,12 +86,13 @@ class Token
...
@@ -86,12 +86,13 @@ class Token
*/
*/
Token
(
int
kind
,
JAVACC_STRING_TYPE
image
);
Token
(
int
kind
,
JAVACC_STRING_TYPE
image
);
virtual
~
Token
();
/**
/**
* Returns the image.
* Returns the image.
*/
*/
JAVACC_STRING_TYPE
toString
();
JAVACC_STRING_TYPE
toString
();
public
:
virtual
~
Token
();
/**
/**
* Returns a new Token void *, by default. However, if you want, you
* Returns a new Token void *, by default. However, if you want, you
...
@@ -113,4 +114,4 @@ class Token
...
@@ -113,4 +114,4 @@ class Token
}
}
}
}
#endif
#endif
/* JavaCC - OriginalChecksum=
2f5eb1c937adc983dfa2008c4fe383a7
(do not edit this line) */
/* JavaCC - OriginalChecksum=
4748c3d6443aa3445d3c95ab54f14c2a
(do not edit this line) */
vhdlparser/TokenManager.h
View file @
475b0c51
/* Generated By:JavaCC: Do not edit this line. TokenManager.h Version 6.
0
*/
/* Generated By:JavaCC: Do not edit this line. TokenManager.h Version 6.
2
*/
/* JavaCCOptions:STATIC=false,SUPPORT_CLASS_VISIBILITY_PUBLIC=true */
/* JavaCCOptions:STATIC=false,SUPPORT_CLASS_VISIBILITY_PUBLIC=true */
#ifndef TOKENMANAGER_H
#ifndef TOKENMANAGER_H
#define TOKENMANAGER_H
#define TOKENMANAGER_H
#include "JavaCC.h"
#include "JavaCC.h"
#include "Token.h"
#include "Token.h"
using
namespace
std
;
namespace
vhdl
{
namespace
vhdl
{
namespace
parser
{
namespace
parser
{
...
@@ -19,10 +20,9 @@ public:
...
@@ -19,10 +20,9 @@ public:
/** This gets the next token from the input stream.
/** This gets the next token from the input stream.
* A token of kind 0 (<EOF>) should be returned on EOF.
* A token of kind 0 (<EOF>) should be returned on EOF.
*/
*/
public
:
virtual
Token
*
getNextToken
()
=
0
;
virtual
~
TokenManager
()
{
}
public
:
virtual
~
TokenManager
()
{
}
virtual
Token
*
getNextToken
()
=
0
;
public
:
virtual
void
lexicalError
()
{
virtual
void
lexicalError
()
{
fprintf
(
stderr
,
"Lexical error encountered
\n
"
);
}
}
};
};
...
@@ -30,4 +30,4 @@ public:
...
@@ -30,4 +30,4 @@ public:
}
}
}
}
#endif
#endif
/* JavaCC - OriginalChecksum=
d4725ee75465725057819b3b07fadaa7
(do not edit this line) */
/* JavaCC - OriginalChecksum=
918e2eba53e028d6c4142283ce3f498f
(do not edit this line) */
vhdlparser/TokenMgrError.cc
View file @
475b0c51
/* Generated By:JavaCC: Do not edit this line. TokenMgrError.cc Version 6.
0
*/
/* Generated By:JavaCC: Do not edit this line. TokenMgrError.cc Version 6.
2
*/
/* JavaCCOptions:STATIC=false,SUPPORT_CLASS_VISIBILITY_PUBLIC=true */
/* JavaCCOptions:STATIC=false,SUPPORT_CLASS_VISIBILITY_PUBLIC=true */
#include "TokenMgrError.h"
#include "TokenMgrError.h"
...
@@ -79,9 +79,6 @@ JAVACC_SIMPLE_STRING addUnicodeEscapes(JAVACC_STRING_TYPE str) {
...
@@ -79,9 +79,6 @@ JAVACC_SIMPLE_STRING addUnicodeEscapes(JAVACC_STRING_TYPE str) {
JAVACC_CHAR_TYPE
ch
=
str
[
i
];
JAVACC_CHAR_TYPE
ch
=
str
[
i
];
switch
(
ch
)
switch
(
ch
)
{
{
case
0
:
retval
+=
EMPTY
[
0
];
continue
;
case
'\b'
:
case
'\b'
:
retval
.
append
(
"
\\
b"
);
retval
.
append
(
"
\\
b"
);
continue
;
continue
;
...
@@ -118,4 +115,4 @@ JAVACC_SIMPLE_STRING addUnicodeEscapes(JAVACC_STRING_TYPE str) {
...
@@ -118,4 +115,4 @@ JAVACC_SIMPLE_STRING addUnicodeEscapes(JAVACC_STRING_TYPE str) {
}
}
}
}
/* JavaCC - OriginalChecksum=2
bf63f131c8e60fd30c70d0b4f66001
6 (do not edit this line) */
/* JavaCC - OriginalChecksum=2
fe11435e6701b2fca885354b08bfdf
6 (do not edit this line) */
vhdlparser/TokenMgrError.h
View file @
475b0c51
/* Generated By:JavaCC: Do not edit this line. TokenMgrError.h Version 6.
0
*/
/* Generated By:JavaCC: Do not edit this line. TokenMgrError.h Version 6.
2
*/
/* JavaCCOptions:STATIC=false,SUPPORT_CLASS_VISIBILITY_PUBLIC=true */
/* JavaCCOptions:STATIC=false,SUPPORT_CLASS_VISIBILITY_PUBLIC=true */
#ifndef _TOKENMGRERROR_H
#ifndef _TOKENMGRERROR_H
#define _TOKENMGRERROR_H
#define _TOKENMGRERROR_H
...
@@ -8,7 +8,7 @@
...
@@ -8,7 +8,7 @@
namespace
vhdl
{
namespace
vhdl
{
namespace
parser
{
namespace
parser
{
enum
LexerErrors
{
enum
LexerErrors
{
/**
/**
* Lexical error occurred.
* Lexical error occurred.
*/
*/
...
@@ -28,11 +28,10 @@ namespace parser {
...
@@ -28,11 +28,10 @@ namespace parser {
* Detected (and bailed out of) an infinite loop in the token manager.
* Detected (and bailed out of) an infinite loop in the token manager.
*/
*/
LOOP_DETECTED
=
3
,
LOOP_DETECTED
=
3
,
};
};
class
TokenMgrError
class
TokenMgrError
{
{
public
:
public
:
/*
/*
* Ordinals for various reasons why an Error of this type can be thrown.
* Ordinals for various reasons why an Error of this type can be thrown.
*/
*/
...
@@ -57,7 +56,8 @@ class TokenMgrError
...
@@ -57,7 +56,8 @@ class TokenMgrError
*/
*/
JAVACC_STRING_TYPE
LexicalError
(
bool
EOFSeen
,
int
lexState
,
int
errorLine
,
int
errorColumn
,
JAVACC_STRING_TYPE
errorAfter
,
JAVACC_CHAR_TYPE
curChar
);
JAVACC_STRING_TYPE
LexicalError
(
bool
EOFSeen
,
int
lexState
,
int
errorLine
,
int
errorColumn
,
JAVACC_STRING_TYPE
errorAfter
,
JAVACC_CHAR_TYPE
curChar
);
private
:
JAVACC_STRING_TYPE
message
;
private
:
JAVACC_STRING_TYPE
message
;
/**
/**
* You can also modify the body of this method to customize your error messages.
* You can also modify the body of this method to customize your error messages.
...
@@ -68,6 +68,7 @@ class TokenMgrError
...
@@ -68,6 +68,7 @@ class TokenMgrError
*
*
* from this method for such cases in the release version of your parser.
* from this method for such cases in the release version of your parser.
*/
*/
public
:
JAVACC_STRING_TYPE
getMessage
()
;
JAVACC_STRING_TYPE
getMessage
()
;
/*
/*
...
@@ -75,16 +76,16 @@ class TokenMgrError
...
@@ -75,16 +76,16 @@ class TokenMgrError
*/
*/
/** No arg constructor. */
/** No arg constructor. */
public
:
TokenMgrError
()
;
TokenMgrError
()
;
/** Constructor with message and reason. */
/** Constructor with message and reason. */
public
:
TokenMgrError
(
JAVACC_STRING_TYPE
message
,
int
reason
)
;
TokenMgrError
(
JAVACC_STRING_TYPE
message
,
int
reason
)
;
/** Full Constructor. */
/** Full Constructor. */
public
:
TokenMgrError
(
bool
EOFSeen
,
int
lexState
,
int
errorLine
,
int
errorColumn
,
JAVACC_STRING_TYPE
errorAfter
,
JAVACC_CHAR_TYPE
curChar
,
int
reason
)
;
TokenMgrError
(
bool
EOFSeen
,
int
lexState
,
int
errorLine
,
int
errorColumn
,
JAVACC_STRING_TYPE
errorAfter
,
JAVACC_CHAR_TYPE
curChar
,
int
reason
)
;
};
};
}
}
}
}
#endif
#endif
/* JavaCC - OriginalChecksum=c
7d825cb4d037b031ae43569d383f738
(do not edit this line) */
/* JavaCC - OriginalChecksum=c
22a1b25630ec91deb47dcba22b6b39d
(do not edit this line) */
vhdlparser/VhdlParser.cc
View file @
475b0c51
/* VhdlParser.cc */
/* VhdlParser.cc */
#include "./VhdlParser.h"
#include "VhdlParser.h"
#include "TokenMgrError.h"
namespace
vhdl
{
namespace
vhdl
{
namespace
parser
{
namespace
parser
{
unsigned
int
jj_la1_0
[]
=
{
unsigned
int
jj_la1_0
[]
=
{
...
@@ -64,7 +65,7 @@ assert(false);
...
@@ -64,7 +65,7 @@ assert(false);
}
}
QCString
VhdlParser
::
access_type_definition
()
{
Token
*
tok
;
QCString
str
,
str1
;
if
(
!
hasError
)
{
QCString
VhdlParser
::
access_type_definition
()
{
Token
*
tok
=
0
;
QCString
str
,
str1
;
if
(
!
hasError
)
{
tok
=
jj_consume_token
(
ACCESS_T
);
tok
=
jj_consume_token
(
ACCESS_T
);
}
}
...
@@ -78,7 +79,7 @@ assert(false);
...
@@ -78,7 +79,7 @@ assert(false);
}
}
QCString
VhdlParser
::
actual_designator
()
{
QCString
str
;
Token
*
t
;
QCString
VhdlParser
::
actual_designator
()
{
QCString
str
;
Token
*
t
=
0
;
switch
((
jj_ntk
==-
1
)
?
jj_ntk_f
()
:
jj_ntk
)
{
switch
((
jj_ntk
==-
1
)
?
jj_ntk_f
()
:
jj_ntk
)
{
case
OPEN_T
:{
if
(
!
hasError
)
{
case
OPEN_T
:{
if
(
!
hasError
)
{
...
@@ -816,7 +817,7 @@ assert(false);
...
@@ -816,7 +817,7 @@ assert(false);
}
}
QCString
VhdlParser
::
attribute_designator
()
{
QCString
s
;
Token
*
tok
;
QCString
VhdlParser
::
attribute_designator
()
{
QCString
s
;
Token
*
tok
=
0
;
switch
((
jj_ntk
==-
1
)
?
jj_ntk_f
()
:
jj_ntk
)
{
switch
((
jj_ntk
==-
1
)
?
jj_ntk_f
()
:
jj_ntk
)
{
case
BASIC_IDENTIFIER
:
case
BASIC_IDENTIFIER
:
case
EXTENDED_CHARACTER
:{
if
(
!
hasError
)
{
case
EXTENDED_CHARACTER
:{
if
(
!
hasError
)
{
...
@@ -935,7 +936,7 @@ assert(false);
...
@@ -935,7 +936,7 @@ assert(false);
}
}
QCString
VhdlParser
::
base
()
{
Token
*
tok
;
if
(
!
hasError
)
{
QCString
VhdlParser
::
base
()
{
Token
*
tok
=
0
;
if
(
!
hasError
)
{
tok
=
jj_consume_token
(
INTEGER
);
tok
=
jj_consume_token
(
INTEGER
);
}
}
...
@@ -945,7 +946,7 @@ assert(false);
...
@@ -945,7 +946,7 @@ assert(false);
}
}
QCString
VhdlParser
::
base_specifier
()
{
Token
*
tok
;
if
(
!
hasError
)
{
QCString
VhdlParser
::
base_specifier
()
{
Token
*
tok
=
0
;
if
(
!
hasError
)
{
tok
=
jj_consume_token
(
BASIC_IDENTIFIER
);
tok
=
jj_consume_token
(
BASIC_IDENTIFIER
);
}
}
...
@@ -965,7 +966,7 @@ assert(false);
...
@@ -965,7 +966,7 @@ assert(false);
}
}
QCString
VhdlParser
::
based_integer
()
{
Token
*
tok
;
if
(
!
hasError
)
{
QCString
VhdlParser
::
based_integer
()
{
Token
*
tok
=
0
;
if
(
!
hasError
)
{
tok
=
jj_consume_token
(
BASIC_IDENTIFIER
);
tok
=
jj_consume_token
(
BASIC_IDENTIFIER
);
}
}
...
@@ -975,7 +976,7 @@ assert(false);
...
@@ -975,7 +976,7 @@ assert(false);
}
}
QCString
VhdlParser
::
based_literal
()
{
Token
*
tok
;
if
(
!
hasError
)
{
QCString
VhdlParser
::
based_literal
()
{
Token
*
tok
=
0
;
if
(
!
hasError
)
{
tok
=
jj_consume_token
(
BASED_LITERAL
);
tok
=
jj_consume_token
(
BASED_LITERAL
);
}
}
...
@@ -985,7 +986,7 @@ assert(false);
...
@@ -985,7 +986,7 @@ assert(false);
}
}
QCString
VhdlParser
::
basic_identifier
()
{
Token
*
tok
;
if
(
!
hasError
)
{
QCString
VhdlParser
::
basic_identifier
()
{
Token
*
tok
=
0
;
if
(
!
hasError
)
{
tok
=
jj_consume_token
(
BASIC_IDENTIFIER
);
tok
=
jj_consume_token
(
BASIC_IDENTIFIER
);
}
}
...
@@ -1048,7 +1049,7 @@ void VhdlParser::binding_indication() {if (!hasError) {
...
@@ -1048,7 +1049,7 @@ void VhdlParser::binding_indication() {if (!hasError) {
}
}
QCString
VhdlParser
::
bit_string_literal
()
{
Token
*
tok
;
if
(
!
hasError
)
{
QCString
VhdlParser
::
bit_string_literal
()
{
Token
*
tok
=
0
;
if
(
!
hasError
)
{
tok
=
jj_consume_token
(
BIT_STRING_LITERAL
);
tok
=
jj_consume_token
(
BIT_STRING_LITERAL
);
}
}
...
@@ -1058,7 +1059,7 @@ assert(false);
...
@@ -1058,7 +1059,7 @@ assert(false);
}
}
QCString
VhdlParser
::
bit_value
()
{
Token
*
tok
;
if
(
!
hasError
)
{
QCString
VhdlParser
::
bit_value
()
{
Token
*
tok
=
0
;
if
(
!
hasError
)
{
tok
=
jj_consume_token
(
BASIC_IDENTIFIER
);
tok
=
jj_consume_token
(
BASIC_IDENTIFIER
);
}
}
...
@@ -1668,7 +1669,7 @@ FlowChart::moveToPrevLevel();
...
@@ -1668,7 +1669,7 @@ FlowChart::moveToPrevLevel();
}
}
QCString
VhdlParser
::
character_literal
()
{
Token
*
tok
;
if
(
!
hasError
)
{
QCString
VhdlParser
::
character_literal
()
{
Token
*
tok
=
0
;
if
(
!
hasError
)
{
tok
=
jj_consume_token
(
CHARACTER_LITERAL
);
tok
=
jj_consume_token
(
CHARACTER_LITERAL
);
}
}
...
@@ -2656,7 +2657,7 @@ void VhdlParser::context_item() {
...
@@ -2656,7 +2657,7 @@ void VhdlParser::context_item() {
}
}
QCString
VhdlParser
::
decimal_literal
()
{
Token
*
tok
;
if
(
!
hasError
)
{
QCString
VhdlParser
::
decimal_literal
()
{
Token
*
tok
=
0
;
if
(
!
hasError
)
{
tok
=
jj_consume_token
(
DECIMAL_LITERAL
);
tok
=
jj_consume_token
(
DECIMAL_LITERAL
);
}
}
...
@@ -2824,7 +2825,7 @@ assert(false);
...
@@ -2824,7 +2825,7 @@ assert(false);
}
}
QCString
VhdlParser
::
direction
()
{
Token
*
tok
;
QCString
VhdlParser
::
direction
()
{
Token
*
tok
=
0
;
switch
((
jj_ntk
==-
1
)
?
jj_ntk_f
()
:
jj_ntk
)
{
switch
((
jj_ntk
==-
1
)
?
jj_ntk_f
()
:
jj_ntk
)
{
case
TO_T
:{
if
(
!
hasError
)
{
case
TO_T
:{
if
(
!
hasError
)
{
...
@@ -2973,7 +2974,7 @@ assert(false);
...
@@ -2973,7 +2974,7 @@ assert(false);
}
}
QCString
VhdlParser
::
entity_aspect
()
{
Token
*
tok
;
QCString
s
,
s1
;
QCString
VhdlParser
::
entity_aspect
()
{
Token
*
tok
=
0
;
QCString
s
,
s1
;
switch
((
jj_ntk
==-
1
)
?
jj_ntk_f
()
:
jj_ntk
)
{
switch
((
jj_ntk
==-
1
)
?
jj_ntk_f
()
:
jj_ntk
)
{
case
ENTITY_T
:{
if
(
!
hasError
)
{
case
ENTITY_T
:{
if
(
!
hasError
)
{
...
@@ -4336,7 +4337,7 @@ assert(false);
...
@@ -4336,7 +4337,7 @@ assert(false);
}
}
QCString
VhdlParser
::
formal_designator
()
{
QCString
s
;
Token
*
tok
;
QCString
VhdlParser
::
formal_designator
()
{
QCString
s
;
Token
*
tok
=
0
;
switch
((
jj_ntk
==-
1
)
?
jj_ntk_f
()
:
jj_ntk
)
{
switch
((
jj_ntk
==-
1
)
?
jj_ntk_f
()
:
jj_ntk
)
{
case
SLSL_T
:
case
SLSL_T
:
case
STRINGLITERAL
:
case
STRINGLITERAL
:
...
@@ -4798,7 +4799,7 @@ void VhdlParser::guarded_signal_specification() {if (!hasError) {
...
@@ -4798,7 +4799,7 @@ void VhdlParser::guarded_signal_specification() {if (!hasError) {
}
}
QCString
VhdlParser
::
identifier
()
{
Token
*
tok
;
QCString
VhdlParser
::
identifier
()
{
Token
*
tok
=
0
;
switch
((
jj_ntk
==-
1
)
?
jj_ntk_f
()
:
jj_ntk
)
{
switch
((
jj_ntk
==-
1
)
?
jj_ntk_f
()
:
jj_ntk
)
{
case
EXTENDED_CHARACTER
:{
if
(
!
hasError
)
{
case
EXTENDED_CHARACTER
:{
if
(
!
hasError
)
{
...
@@ -5135,7 +5136,7 @@ assert(false);
...
@@ -5135,7 +5136,7 @@ assert(false);
}
}
QCString
VhdlParser
::
instantiation_unit
()
{
QCString
s
,
s1
,
s2
;
Token
*
tok
;
QCString
VhdlParser
::
instantiation_unit
()
{
QCString
s
,
s1
,
s2
;
Token
*
tok
=
0
;
switch
((
jj_ntk
==-
1
)
?
jj_ntk_f
()
:
jj_ntk
)
{
switch
((
jj_ntk
==-
1
)
?
jj_ntk_f
()
:
jj_ntk
)
{
case
COMPONENT_T
:
case
COMPONENT_T
:
case
BASIC_IDENTIFIER
:
case
BASIC_IDENTIFIER
:
...
@@ -5235,7 +5236,7 @@ assert(false);
...
@@ -5235,7 +5236,7 @@ assert(false);
}
}
QCString
VhdlParser
::
instantiation_list
()
{
QCString
s
;
Token
*
tok
;
QCString
VhdlParser
::
instantiation_list
()
{
QCString
s
;
Token
*
tok
=
0
;
switch
((
jj_ntk
==-
1
)
?
jj_ntk_f
()
:
jj_ntk
)
{
switch
((
jj_ntk
==-
1
)
?
jj_ntk_f
()
:
jj_ntk
)
{
case
BASIC_IDENTIFIER
:
case
BASIC_IDENTIFIER
:
case
EXTENDED_CHARACTER
:{
if
(
!
hasError
)
{
case
EXTENDED_CHARACTER
:{
if
(
!
hasError
)
{
...
@@ -5937,7 +5938,7 @@ assert(false);
...
@@ -5937,7 +5938,7 @@ assert(false);
}
}
QCString
VhdlParser
::
mode
()
{
Token
*
tok
;
QCString
VhdlParser
::
mode
()
{
Token
*
tok
=
0
;
switch
((
jj_ntk
==-
1
)
?
jj_ntk_f
()
:
jj_ntk
)
{
switch
((
jj_ntk
==-
1
)
?
jj_ntk_f
()
:
jj_ntk
)
{
case
IN_T
:{
if
(
!
hasError
)
{
case
IN_T
:{
if
(
!
hasError
)
{
...
@@ -6003,7 +6004,7 @@ assert(false);
...
@@ -6003,7 +6004,7 @@ assert(false);
}
}
QCString
VhdlParser
::
multiplying_operation
()
{
Token
*
tok
;
QCString
VhdlParser
::
multiplying_operation
()
{
Token
*
tok
=
0
;
switch
((
jj_ntk
==-
1
)
?
jj_ntk_f
()
:
jj_ntk
)
{
switch
((
jj_ntk
==-
1
)
?
jj_ntk_f
()
:
jj_ntk
)
{
case
MULT_T
:{
if
(
!
hasError
)
{
case
MULT_T
:{
if
(
!
hasError
)
{
...
@@ -6579,7 +6580,7 @@ assert(false);
...
@@ -6579,7 +6580,7 @@ assert(false);
}
}
QCString
VhdlParser
::
operator_symbol
()
{
Token
*
tok
;
if
(
!
hasError
)
{
QCString
VhdlParser
::
operator_symbol
()
{
Token
*
tok
=
0
;
if
(
!
hasError
)
{
tok
=
jj_consume_token
(
STRINGLITERAL
);
tok
=
jj_consume_token
(
STRINGLITERAL
);
}
}
...
@@ -6843,11 +6844,11 @@ lastCompound=current;
...
@@ -6843,11 +6844,11 @@ lastCompound=current;
clone
->
section
=
Entry
::
NAMESPACE_SEC
;
clone
->
section
=
Entry
::
NAMESPACE_SEC
;
clone
->
spec
=
VhdlDocGen
::
PACKAGE
;
clone
->
spec
=
VhdlDocGen
::
PACKAGE
;
clone
->
name
=
s
;
clone
->
name
=
s
;
clone
->
startLine
=
getLine
();
clone
->
startLine
=
getLine
(
PACKAGE_T
);
clone
->
bodyLine
=
getLine
();
clone
->
bodyLine
=
getLine
(
PACKAGE_T
);
clone
->
protection
=
Package
;
clone
->
protection
=
Package
;
current_root
->
addSubEntry
(
clone
);
current_root
->
addSubEntry
(
clone
);
addVhdlType
(
s
,
getLine
(),
Entry
::
CLASS_SEC
,
VhdlDocGen
::
PACKAGE
,
0
,
0
,
Package
);
addVhdlType
(
s
,
getLine
(
PACKAGE_T
),
Entry
::
CLASS_SEC
,
VhdlDocGen
::
PACKAGE
,
0
,
0
,
Package
);
}
}
if
(
!
hasError
)
{
if
(
!
hasError
)
{
...
@@ -9309,7 +9310,7 @@ assert(false);
...
@@ -9309,7 +9310,7 @@ assert(false);
}
}
QCString
VhdlParser
::
string_literal
()
{
Token
*
tok
;
if
(
!
hasError
)
{
QCString
VhdlParser
::
string_literal
()
{
Token
*
tok
=
0
;
if
(
!
hasError
)
{
tok
=
jj_consume_token
(
STRINGLITERAL
);
tok
=
jj_consume_token
(
STRINGLITERAL
);
}
}
...
@@ -12787,26 +12788,16 @@ void VhdlParser::parseInline() {
...
@@ -12787,26 +12788,16 @@ void VhdlParser::parseInline() {
VhdlParser
::
VhdlParser
(
TokenManager
*
tm
){
VhdlParser
::
VhdlParser
(
TokenManager
*
tm
){
head
=
NULL
;
head
=
NULL
;
errorHandlerCreated
=
false
;
ReInit
(
tm
);
ReInit
(
tm
);
}
}
VhdlParser
::~
VhdlParser
()
VhdlParser
::~
VhdlParser
()
{
{
if
(
token_source
)
delete
token_source
;
clear
();
if
(
head
)
{
Token
*
next
,
*
t
=
head
;
while
(
t
)
{
next
=
t
->
next
;
delete
t
;
t
=
next
;
}
}
if
(
errorHandlerCreated
)
{
delete
errorHandler
;
}
}
}
void
VhdlParser
::
ReInit
(
TokenManager
*
tm
){
void
VhdlParser
::
ReInit
(
TokenManager
*
tm
){
if
(
head
)
delete
head
;
clear
()
;
errorHandler
=
new
ErrorHandler
();
errorHandler
=
new
ErrorHandler
();
errorHandlerCreated
=
true
;
errorHandlerCreated
=
true
;
hasError
=
false
;
hasError
=
false
;
...
@@ -12828,6 +12819,24 @@ void VhdlParser::ReInit(TokenManager *tm){
...
@@ -12828,6 +12819,24 @@ void VhdlParser::ReInit(TokenManager *tm){
}
}
void
VhdlParser
::
clear
(){
//Since token manager was generate from outside,
//parser should not take care of deleting
//if (token_source) delete token_source;
if
(
head
)
{
Token
*
next
,
*
t
=
head
;
while
(
t
)
{
next
=
t
->
next
;
delete
t
;
t
=
next
;
}
}
if
(
errorHandlerCreated
)
{
delete
errorHandler
;
}
}
Token
*
VhdlParser
::
jj_consume_token
(
int
kind
)
{
Token
*
VhdlParser
::
jj_consume_token
(
int
kind
)
{
Token
*
oldToken
;
Token
*
oldToken
;
if
((
oldToken
=
token
)
->
next
!=
NULL
)
token
=
token
->
next
;
if
((
oldToken
=
token
)
->
next
!=
NULL
)
token
=
token
->
next
;
...
@@ -12907,26 +12916,23 @@ int VhdlParser::jj_ntk_f(){
...
@@ -12907,26 +12916,23 @@ int VhdlParser::jj_ntk_f(){
}
}
void
VhdlParser
::
jj_add_error_token
(
int
kind
,
int
pos
)
{
void
VhdlParser
::
jj_add_error_token
(
int
kind
,
int
pos
)
{
}
}
/** Generate ParseException. */
void
VhdlParser
::
parseError
()
{
void
VhdlParser
::
parseError
()
{
//
fprintf(stderr, "Parse error at: %d:%d, after token: %s encountered: %s\n", token->beginLine, token->beginColumn, addUnicodeEscapes(token->image).c_str(), addUnicodeEscapes(getToken(1)->image).c_str());
fprintf
(
stderr
,
"Parse error at: %d:%d, after token: %s encountered: %s
\n
"
,
token
->
beginLine
,
token
->
beginColumn
,
addUnicodeEscapes
(
token
->
image
).
c_str
(),
addUnicodeEscapes
(
getToken
(
1
)
->
image
).
c_str
());
}
}
void
VhdlParser
::
enable_tracing
()
{
void
VhdlParser
::
enable_tracing
()
{
}
}
/** Disable tracing. */
void
VhdlParser
::
disable_tracing
()
{
void
VhdlParser
::
disable_tracing
()
{
}
}
void
VhdlParser
::
jj_rescan_token
(){
void
VhdlParser
::
jj_rescan_token
(){
jj_rescan
=
true
;
jj_rescan
=
true
;
for
(
int
i
=
0
;
i
<
114
;
i
++
)
{
for
(
int
i
=
0
;
i
<
114
;
i
++
)
{
JJCalls
*
p
=
&
jj_2_rtns
[
i
];
JJCalls
*
p
=
&
jj_2_rtns
[
i
];
...
@@ -13057,7 +13063,7 @@ void VhdlParser::jj_rescan_token(){
...
@@ -13057,7 +13063,7 @@ void VhdlParser::jj_rescan_token(){
}
}
void
VhdlParser
::
jj_save
(
int
index
,
int
xla
){
void
VhdlParser
::
jj_save
(
int
index
,
int
xla
){
JJCalls
*
p
=
&
jj_2_rtns
[
index
];
JJCalls
*
p
=
&
jj_2_rtns
[
index
];
while
(
p
->
gen
>
jj_gen
)
{
while
(
p
->
gen
>
jj_gen
)
{
if
(
p
->
next
==
NULL
)
{
p
=
p
->
next
=
new
JJCalls
();
break
;
}
if
(
p
->
next
==
NULL
)
{
p
=
p
->
next
=
new
JJCalls
();
break
;
}
...
...
vhdlparser/VhdlParser.h
View file @
475b0c51
This diff is collapsed.
Click to expand it.
vhdlparser/VhdlParserTokenManager.cc
View file @
475b0c51
/* VhdlParserTokenManager.cc */
/* VhdlParserTokenManager.cc */
#include "./VhdlParserTokenManager.h"
#include "VhdlParserTokenManager.h"
#include "TokenMgrError.h"
namespace
vhdl
{
namespace
vhdl
{
namespace
parser
{
namespace
parser
{
static
const
unsigned
long
long
jjbitVec0
[]
=
{
static
const
unsigned
long
long
jjbitVec0
[]
=
{
...
@@ -3307,10 +3308,10 @@ bool VhdlParserTokenManager::jjCanMove_1(int hiByte, int i1, int i2, unsigned lo
...
@@ -3307,10 +3308,10 @@ bool VhdlParserTokenManager::jjCanMove_1(int hiByte, int i1, int i2, unsigned lo
Token
*
VhdlParserTokenManager
::
jjFillToken
(){
Token
*
VhdlParserTokenManager
::
jjFillToken
(){
Token
*
t
;
Token
*
t
;
JAVACC_STRING_TYPE
curTokenImage
;
JAVACC_STRING_TYPE
curTokenImage
;
int
beginLine
;
int
beginLine
=
-
1
;
int
endLine
;
int
endLine
=
-
1
;
int
beginColumn
;
int
beginColumn
=
-
1
;
int
endColumn
;
int
endColumn
=
-
1
;
JAVACC_STRING_TYPE
im
=
jjstrLiteralImages
[
jjmatchedKind
];
JAVACC_STRING_TYPE
im
=
jjstrLiteralImages
[
jjmatchedKind
];
curTokenImage
=
(
im
.
length
()
==
0
)
?
input_stream
->
GetImage
()
:
im
;
curTokenImage
=
(
im
.
length
()
==
0
)
?
input_stream
->
GetImage
()
:
im
;
if
(
input_stream
->
getTrackLineColumn
())
{
if
(
input_stream
->
getTrackLineColumn
())
{
...
@@ -3319,7 +3320,9 @@ Token * VhdlParserTokenManager::jjFillToken(){
...
@@ -3319,7 +3320,9 @@ Token * VhdlParserTokenManager::jjFillToken(){
endLine
=
input_stream
->
getEndLine
();
endLine
=
input_stream
->
getEndLine
();
endColumn
=
input_stream
->
getEndColumn
();
endColumn
=
input_stream
->
getEndColumn
();
}
}
t
=
Token
::
newToken
(
jjmatchedKind
,
curTokenImage
);
t
=
Token
::
newToken
(
jjmatchedKind
);
t
->
kind
=
jjmatchedKind
;
t
->
image
=
curTokenImage
;
t
->
specialToken
=
NULL
;
t
->
specialToken
=
NULL
;
t
->
next
=
NULL
;
t
->
next
=
NULL
;
...
@@ -3405,7 +3408,14 @@ void VhdlParserTokenManager::SkipLexicalActions(Token *matchedToken){
...
@@ -3405,7 +3408,14 @@ void VhdlParserTokenManager::SkipLexicalActions(Token *matchedToken){
}
}
case
6
:
{
case
6
:
{
image
.
append
(
input_stream
->
GetSuffix
(
jjimageLen
+
(
lengthOfMatch
=
jjmatchedPos
+
1
)));
image
.
append
(
input_stream
->
GetSuffix
(
jjimageLen
+
(
lengthOfMatch
=
jjmatchedPos
+
1
)));
::
vhdl
::
parser
::
VhdlParser
::
handleCommentBlock
(
image
.
data
(),
TRUE
);
QCString
doc
(
image
.
data
());
int
count
=
doc
.
contains
(
"--!"
);
::
vhdl
::
parser
::
VhdlParser
::
setMultCommentLine
();
::
vhdl
::
parser
::
VhdlParser
::
lineCount
(
image
.
data
());
if
(
count
==
1
)
::
vhdl
::
parser
::
VhdlParser
::
oneLineComment
(
doc
);
else
::
vhdl
::
parser
::
VhdlParser
::
handleCommentBlock
(
image
.
data
(),
FALSE
);
;
break
;
break
;
}
}
case
7
:
{
case
7
:
{
...
@@ -3560,7 +3570,7 @@ void VhdlParserTokenManager::TokenLexicalActions(Token *matchedToken){
...
@@ -3560,7 +3570,7 @@ void VhdlParserTokenManager::TokenLexicalActions(Token *matchedToken){
}
}
/** Reinitialise parser. */
/** Reinitialise parser. */
void
VhdlParserTokenManager
::
ReInit
(
JAVACC_CHARSTREAM
*
stream
,
int
lexState
,
VhdlParser
*
parserArg
)
{
void
VhdlParserTokenManager
::
ReInit
(
JAVACC_CHARSTREAM
*
stream
,
int
lexState
,
VhdlParser
*
parserArg
)
{
if
(
input_stream
)
delete
input_stream
;
clear
()
;
jjmatchedPos
=
jjnewStateCnt
=
0
;
jjmatchedPos
=
jjnewStateCnt
=
0
;
curLexState
=
lexState
;
curLexState
=
lexState
;
input_stream
=
stream
;
input_stream
=
stream
;
...
@@ -3581,10 +3591,17 @@ void VhdlParserTokenManager::TokenLexicalActions(Token *matchedToken){
...
@@ -3581,10 +3591,17 @@ void VhdlParserTokenManager::TokenLexicalActions(Token *matchedToken){
/** Switch to specified lex state. */
/** Switch to specified lex state. */
void
VhdlParserTokenManager
::
SwitchTo
(
int
lexState
)
{
void
VhdlParserTokenManager
::
SwitchTo
(
int
lexState
)
{
if
(
lexState
>=
1
||
lexState
<
0
)
if
(
lexState
>=
1
||
lexState
<
0
)
{
assert
(
false
);
JAVACC_STRING_TYPE
message
;
//throw 1;//new TokenMgrError("Error: Ignoring invalid lexical state : " + lexState + ". State unchanged.", TokenMgrError.INVALID_LEXICAL_STATE);
#ifdef WIDE_CHAR
else
message
+=
L"Error: Ignoring invalid lexical state : "
;
message
+=
lexState
;
message
+=
L". State unchanged."
;
#else
message
+=
"Error: Ignoring invalid lexical state : "
;
message
+=
lexState
;
message
+=
". State unchanged."
;
#endif
throw
new
TokenMgrError
(
message
,
INVALID_LEXICAL_STATE
);
}
else
curLexState
=
lexState
;
curLexState
=
lexState
;
}
}
...
@@ -3592,14 +3609,23 @@ void VhdlParserTokenManager::TokenLexicalActions(Token *matchedToken){
...
@@ -3592,14 +3609,23 @@ void VhdlParserTokenManager::TokenLexicalActions(Token *matchedToken){
VhdlParserTokenManager
::
VhdlParserTokenManager
(
JAVACC_CHARSTREAM
*
stream
,
int
lexState
,
VhdlParser
*
parserArg
)
VhdlParserTokenManager
::
VhdlParserTokenManager
(
JAVACC_CHARSTREAM
*
stream
,
int
lexState
,
VhdlParser
*
parserArg
)
{
{
input_stream
=
NULL
;
input_stream
=
NULL
;
errorHandlerCreated
=
false
;
ReInit
(
stream
,
lexState
,
parserArg
);
ReInit
(
stream
,
lexState
,
parserArg
);
}
}
// Destructor
// Destructor
VhdlParserTokenManager
::~
VhdlParserTokenManager
()
{
VhdlParserTokenManager
::~
VhdlParserTokenManager
()
{
if
(
input_stream
)
delete
input_stream
;
clear
();
}
// clear
void
VhdlParserTokenManager
::
clear
()
{
//Since input_stream was generated outside of TokenManager
//TokenManager should not take care of deleting it
//if (input_stream) delete input_stream;
if
(
errorHandlerCreated
)
delete
errorHandler
;
if
(
errorHandlerCreated
)
delete
errorHandler
;
}
}
}
}
}
}
vhdlparser/VhdlParserTokenManager.h
View file @
475b0c51
#ifndef VHDLPARSERTOKENMANAGER_H
#ifndef VHDLPARSERTOKENMANAGER_H
#define VHDLPARSERTOKENMANAGER_H
#define VHDLPARSERTOKENMANAGER_H
#include "stdio.h"
#include "JavaCC.h"
#include "JavaCC.h"
#include "CharStream.h"
#include "CharStream.h"
#include "Token.h"
#include "Token.h"
...
@@ -116,9 +117,10 @@ void TokenLexicalActions(Token *matchedToken);
...
@@ -116,9 +117,10 @@ void TokenLexicalActions(Token *matchedToken);
public
:
virtual
~
VhdlParserTokenManager
();
public
:
virtual
~
VhdlParserTokenManager
();
void
ReInit
(
JAVACC_CHARSTREAM
*
stream
,
int
lexState
=
0
,
VhdlParser
*
parserArg
=
NULL
);
void
ReInit
(
JAVACC_CHARSTREAM
*
stream
,
int
lexState
=
0
,
VhdlParser
*
parserArg
=
NULL
);
void
SwitchTo
(
int
lexState
);
void
SwitchTo
(
int
lexState
);
void
clear
();
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
[
75
];
int
jjrounds
[
75
];
int
jjstateSet
[
2
*
75
];
int
jjstateSet
[
2
*
75
];
JAVACC_STRING_TYPE
jjimage
;
JAVACC_STRING_TYPE
jjimage
;
...
@@ -126,13 +128,16 @@ void TokenLexicalActions(Token *matchedToken);
...
@@ -126,13 +128,16 @@ void TokenLexicalActions(Token *matchedToken);
int
jjimageLen
;
int
jjimageLen
;
int
lengthOfMatch
;
int
lengthOfMatch
;
JAVACC_CHAR_TYPE
curChar
;
JAVACC_CHAR_TYPE
curChar
;
TokenManagerErrorHandler
*
errorHandler
;
TokenManagerErrorHandler
*
errorHandler
;
bool
errorHandlerCreated
;
bool
errorHandlerCreated
;
public
:
void
setErrorHandler
(
TokenManagerErrorHandler
*
eh
)
{
public
:
void
setErrorHandler
(
TokenManagerErrorHandler
*
eh
)
{
if
(
errorHandlerCreated
&&
errorHandler
!=
NULL
)
delete
errorHandler
;
if
(
errorHandlerCreated
&&
errorHandler
!=
NULL
)
delete
errorHandler
;
errorHandler
=
eh
;
errorHandler
=
eh
;
errorHandlerCreated
=
false
;
errorHandlerCreated
=
false
;
}
}
};
};
}
}
}
}
...
...
vhdlparser/vhdlparser.jj
View file @
475b0c51
...
@@ -27,7 +27,6 @@ PARSER_BEGIN(VhdlParser)
...
@@ -27,7 +27,6 @@ PARSER_BEGIN(VhdlParser)
typedef unsigned long long uint64;
typedef unsigned long long uint64;
static Entry* current_root;
static Entry* current_root;
static Entry* tempEntry;
static Entry* tempEntry;
static Entry* lastEntity ;
static Entry* lastEntity ;
...
@@ -68,7 +67,8 @@ static bool addLibUseClause(const QCString &type);
...
@@ -68,7 +67,8 @@ static bool addLibUseClause(const QCString &type);
static void mapLibPackage( Entry* root);
static void mapLibPackage( Entry* root);
static void createFlow();
static void createFlow();
static void error_skipto(int kind);
static void error_skipto(int kind);
static void oneLineComment(QCString qcs);
static void setMultCommentLine();
PARSER_END(VhdlParser)
PARSER_END(VhdlParser)
SKIP :
SKIP :
...
@@ -84,9 +84,22 @@ SKIP:
...
@@ -84,9 +84,22 @@ SKIP:
// VHDL comment -- ......
// VHDL comment -- ......
// VHDL doxygen line comment --! ....
// VHDL doxygen line comment --! ....
<#DOXYGEN_VHDL_COMMENT: (" "|"\t")*"--!"(~["\n", "\r"])* ("\n" | "\r" | "\r\n")?>
<#DOXYGEN_VHDL_COMMENT: (" "|"\t")*"--!"(~["\n", "\r"])* ("\n" | "\r" | "\r\n")?>
| <MULT_DOXYGEN_COMMENT: (<DOXYGEN_VHDL_COMMENT>)+ > { ::vhdl::parser::VhdlParser::handleCommentBlock(image.data(),TRUE); }
| <MULT_DOXYGEN_COMMENT: (<DOXYGEN_VHDL_COMMENT>)+ >
{
QCString doc(image.data());
int count=doc.contains("--!");
::vhdl::parser::VhdlParser::setMultCommentLine();
::vhdl::parser::VhdlParser::lineCount(image.data());
if (count == 1)
::vhdl::parser::VhdlParser::oneLineComment(doc);
else
::vhdl::parser::VhdlParser::handleCommentBlock(image.data(),FALSE); ;
}
|<VHDL_FLOWCHART_COMMENT: "--#" (~["\n", "\r"])* ("\n" | "\r" | "\r\n")?> { ::vhdl::parser::VhdlParser::handleFlowComment(image.data());}
|<VHDL_FLOWCHART_COMMENT: "--#" (~["\n", "\r"])* ("\n" | "\r" | "\r\n")?> { ::vhdl::parser::VhdlParser::handleFlowComment(image.data());}
|<VHDL_COMMENT: "--" (~["\n", "\r"])* ("\n" | "\r" | "\r\n")?> { ::vhdl::parser::VhdlParser::lineCount(image.data());}
|<VHDL_COMMENT: "--" (~["\n", "\r"])* ("\n" | "\r" | "\r\n")?>
{
::vhdl::parser::VhdlParser::lineCount(image.data());}
}
}
// VHDL 2008 comment /* .... */
// VHDL 2008 comment /* .... */
...
@@ -306,13 +319,13 @@ QCString abstract_literal() :
...
@@ -306,13 +319,13 @@ QCString abstract_literal() :
}
}
QCString access_type_definition() :
QCString access_type_definition() :
{Token *tok;QCString str,str1;}
{Token *tok
=0
;QCString str,str1;}
{
{
tok=<ACCESS_T> str1=subtype_indication() {str=tok->image.c_str(); return str+str1;
}
tok=<ACCESS_T> str1=subtype_indication() { str=tok->image.c_str(); return str+str1;
}
}
}
QCString actual_designator() :
QCString actual_designator() :
{QCString str;Token *t;}
{QCString str;Token *t
=0
;}
{
{
t=<OPEN_T> { return t->image.c_str(); }
t=<OPEN_T> { return t->image.c_str(); }
|
|
...
@@ -462,7 +475,7 @@ QCString attribute_declaration() : {QCString s,s1;}
...
@@ -462,7 +475,7 @@ QCString attribute_declaration() : {QCString s,s1;}
}
}
}
}
QCString attribute_designator (): {QCString s;Token *tok;}
QCString attribute_designator (): {QCString s;Token *tok
=0
;}
{
{
s=identifier() { return s;}
s=identifier() { return s;}
| tok=<RANGE_T> { return tok->image.c_str(); }
| tok=<RANGE_T> { return tok->image.c_str(); }
...
@@ -484,12 +497,12 @@ QCString attribute_specification(): {QCString s,s1,s2;}
...
@@ -484,12 +497,12 @@ QCString attribute_specification(): {QCString s,s1,s2;}
}
}
}
}
QCString base() : {Token *tok;}
QCString base() : {Token *tok
=0
;}
{
{
tok=<INTEGER> { return tok->image.c_str();}
tok=<INTEGER> { return tok->image.c_str();}
}
}
QCString base_specifier (): {Token *tok;}
QCString base_specifier (): {Token *tok
=0
;}
{
{
tok=<BASIC_IDENTIFIER> { return tok->image.c_str();}
tok=<BASIC_IDENTIFIER> { return tok->image.c_str();}
}
}
...
@@ -500,17 +513,17 @@ QCString base_unit_declaration() :
...
@@ -500,17 +513,17 @@ QCString base_unit_declaration() :
s=identifier() { return s; }
s=identifier() { return s; }
}
}
QCString based_integer() : {Token *tok;}
QCString based_integer() : {Token *tok
=0
;}
{
{
tok=<BASIC_IDENTIFIER> { return tok->image.c_str();}
tok=<BASIC_IDENTIFIER> { return tok->image.c_str();}
}
}
QCString based_literal(): {Token *tok;}
QCString based_literal(): {Token *tok
=0
;}
{
{
tok=<BASED_LITERAL> { return tok->image.c_str();}
tok=<BASED_LITERAL> { return tok->image.c_str();}
}
}
QCString basic_identifier() : {Token *tok;}
QCString basic_identifier() : {Token *tok
=0
;}
{
{
tok=<BASIC_IDENTIFIER> { return tok->image.c_str();}
tok=<BASIC_IDENTIFIER> { return tok->image.c_str();}
}
}
...
@@ -522,13 +535,13 @@ void binding_indication() : {}
...
@@ -522,13 +535,13 @@ void binding_indication() : {}
[ port_map_aspect() ]
[ port_map_aspect() ]
}
}
QCString bit_string_literal (): {Token *tok;}
QCString bit_string_literal (): {Token *tok
=0
;}
{
{
tok=<BIT_STRING_LITERAL> { return tok->image.c_str();}
tok=<BIT_STRING_LITERAL> { return tok->image.c_str();}
}
}
QCString bit_value() : {Token *tok;}
QCString bit_value() : {Token *tok
=0
;}
{
{
tok=<BASIC_IDENTIFIER> { return tok->image.c_str();}
tok=<BASIC_IDENTIFIER> { return tok->image.c_str();}
}
}
...
@@ -631,7 +644,7 @@ void case_statement_alternative() : {QCString s;}
...
@@ -631,7 +644,7 @@ void case_statement_alternative() : {QCString s;}
sequence_of_statement(){FlowChart::moveToPrevLevel(); }
sequence_of_statement(){FlowChart::moveToPrevLevel(); }
}
}
QCString character_literal() : {Token *tok;}
QCString character_literal() : {Token *tok
=0
;}
{
{
tok=<CHARACTER_LITERAL>{ return tok->image.c_str();}
tok=<CHARACTER_LITERAL>{ return tok->image.c_str();}
}
}
...
@@ -866,7 +879,7 @@ void context_item() : {}
...
@@ -866,7 +879,7 @@ void context_item() : {}
| use_clause()
| use_clause()
}
}
QCString decimal_literal() : {Token *tok;}
QCString decimal_literal() : {Token *tok
=0
;}
{
{
tok=<DECIMAL_LITERAL> { return tok->image.c_str(); }
tok=<DECIMAL_LITERAL> { return tok->image.c_str(); }
}
}
...
@@ -896,7 +909,7 @@ QCString designator() : {QCString s;}
...
@@ -896,7 +909,7 @@ QCString designator() : {QCString s;}
| s=operator_symbol(){return s;}
| s=operator_symbol(){return s;}
}
}
QCString direction (): {Token *tok;}
QCString direction (): {Token *tok
=0
;}
{
{
tok=<TO_T> { return tok->image.c_str();}
tok=<TO_T> { return tok->image.c_str();}
| tok=<DOWNTO_T> { return tok->image.c_str();}
| tok=<DOWNTO_T> { return tok->image.c_str();}
...
@@ -937,7 +950,7 @@ s=identifier_list() <COLON_T> s1=subtype_indication() <SEMI_T> {return s+":"+s1;
...
@@ -937,7 +950,7 @@ s=identifier_list() <COLON_T> s1=subtype_indication() <SEMI_T> {return s+":"+s1;
}
}
QCString entity_aspect() : {Token *tok;QCString s,s1;}
QCString entity_aspect() : {Token *tok
=0
;QCString s,s1;}
{
{
tok=<ENTITY_T> s=name() [ LOOKAHEAD(1)<LPAREN_T> s1=identifier() <RPAREN_T> {s+="("+s1+")";} ] { return s;}
tok=<ENTITY_T> s=name() [ LOOKAHEAD(1)<LPAREN_T> s1=identifier() <RPAREN_T> {s+="("+s1+")";} ] { return s;}
| tok=<CONFIGURATION_T> s=name() { return tok->image.c_str()+s;}
| tok=<CONFIGURATION_T> s=name() { return tok->image.c_str()+s;}
...
@@ -1156,7 +1169,7 @@ QCString floating_type_definition() : {QCString s;}
...
@@ -1156,7 +1169,7 @@ QCString floating_type_definition() : {QCString s;}
s=range_constraint(){ return s;}
s=range_constraint(){ return s;}
}
}
QCString formal_designator() : {QCString s;Token *tok
;}
QCString formal_designator() : {QCString s;Token *tok
=0;}
{
{
s=name() { return s; }
s=name() { return s; }
|tok=<INTEGER> { return tok->image.c_str();}
|tok=<INTEGER> { return tok->image.c_str();}
...
@@ -1256,7 +1269,7 @@ void guarded_signal_specification() : {}
...
@@ -1256,7 +1269,7 @@ void guarded_signal_specification() : {}
signal_list() <COLON_T> type_mark()
signal_list() <COLON_T> type_mark()
}
}
QCString identifier() : {Token *tok;}
QCString identifier() : {Token *tok
=0
;}
{
{
tok=<EXTENDED_CHARACTER>{ return tok->image.c_str(); }
tok=<EXTENDED_CHARACTER>{ return tok->image.c_str(); }
|tok=<BASIC_IDENTIFIER> { return tok->image.c_str(); }
|tok=<BASIC_IDENTIFIER> { return tok->image.c_str(); }
...
@@ -1322,14 +1335,14 @@ QCString index_subtype_definition() : {QCString s;}
...
@@ -1322,14 +1335,14 @@ QCString index_subtype_definition() : {QCString s;}
s=type_mark() <RANGE_T> <BOX_T> { return s+" range <> ";}
s=type_mark() <RANGE_T> <BOX_T> { return s+" range <> ";}
}
}
QCString instantiation_unit() : {QCString s,s1,s2;Token *tok;}
QCString instantiation_unit() : {QCString s,s1,s2;Token *tok
=0
;}
{
{
[ tok=<COMPONENT_T> ] s=identifier() {s1="component"; return s; }
[ tok=<COMPONENT_T> ] s=identifier() {s1="component"; return s; }
| tok=<ENTITY_T> s2=name() {s=tok->image.c_str()+s2;} [ <LPAREN_T> s1=identifier() <RPAREN_T> {s+="(";s+=s1;s+=")" ;}] { return s;}
| tok=<ENTITY_T> s2=name() {s=tok->image.c_str()+s2;} [ <LPAREN_T> s1=identifier() <RPAREN_T> {s+="(";s+=s1;s+=")" ;}] { return s;}
| <CONFIGURATION_T> s=name() {s1="configuration ";return s;}
| <CONFIGURATION_T> s=name() {s1="configuration ";return s;}
}
}
QCString instantiation_list() : {QCString s;Token *tok;}
QCString instantiation_list() : {QCString s;Token *tok
=0
;}
{
{
s=identifier_list() { return s;}
s=identifier_list() { return s;}
| tok=<OTHER_T> {return tok->image.c_str();}
| tok=<OTHER_T> {return tok->image.c_str();}
...
@@ -1524,7 +1537,7 @@ QCString miscellaneous_operator():{Token *t=0;}
...
@@ -1524,7 +1537,7 @@ QCString miscellaneous_operator():{Token *t=0;}
| <NOT_T> {return "not";}
| <NOT_T> {return "not";}
}
}
QCString mode() : {Token *tok;}
QCString mode() : {Token *tok
=0
;}
{
{
tok=<IN_T> { return "in"; }
tok=<IN_T> { return "in"; }
| tok=<OUT_T> { return "out"; }
| tok=<OUT_T> { return "out"; }
...
@@ -1533,7 +1546,7 @@ tok=<IN_T> { return "in"; }
...
@@ -1533,7 +1546,7 @@ tok=<IN_T> { return "in"; }
| tok=<LINKAGE_T> { return "linkage"; }
| tok=<LINKAGE_T> { return "linkage"; }
}
}
QCString multiplying_operation() : {Token *tok;}
QCString multiplying_operation() : {Token *tok
=0
;}
{
{
tok=<MULT_T> { return tok->image.c_str(); }
tok=<MULT_T> { return tok->image.c_str(); }
| tok=<SLASH_T> { return tok->image.c_str(); }
| tok=<SLASH_T> { return tok->image.c_str(); }
...
@@ -1625,7 +1638,7 @@ QCString object_class() : {}
...
@@ -1625,7 +1638,7 @@ QCString object_class() : {}
|<TYPE_T> { return "type"; }
|<TYPE_T> { return "type"; }
}
}
QCString operator_symbol() : {Token *tok;}
QCString operator_symbol() : {Token *tok
=0
;}
{
{
tok=<STRINGLITERAL> {return tok->image.c_str();}
tok=<STRINGLITERAL> {return tok->image.c_str();}
}
}
...
@@ -1680,11 +1693,11 @@ void package_declaration(): {QCString s;}
...
@@ -1680,11 +1693,11 @@ void package_declaration(): {QCString s;}
clone->section=Entry::NAMESPACE_SEC;
clone->section=Entry::NAMESPACE_SEC;
clone->spec=VhdlDocGen::PACKAGE;
clone->spec=VhdlDocGen::PACKAGE;
clone->name=s;
clone->name=s;
clone->startLine=getLine();
clone->startLine=getLine(
PACKAGE_T
);
clone->bodyLine=getLine();
clone->bodyLine=getLine(
PACKAGE_T
);
clone->protection=Package;
clone->protection=Package;
current_root->addSubEntry(clone);
current_root->addSubEntry(clone);
addVhdlType(s,getLine(
),Entry::CLASS_SEC,VhdlDocGen::PACKAGE,0,0,Package);
addVhdlType(s,getLine(
PACKAGE_T),Entry::CLASS_SEC,VhdlDocGen::PACKAGE,0,0,Package);
}
}
package_declarative_part()
package_declarative_part()
<END_T> [ <PACKAGE_T>] [ name() ] <SEMI_T>
<END_T> [ <PACKAGE_T>] [ name() ] <SEMI_T>
...
@@ -2153,7 +2166,7 @@ QCString slice_name() : {QCString s,s1;}
...
@@ -2153,7 +2166,7 @@ QCString slice_name() : {QCString s,s1;}
s=identifier() <LPAREN_T> s1=discrete_range() <RPAREN_T> {return s+"("+s1+")";}
s=identifier() <LPAREN_T> s1=discrete_range() <RPAREN_T> {return s+"("+s1+")";}
}
}
QCString string_literal() : {Token *tok;}
QCString string_literal() : {Token *tok
=0
;}
{
{
tok=<STRINGLITERAL> {return tok->image.c_str();}
tok=<STRINGLITERAL> {return tok->image.c_str();}
}
}
...
...
vhdlparser/vhdlparser.patch
deleted
100644 → 0
View file @
e5076edf
--- VhdlParser.h 2014-07-27 14:26:18.000000000 +0200
+++ VhdlParser.h.new 2014-07-27 14:23:22.000000000 +0200
@@ -6,6 +6,7 @@
#include "TokenManager.h"
#include "VhdlParserTokenManager.h"
#include "VhdlParser.h"
+#include "vhdljjparser.h"
#include "VhdlParserConstants.h"
#include "ErrorHandler.h"
vhdlparser/vhdlstring.h
View file @
475b0c51
...
@@ -90,7 +90,8 @@ class VhdlString
...
@@ -90,7 +90,8 @@ class VhdlString
char
&
operator
[](
int
i
)
{
return
m_str
[
i
];
}
char
&
operator
[](
int
i
)
{
return
m_str
[
i
];
}
const
char
&
operator
[](
int
i
)
const
{
return
m_str
[
i
];
}
const
char
&
operator
[](
int
i
)
const
{
return
m_str
[
i
];
}
void
clear
()
{
free
(
m_str
);
init
();
}
void
clear
()
{
free
(
m_str
);
init
();
}
VhdlString
operator
+=
(
char
c
)
{
char
s
[
2
];
s
[
0
]
=
c
;
s
[
1
]
=
0
;
return
append
(
s
);
}
VhdlString
&
operator
+=
(
char
c
)
{
char
s
[
2
];
s
[
0
]
=
c
;
s
[
1
]
=
0
;
return
append
(
s
);
}
VhdlString
&
operator
+=
(
const
char
*
s
)
{
return
append
(
s
);
}
private
:
private
:
void
init
()
{
m_str
=
(
char
*
)
calloc
(
1
,
1
);
m_len
=
0
;
}
void
init
()
{
m_str
=
(
char
*
)
calloc
(
1
,
1
);
m_len
=
0
;
}
...
...
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