forked from github/verilator
Internals: Rename incLineno to match Verilog-Perl, no functional change.
This commit is contained in:
parent
a320c4584e
commit
8800efe953
@ -234,21 +234,26 @@ protected:
|
|||||||
// We are storing pointers, so we CAN'T change them after initial reading.
|
// We are storing pointers, so we CAN'T change them after initial reading.
|
||||||
friend class V3ParseImp;
|
friend class V3ParseImp;
|
||||||
friend class V3PreLex;
|
friend class V3PreLex;
|
||||||
|
friend class V3PreProcImp;
|
||||||
void lineno(int num) { m_lineno = num; }
|
void lineno(int num) { m_lineno = num; }
|
||||||
void filename(const string& name) { m_filename = name; }
|
void filename(const string& name) { m_filename = name; }
|
||||||
void lineDirective(const char* textp, int& enterExitRef);
|
void lineDirective(const char* textp, int& enterExitRef);
|
||||||
void incLineno() { m_lineno++; }
|
void linenoInc() { m_lineno++; }
|
||||||
|
void linenoIncInPlace() { m_lineno++; }
|
||||||
FileLine* copyOrSameFileLine();
|
FileLine* copyOrSameFileLine();
|
||||||
public:
|
public:
|
||||||
FileLine (const string& filename, int lineno) { m_lineno=lineno; m_filename = filename; m_warnOn=s_defaultFileLine.m_warnOn; }
|
FileLine (const string& filename, int lineno) { m_lineno=lineno; m_filename = filename; m_warnOn=s_defaultFileLine.m_warnOn; }
|
||||||
FileLine (FileLine* fromp) { m_lineno=fromp->lineno(); m_filename = fromp->filename(); m_warnOn=fromp->m_warnOn; }
|
FileLine (FileLine* fromp) { m_lineno=fromp->lineno(); m_filename = fromp->filename(); m_warnOn=fromp->m_warnOn; }
|
||||||
FileLine (EmptySecret);
|
FileLine (EmptySecret);
|
||||||
~FileLine() { }
|
~FileLine() { }
|
||||||
|
FileLine* create(const string& filename, int lineno) { return new FileLine(filename,lineno); }
|
||||||
|
FileLine* create(int lineno) { return create(filename(), lineno); }
|
||||||
static void deleteAllRemaining();
|
static void deleteAllRemaining();
|
||||||
#ifdef VL_LEAK_CHECKS
|
#ifdef VL_LEAK_CHECKS
|
||||||
static void* operator new(size_t size);
|
static void* operator new(size_t size);
|
||||||
static void operator delete(void* obj, size_t size);
|
static void operator delete(void* obj, size_t size);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
int lineno () const { return m_lineno; }
|
int lineno () const { return m_lineno; }
|
||||||
string ascii() const;
|
string ascii() const;
|
||||||
const string filename () const { return m_filename; }
|
const string filename () const { return m_filename; }
|
||||||
|
@ -249,7 +249,7 @@ public:
|
|||||||
static bool optFuture(const string& flag) { return v3Global.opt.isFuture(flag); }
|
static bool optFuture(const string& flag) { return v3Global.opt.isFuture(flag); }
|
||||||
|
|
||||||
void ppline (const char* text);
|
void ppline (const char* text);
|
||||||
void incLineno() { fileline()->incLineno(); }
|
void linenoInc() { fileline()->linenoInc(); }
|
||||||
void verilatorCmtLint(const char* text, bool on);
|
void verilatorCmtLint(const char* text, bool on);
|
||||||
void verilatorCmtLintSave();
|
void verilatorCmtLintSave();
|
||||||
void verilatorCmtLintRestore();
|
void verilatorCmtLintRestore();
|
||||||
|
@ -32,8 +32,12 @@
|
|||||||
|
|
||||||
#include "V3Error.h"
|
#include "V3Error.h"
|
||||||
|
|
||||||
|
//======================================================================
|
||||||
|
|
||||||
|
class V3PreProcImp;
|
||||||
|
|
||||||
// Token codes
|
// Token codes
|
||||||
// If changing, see V3Pre.cpp's V3PreImp::tokenName()
|
// If changing, see V3PreProc.cpp's V3PreProcImp::tokenName()
|
||||||
#define VP_EOF 0
|
#define VP_EOF 0
|
||||||
|
|
||||||
#define VP_INCLUDE 256
|
#define VP_INCLUDE 256
|
||||||
@ -160,7 +164,7 @@ class V3PreLex {
|
|||||||
void curFilelinep(FileLine* fl) { m_curFilelinep = fl; }
|
void curFilelinep(FileLine* fl) { m_curFilelinep = fl; }
|
||||||
void appendDefValue(const char* text, size_t len);
|
void appendDefValue(const char* text, size_t len);
|
||||||
void lineDirective(const char* textp);
|
void lineDirective(const char* textp);
|
||||||
void incLineno() { curFilelinep()->incLineno(); }
|
void linenoInc() { curFilelinep()->linenoInc(); }
|
||||||
// Called by V3PreProc.cpp to inform lexer
|
// Called by V3PreProc.cpp to inform lexer
|
||||||
void pushStateDefArg(int level);
|
void pushStateDefArg(int level);
|
||||||
void pushStateDefForm();
|
void pushStateDefForm();
|
||||||
|
@ -41,7 +41,7 @@ size_t yyourleng() { return yyleng; }
|
|||||||
void yyourtext(const char* textp, size_t size) { yytext=(char*)textp; yyleng=size; }
|
void yyourtext(const char* textp, size_t size) { yytext=(char*)textp; yyleng=size; }
|
||||||
|
|
||||||
// Prevent conflicts from perl version
|
// Prevent conflicts from perl version
|
||||||
static void linenoInc() {LEXP->incLineno();}
|
static void linenoInc() {LEXP->linenoInc();}
|
||||||
static bool optPsl() { return V3PreProc::optPsl(); }
|
static bool optPsl() { return V3PreProc::optPsl(); }
|
||||||
static bool pedantic() { return LEXP->m_pedantic; }
|
static bool pedantic() { return LEXP->m_pedantic; }
|
||||||
static void yyerror(char* msg) { LEXP->curFilelinep()->v3error(msg); }
|
static void yyerror(char* msg) { LEXP->curFilelinep()->v3error(msg); }
|
||||||
@ -145,7 +145,7 @@ psl [p]sl
|
|||||||
<DEFFPAR><<EOF>> { yy_pop_state(); return VP_DEFFORM; } /* empty formals */
|
<DEFFPAR><<EOF>> { yy_pop_state(); return VP_DEFFORM; } /* empty formals */
|
||||||
<DEFFPAR>. { yy_pop_state(); unput(yytext[yyleng-1]); yyleng=0; return VP_DEFFORM; } /* empty formals */
|
<DEFFPAR>. { yy_pop_state(); unput(yytext[yyleng-1]); yyleng=0; return VP_DEFFORM; } /* empty formals */
|
||||||
|
|
||||||
/* Reading definition formals */
|
/* Reading definition formals (declaration of a define) */
|
||||||
<DEFFORM>[(] { appendDefValue(yytext,yyleng); yyleng=0; ++LEXP->m_formalLevel; }
|
<DEFFORM>[(] { appendDefValue(yytext,yyleng); yyleng=0; ++LEXP->m_formalLevel; }
|
||||||
<DEFFORM>[)] { appendDefValue(yytext,yyleng); yyleng=0; if ((--LEXP->m_formalLevel)==0) { yy_pop_state(); return VP_DEFFORM; } }
|
<DEFFORM>[)] { appendDefValue(yytext,yyleng); yyleng=0; if ((--LEXP->m_formalLevel)==0) { yy_pop_state(); return VP_DEFFORM; } }
|
||||||
<DEFFORM>"/*" { yy_push_state(CMTMODE); yymore(); }
|
<DEFFORM>"/*" { yy_push_state(CMTMODE); yymore(); }
|
||||||
@ -161,7 +161,7 @@ psl [p]sl
|
|||||||
<DEFFORM>[\\][^\n\r] |
|
<DEFFORM>[\\][^\n\r] |
|
||||||
<DEFFORM>. { appendDefValue(yytext,yyleng); }
|
<DEFFORM>. { appendDefValue(yytext,yyleng); }
|
||||||
|
|
||||||
/* Reading definition value */
|
/* Reading definition value (declaration of a define's text) */
|
||||||
<DEFVAL>"/*" { LEXP->m_defCmtSlash=false; yy_push_state(DEFCMT); yymore(); } /* Special comment parser */
|
<DEFVAL>"/*" { LEXP->m_defCmtSlash=false; yy_push_state(DEFCMT); yymore(); } /* Special comment parser */
|
||||||
<DEFVAL>"//"[^\n\r]*[\\]{crnl} { linenoInc(); appendDefValue((char*)"\n",1); } /* Spec says // not part of define value */
|
<DEFVAL>"//"[^\n\r]*[\\]{crnl} { linenoInc(); appendDefValue((char*)"\n",1); } /* Spec says // not part of define value */
|
||||||
<DEFVAL>"//"[^\n\r]* { return (VP_COMMENT);}
|
<DEFVAL>"//"[^\n\r]* { return (VP_COMMENT);}
|
||||||
|
@ -391,28 +391,28 @@ void V3PreProcImp::comment(const string& text) {
|
|||||||
|
|
||||||
const char* V3PreProcImp::tokenName(int tok) {
|
const char* V3PreProcImp::tokenName(int tok) {
|
||||||
switch (tok) {
|
switch (tok) {
|
||||||
case VP_EOF : return("EOF");
|
case VP_COMMENT : return("COMMENT");
|
||||||
case VP_INCLUDE : return("INCLUDE");
|
case VP_DEFARG : return("DEFARG");
|
||||||
case VP_IFDEF : return("IFDEF");
|
case VP_DEFFORM : return("DEFFORM");
|
||||||
case VP_IFNDEF : return("IFNDEF");
|
|
||||||
case VP_ENDIF : return("ENDIF");
|
|
||||||
case VP_UNDEF : return("UNDEF");
|
|
||||||
case VP_DEFINE : return("DEFINE");
|
case VP_DEFINE : return("DEFINE");
|
||||||
|
case VP_DEFREF : return("DEFREF");
|
||||||
|
case VP_DEFVALUE : return("DEFVALUE");
|
||||||
case VP_ELSE : return("ELSE");
|
case VP_ELSE : return("ELSE");
|
||||||
case VP_ELSIF : return("ELSIF");
|
case VP_ELSIF : return("ELSIF");
|
||||||
case VP_LINE : return("LINE");
|
case VP_ENDIF : return("ENDIF");
|
||||||
case VP_SYMBOL : return("SYMBOL");
|
case VP_EOF : return("EOF");
|
||||||
case VP_STRING : return("STRING");
|
|
||||||
case VP_DEFFORM : return("DEFFORM");
|
|
||||||
case VP_DEFVALUE : return("DEFVALUE");
|
|
||||||
case VP_COMMENT : return("COMMENT");
|
|
||||||
case VP_TEXT : return("TEXT");
|
|
||||||
case VP_WHITE : return("WHITE");
|
|
||||||
case VP_DEFREF : return("DEFREF");
|
|
||||||
case VP_DEFARG : return("DEFARG");
|
|
||||||
case VP_ERROR : return("ERROR");
|
case VP_ERROR : return("ERROR");
|
||||||
case VP_UNDEFINEALL : return("UNDEFINEALL");
|
case VP_IFDEF : return("IFDEF");
|
||||||
|
case VP_IFNDEF : return("IFNDEF");
|
||||||
|
case VP_INCLUDE : return("INCLUDE");
|
||||||
|
case VP_LINE : return("LINE");
|
||||||
case VP_PSL : return("PSL");
|
case VP_PSL : return("PSL");
|
||||||
|
case VP_STRING : return("STRING");
|
||||||
|
case VP_SYMBOL : return("SYMBOL");
|
||||||
|
case VP_TEXT : return("TEXT");
|
||||||
|
case VP_UNDEF : return("UNDEF");
|
||||||
|
case VP_UNDEFINEALL : return("UNDEFINEALL");
|
||||||
|
case VP_WHITE : return("WHITE");
|
||||||
default: return("?");
|
default: return("?");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -42,7 +42,7 @@ extern void yyerrorf(const char* format, ...);
|
|||||||
|
|
||||||
//======================================================================
|
//======================================================================
|
||||||
|
|
||||||
#define NEXTLINE() {PARSEP->incLineno();}
|
#define NEXTLINE() {PARSEP->linenoInc();}
|
||||||
#define CRELINE() (PARSEP->copyOrSameFileLine())
|
#define CRELINE() (PARSEP->copyOrSameFileLine())
|
||||||
|
|
||||||
#define FL { yylval.fl = CRELINE(); }
|
#define FL { yylval.fl = CRELINE(); }
|
||||||
|
Loading…
Reference in New Issue
Block a user