Preproc: fix pass-through of `line enter-exit codes.

Internals: Merge Verilog-Perl preproc changes through d450722.
This commit is contained in:
Wilson Snyder
2010-07-06 20:29:12 -04:00
parent beb3885840
commit 3841850168
9 changed files with 82 additions and 38 deletions
+3 -8
View File
@@ -675,12 +675,7 @@ void V3PreProcImp::insertUnreadbackAtBol(const string& text) {
void V3PreProcImp::addLineComment(int enter_exit_level) {
if (lineDirectives()) {
char numbuf[20]; sprintf(numbuf, "%d", m_lexp->m_curFilelinep->lineno());
char levelbuf[20]; sprintf(levelbuf, "%d", enter_exit_level);
string cmt = ((string)"`line "+numbuf
+" \""+m_lexp->m_curFilelinep->filename()+"\" "
+levelbuf+"\n");
insertUnreadbackAtBol(cmt);
insertUnreadbackAtBol(m_lexp->curFilelinep()->lineDirectiveStrg(enter_exit_level));
}
}
@@ -742,7 +737,7 @@ int V3PreProcImp::getRawToken() {
if (isEof()) return (VP_EOF);
// Snarf next token from the file
m_fileline = m_lexp->m_curFilelinep; // Remember token start location
m_fileline = m_lexp->curFilelinep(); // Remember token start location
V3PreLex::s_currentLexp = m_lexp; // Tell parser where to get/put data
int tok = yylex();
@@ -799,7 +794,7 @@ int V3PreProcImp::getToken() {
goto next_tok;
}
if (tok==VP_LINE) {
addLineComment(0);
addLineComment(m_lexp->m_enterExit);
goto next_tok;
}
// Deal with some special parser states