Internals: Detab and fix spacing style issues. No functional change.

When diff, recommend using "git diff --ignore-all-space"
When merging, recommend using "git merge -Xignore-all-space"
This commit is contained in:
Wilson Snyder 2019-07-11 06:57:49 -04:00
parent 6c5cc885a6
commit 58dfe9d071
2 changed files with 1080 additions and 1072 deletions

View File

@ -33,7 +33,7 @@ V3PreLex* V3PreLex::s_currentLexp = NULL; // Current lexing point
#define LEXP V3PreLex::s_currentLexp #define LEXP V3PreLex::s_currentLexp
#define YY_INPUT(buf,result,max_size) \ #define YY_INPUT(buf,result,max_size) \
result = LEXP->inputToLex(buf,max_size); result = LEXP->inputToLex(buf, max_size);
// Accessors, because flex keeps changing the type of yyleng // Accessors, because flex keeps changing the type of yyleng
char* yyourtext() { return yytext; } char* yyourtext() { return yytext; }
@ -45,7 +45,7 @@ static void linenoInc() {LEXP->linenoInc();}
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); }
static void yyerrorf(const char* msg) { LEXP->curFilelinep()->v3error(msg); } static void yyerrorf(const char* msg) { LEXP->curFilelinep()->v3error(msg); }
static void appendDefValue(const char* t, size_t l) { LEXP->appendDefValue(t,l); } static void appendDefValue(const char* t, size_t l) { LEXP->appendDefValue(t, l); }
/**********************************************************************/ /**********************************************************************/
%} %}
@ -84,27 +84,27 @@ bom [\357\273\277]
<INITIAL>{bom} { } <INITIAL>{bom} { }
<INITIAL,STRIFY>^{ws}*"`line"{ws}+.*{crnl} { LEXP->lineDirective(yytext); <INITIAL,STRIFY>^{ws}*"`line"{ws}+.*{crnl} { LEXP->lineDirective(yytext);
return(VP_LINE); } return VP_LINE; }
/* Special directives we recognize */ /* Special directives we recognize */
<INITIAL>"`define" { return(VP_DEFINE); } <INITIAL>"`define" { return VP_DEFINE; }
<INITIAL>"`else" { return(VP_ELSE); } <INITIAL>"`else" { return VP_ELSE; }
<INITIAL>"`elsif" { return(VP_ELSIF); } <INITIAL>"`elsif" { return VP_ELSIF; }
<INITIAL>"`endif" { return(VP_ENDIF); } <INITIAL>"`endif" { return VP_ENDIF; }
<INITIAL>"`ifdef" { return(VP_IFDEF); } <INITIAL>"`ifdef" { return VP_IFDEF; }
<INITIAL>"`ifndef" { return(VP_IFNDEF); } <INITIAL>"`ifndef" { return VP_IFNDEF; }
<INITIAL>"`include" { return(VP_INCLUDE); } <INITIAL>"`include" { return VP_INCLUDE; }
<INITIAL>"`undef" { return(VP_UNDEF); } <INITIAL>"`undef" { return VP_UNDEF; }
<INITIAL>"`undefineall" { return(VP_UNDEFINEALL); } <INITIAL>"`undefineall" { return VP_UNDEFINEALL; }
<INITIAL>"`error" { if (!pedantic()) return (VP_ERROR); else return(VP_DEFREF); } <INITIAL>"`error" { if (!pedantic()) return VP_ERROR; else return VP_DEFREF; }
<INITIAL,STRIFY>"`__FILE__" { static string rtnfile; <INITIAL,STRIFY>"`__FILE__" { static string rtnfile;
rtnfile = '"'; rtnfile += LEXP->curFilelinep()->filename(); rtnfile = '"'; rtnfile += LEXP->curFilelinep()->filename();
rtnfile += '"'; yytext=(char*)rtnfile.c_str(); yyleng = rtnfile.length(); rtnfile += '"'; yytext = (char*)rtnfile.c_str(); yyleng = rtnfile.length();
return (VP_STRING); } return VP_STRING; }
<INITIAL,STRIFY>"`__LINE__" { static char buf[10]; <INITIAL,STRIFY>"`__LINE__" { static char buf[10];
sprintf(buf, "%d",LEXP->curFilelinep()->lineno()); sprintf(buf, "%d", LEXP->curFilelinep()->lineno());
yytext = buf; yyleng = strlen(yytext); yytext = buf; yyleng = strlen(yytext);
return (VP_TEXT); } return VP_TEXT; }
/* Pass-through strings */ /* Pass-through strings */
<INITIAL>{quote} { yy_push_state(STRMODE); yymore(); } <INITIAL>{quote} { yy_push_state(STRMODE); yymore(); }
@ -118,7 +118,7 @@ bom [\357\273\277]
<STRMODE>{quote} { yy_pop_state(); <STRMODE>{quote} { yy_pop_state();
if (LEXP->m_parenLevel || LEXP->m_defQuote) { if (LEXP->m_parenLevel || LEXP->m_defQuote) {
LEXP->m_defQuote=false; appendDefValue(yytext, yyleng); yyleng=0; LEXP->m_defQuote=false; appendDefValue(yytext, yyleng); yyleng=0;
} else return (VP_STRING); } } else return VP_STRING; }
/* Stringification */ /* Stringification */
<INITIAL>{tickquote} { yy_push_state(STRIFY); return VP_STRIFY; } <INITIAL>{tickquote} { yy_push_state(STRIFY); return VP_STRIFY; }
@ -126,26 +126,26 @@ bom [\357\273\277]
<STRIFY>"`\\`\"" { return VP_BACKQUOTE; } <STRIFY>"`\\`\"" { return VP_BACKQUOTE; }
<STRIFY>{quote} { yy_push_state(STRMODE); yymore(); } <STRIFY>{quote} { yy_push_state(STRMODE); yymore(); }
<STRIFY>{tickquote} { yy_pop_state(); return VP_STRIFY; } <STRIFY>{tickquote} { yy_pop_state(); return VP_STRIFY; }
<STRIFY>{symbdef} { return (VP_SYMBOL); } <STRIFY>{symbdef} { return VP_SYMBOL; }
<STRIFY>{symbdef}`` { yyleng-=2; return (VP_SYMBOL_JOIN); } <STRIFY>{symbdef}`` { yyleng-=2; return VP_SYMBOL_JOIN; }
<STRIFY>"`"{symbdef} { return (VP_DEFREF); } <STRIFY>"`"{symbdef} { return VP_DEFREF; }
<STRIFY>"`"{symbdef}`` { yyleng-=2; return (VP_DEFREF_JOIN); } <STRIFY>"`"{symbdef}`` { yyleng-=2; return VP_DEFREF_JOIN; }
<STRIFY>`` { yyleng-=2; return (VP_JOIN); } <STRIFY>`` { yyleng-=2; return VP_JOIN; }
<STRIFY>{crnl} { linenoInc(); yytext=(char*)"\n"; yyleng=1; return(VP_WHITE); } <STRIFY>{crnl} { linenoInc(); yytext = (char*)"\n"; yyleng = 1; return VP_WHITE; }
<STRIFY>{wsn}+ { return (VP_WHITE); } <STRIFY>{wsn}+ { return VP_WHITE; }
<STRIFY>{drop} { } <STRIFY>{drop} { }
<STRIFY>[\r] { } <STRIFY>[\r] { }
<STRIFY>. { return (VP_TEXT); } <STRIFY>. { return VP_TEXT; }
/* Protected blocks */ /* Protected blocks */
<INITIAL>"`protected" { yy_push_state(PRTMODE); yymore(); } <INITIAL>"`protected" { yy_push_state(PRTMODE); yymore(); }
<PRTMODE><<EOF>> { linenoInc(); yyerrorf("EOF in `protected"); yyleng=0; yyterminate(); } <PRTMODE><<EOF>> { linenoInc(); yyerrorf("EOF in `protected"); yyleng = 0; yyterminate(); }
<PRTMODE>{crnl} { linenoInc(); return VP_TEXT; } <PRTMODE>{crnl} { linenoInc(); return VP_TEXT; }
<PRTMODE>. { yymore(); } <PRTMODE>. { yymore(); }
<PRTMODE>"`endprotected" { yy_pop_state(); return VP_TEXT; } <PRTMODE>"`endprotected" { yy_pop_state(); return VP_TEXT; }
/* Pass-through include <> filenames */ /* Pass-through include <> filenames */
<INCMODE><<EOF>> { linenoInc(); yyerrorf("EOF in unterminated include filename"); yyleng=0; yyterminate(); } <INCMODE><<EOF>> { linenoInc(); yyerrorf("EOF in unterminated include filename"); yyleng = 0; yyterminate(); }
<INCMODE>{crnl} { linenoInc(); yyerrorf("Unterminated include filename"); BEGIN(INITIAL); } <INCMODE>{crnl} { linenoInc(); yyerrorf("Unterminated include filename"); BEGIN(INITIAL); }
<INCMODE>[^\>\\] { yymore(); } <INCMODE>[^\>\\] { yymore(); }
<INCMODE>[\\]. { yymore(); } <INCMODE>[\\]. { yymore(); }
@ -153,52 +153,52 @@ bom [\357\273\277]
/* Reading definition formal parenthesis (or not) to begin formal arguments */ /* Reading definition formal parenthesis (or not) to begin formal arguments */
/* Note '(' must IMMEDIATELY follow definition name */ /* Note '(' must IMMEDIATELY follow definition name */
<DEFFPAR>[(] { appendDefValue("(",1); LEXP->m_formalLevel=1; BEGIN(DEFFORM); } <DEFFPAR>[(] { appendDefValue("(", 1); LEXP->m_formalLevel=1; BEGIN(DEFFORM); }
<DEFFPAR>{crnl} { yy_pop_state(); unput('\n'); yyleng=0; return VP_DEFFORM; } /* DEFVAL will later grab the return */ <DEFFPAR>{crnl} { yy_pop_state(); unput('\n'); yyleng=0; return VP_DEFFORM; } /* DEFVAL will later grab the return */
<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 (declaration of a define) */ /* 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; <DEFFORM>[)] { appendDefValue(yytext, yyleng); yyleng=0;
if ((--LEXP->m_formalLevel)==0) { yy_pop_state(); return VP_DEFFORM; } } if ((--LEXP->m_formalLevel)==0) { yy_pop_state(); return VP_DEFFORM; } }
<DEFFORM>"/*" { yy_push_state(CMTMODE); yymore(); } <DEFFORM>"/*" { yy_push_state(CMTMODE); yymore(); }
<DEFFORM>"//"[^\n\r]* { return (VP_COMMENT);} <DEFFORM>"//"[^\n\r]* { return VP_COMMENT;}
<DEFFORM>{drop} { } <DEFFORM>{drop} { }
<DEFFORM><<EOF>> { linenoInc(); yy_pop_state(); yyerrorf("Unterminated ( in define formal arguments."); yyleng=0; return VP_DEFFORM; } <DEFFORM><<EOF>> { linenoInc(); yy_pop_state(); yyerrorf("Unterminated ( in define formal arguments."); yyleng=0; return VP_DEFFORM; }
<DEFFORM>{crnl} { linenoInc(); appendDefValue((char*)"\n",1); } /* Include return so can maintain output line count */ <DEFFORM>{crnl} { linenoInc(); appendDefValue((char*)"\n", 1); } /* Include return so can maintain output line count */
<DEFFORM>[\\]{wsn}+{crnl} { yyless(1); LEXP->curFilelinep()->v3warn(BSSPACE, "Backslash followed by whitespace, perhaps the whitespace is accidental?"); } <DEFFORM>[\\]{wsn}+{crnl} { yyless(1); LEXP->curFilelinep()->v3warn(BSSPACE, "Backslash followed by whitespace, perhaps the whitespace is accidental?"); }
<DEFFORM>[\\]{crnl} { linenoInc(); appendDefValue((char*)"\\\n",2); } /* Include return so can maintain output line count */ <DEFFORM>[\\]{crnl} { linenoInc(); appendDefValue((char*)"\\\n", 2); } /* Include return so can maintain output line count */
<DEFFORM>{quote} { LEXP->m_defQuote=true; yy_push_state(STRMODE); yymore(); } /* Legal only in default values */ <DEFFORM>{quote} { LEXP->m_defQuote=true; yy_push_state(STRMODE); yymore(); } /* Legal only in default values */
<DEFFORM>"`\\`\"" { appendDefValue(yytext,yyleng); } /* Maybe illegal, otherwise in default value */ <DEFFORM>"`\\`\"" { appendDefValue(yytext, yyleng); } /* Maybe illegal, otherwise in default value */
<DEFFORM>{tickquote} { appendDefValue(yytext,yyleng); } /* Maybe illegal, otherwise in default value */ <DEFFORM>{tickquote} { appendDefValue(yytext, yyleng); } /* Maybe illegal, otherwise in default value */
<DEFFORM>[{\[] { LEXP->m_formalLevel++; appendDefValue(yytext,yyleng); } <DEFFORM>[{\[] { LEXP->m_formalLevel++; appendDefValue(yytext, yyleng); }
<DEFFORM>[}\]] { LEXP->m_formalLevel--; appendDefValue(yytext,yyleng); } <DEFFORM>[}\]] { LEXP->m_formalLevel--; appendDefValue(yytext, yyleng); }
<DEFFORM>[^\/\*\n\r\\(){}\[\]\"]+ | <DEFFORM>[^\/\*\n\r\\(){}\[\]\"]+ |
<DEFFORM>[\\][^\n\r] | <DEFFORM>[\\][^\n\r] |
<DEFFORM>. { appendDefValue(yytext,yyleng); } <DEFFORM>. { appendDefValue(yytext, yyleng); }
/* Reading definition value (declaration of a define's text) */ /* 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;}
<DEFVAL>{drop} { } <DEFVAL>{drop} { }
<DEFVAL><<EOF>> { linenoInc(); yy_pop_state(); yytext=(char*)"\n"; yyleng=1; return (VP_DEFVALUE); } /* Technically illegal, but people complained */ <DEFVAL><<EOF>> { linenoInc(); yy_pop_state(); yytext=(char*)"\n"; yyleng=1; return VP_DEFVALUE; } /* Technically illegal, but people complained */
<DEFVAL>{crnl} { linenoInc(); yy_pop_state(); yytext=(char*)"\n"; yyleng=1; return (VP_DEFVALUE); } <DEFVAL>{crnl} { linenoInc(); yy_pop_state(); yytext=(char*)"\n"; yyleng=1; return VP_DEFVALUE; }
<DEFVAL>[\\]{wsn}+{crnl} { yyless(1); LEXP->curFilelinep()->v3warn(BSSPACE, "Backslash followed by whitespace, perhaps the whitespace is accidental?"); } <DEFVAL>[\\]{wsn}+{crnl} { yyless(1); LEXP->curFilelinep()->v3warn(BSSPACE, "Backslash followed by whitespace, perhaps the whitespace is accidental?"); }
<DEFVAL>[\\]{crnl} { linenoInc(); appendDefValue((char*)"\\\n",2); } /* Return, AND \ is part of define value */ <DEFVAL>[\\]{crnl} { linenoInc(); appendDefValue((char*)"\\\n", 2); } /* Return, AND \ is part of define value */
<DEFVAL>{quote} { LEXP->m_defQuote=true; yy_push_state(STRMODE); yymore(); } <DEFVAL>{quote} { LEXP->m_defQuote = true; yy_push_state(STRMODE); yymore(); }
<DEFVAL>[^\/\*\n\r\\\"]+ | <DEFVAL>[^\/\*\n\r\\\"]+ |
<DEFVAL>[\\][^\n\r] | <DEFVAL>[\\][^\n\r] |
<DEFVAL>. { appendDefValue(yytext,yyleng); } <DEFVAL>. { appendDefValue(yytext, yyleng); }
/* Comments inside define values - if embedded get added to define value per spec */ /* Comments inside define values - if embedded get added to define value per spec */
/* - if no \{crnl} ending then the comment belongs to the next line, as a non-embedded comment */ /* - if no \{crnl} ending then the comment belongs to the next line, as a non-embedded comment */
/* - if all but (say) 3rd line is missing \ then it's indeterminate */ /* - if all but (say) 3rd line is missing \ then it's indeterminate */
<DEFCMT>"*/" { yy_pop_state(); appendDefValue(yytext,yyleng); } <DEFCMT>"*/" { yy_pop_state(); appendDefValue(yytext, yyleng); }
<DEFCMT>[\\]{wsn}+{crnl} { yyless(1); LEXP->curFilelinep()->v3warn(BSSPACE, "Backslash followed by whitespace, perhaps the whitespace is accidental?"); } <DEFCMT>[\\]{wsn}+{crnl} { yyless(1); LEXP->curFilelinep()->v3warn(BSSPACE, "Backslash followed by whitespace, perhaps the whitespace is accidental?"); }
<DEFCMT>[\\]{crnl} { linenoInc(); LEXP->m_defCmtSlash=true; <DEFCMT>[\\]{crnl} { linenoInc(); LEXP->m_defCmtSlash=true;
appendDefValue(yytext,yyleng-2); appendDefValue((char*)"\n",1); } /* Return but not \ */ appendDefValue(yytext, yyleng-2); appendDefValue((char*)"\n", 1); } /* Return but not \ */
<DEFCMT>{crnl} { linenoInc(); yymore(); if (LEXP->m_defCmtSlash) yyerrorf("One line of /* ... */ is missing \\ before newline"); <DEFCMT>{crnl} { linenoInc(); yymore(); if (LEXP->m_defCmtSlash) yyerrorf("One line of /* ... */ is missing \\ before newline");
BEGIN(CMTMODE); } BEGIN(CMTMODE); }
<DEFCMT>{word} { yymore(); } <DEFCMT>{word} { yymore(); }
@ -207,52 +207,52 @@ bom [\357\273\277]
/* Define arguments (use of a define) */ /* Define arguments (use of a define) */
<ARGMODE>"/*" { yy_push_state(CMTMODE); yymore(); } <ARGMODE>"/*" { yy_push_state(CMTMODE); yymore(); }
<ARGMODE>"//"[^\n\r]* { return (VP_COMMENT);} <ARGMODE>"//"[^\n\r]* { return VP_COMMENT;}
<ARGMODE>{drop} { } <ARGMODE>{drop} { }
<ARGMODE><<EOF>> { yyerrorf("EOF in define argument list\n"); yyleng = 0; yyterminate(); } <ARGMODE><<EOF>> { yyerrorf("EOF in define argument list\n"); yyleng = 0; yyterminate(); }
<ARGMODE>{crnl} { linenoInc(); yytext=(char*)"\n"; yyleng=1; return(VP_WHITE); } <ARGMODE>{crnl} { linenoInc(); yytext=(char*)"\n"; yyleng=1; return VP_WHITE; }
<ARGMODE>{quote} { yy_push_state(STRMODE); yymore(); } <ARGMODE>{quote} { yy_push_state(STRMODE); yymore(); }
<ARGMODE>"`\\`\"" { appendDefValue(yytext,yyleng); } /* Literal text */ <ARGMODE>"`\\`\"" { appendDefValue(yytext, yyleng); } /* Literal text */
<ARGMODE>{tickquote} { yy_push_state(STRIFY); return(VP_STRIFY); } <ARGMODE>{tickquote} { yy_push_state(STRIFY); return VP_STRIFY; }
<ARGMODE>[{\[] { LEXP->m_parenLevel++; appendDefValue(yytext,yyleng); } <ARGMODE>[{\[] { LEXP->m_parenLevel++; appendDefValue(yytext, yyleng); }
<ARGMODE>[}\]] { LEXP->m_parenLevel--; appendDefValue(yytext,yyleng); } <ARGMODE>[}\]] { LEXP->m_parenLevel--; appendDefValue(yytext, yyleng); }
<ARGMODE>[(] { LEXP->m_parenLevel++; <ARGMODE>[(] { LEXP->m_parenLevel++;
// Note paren level 0 means before "(" of starting args // Note paren level 0 means before "(" of starting args
// Level 1 means "," between arguments // Level 1 means "," between arguments
// Level 2+ means one inside the () of an argument // Level 2+ means one inside the () of an argument
if (LEXP->m_parenLevel>1) { if (LEXP->m_parenLevel>1) {
appendDefValue(yytext,yyleng); appendDefValue(yytext, yyleng);
} else { } else {
return (VP_TEXT); return VP_TEXT;
}} }}
<ARGMODE>[)] { LEXP->m_parenLevel--; <ARGMODE>[)] { LEXP->m_parenLevel--;
if (LEXP->m_parenLevel>0) { if (LEXP->m_parenLevel>0) {
appendDefValue(yytext,yyleng); appendDefValue(yytext, yyleng);
} else { } else {
yy_pop_state(); return (VP_DEFARG); yy_pop_state(); return VP_DEFARG;
}} }}
<ARGMODE>[,] { if (LEXP->m_parenLevel>1) { <ARGMODE>[,] { if (LEXP->m_parenLevel>1) {
appendDefValue(yytext,yyleng); appendDefValue(yytext, yyleng);
} else { } else {
yy_pop_state(); return (VP_DEFARG); yy_pop_state(); return VP_DEFARG;
}} }}
<ARGMODE>"`"{symbdef} { appendDefValue(yytext,yyleng); } /* defref in defref - outer macro expands first */ <ARGMODE>"`"{symbdef} { appendDefValue(yytext, yyleng); } /* defref in defref - outer macro expands first */
<ARGMODE>"`"{symbdef}`` { appendDefValue(yytext,yyleng); } /* defref in defref - outer macro expands first */ <ARGMODE>"`"{symbdef}`` { appendDefValue(yytext, yyleng); } /* defref in defref - outer macro expands first */
<ARGMODE>`` { appendDefValue(yytext,yyleng); } /* defref in defref - outer macro expands first */ <ARGMODE>`` { appendDefValue(yytext, yyleng); } /* defref in defref - outer macro expands first */
<ARGMODE>[^\/\*\n\r\\(,){}\[\]\"`]+ | <ARGMODE>[^\/\*\n\r\\(,){}\[\]\"`]+ |
<ARGMODE>. { appendDefValue(yytext,yyleng); } <ARGMODE>. { appendDefValue(yytext, yyleng); }
/* One line comments. */ /* One line comments. */
<INITIAL>"//"{ws}*{crnl} { linenoInc(); yytext=(char*)"\n"; yyleng=1; return (VP_WHITE); } <INITIAL>"//"{ws}*{crnl} { linenoInc(); yytext=(char*)"\n"; yyleng=1; return VP_WHITE; }
<INITIAL>"//" { yy_push_state(CMTONEM); yymore(); } <INITIAL>"//" { yy_push_state(CMTONEM); yymore(); }
<CMTONEM>[^\n\r]* { yy_pop_state(); return (VP_COMMENT); } <CMTONEM>[^\n\r]* { yy_pop_state(); return VP_COMMENT; }
/* C-style comments. */ /* C-style comments. */
/**** See also DEFCMT */ /**** See also DEFCMT */
/* We distinguish between the start of a comment, and later, to look for prefix comments (deprecated) */ /* We distinguish between the start of a comment, and later, to look for prefix comments (deprecated) */
<INITIAL>"/*" { yy_push_state(CMTMODE); yymore(); } <INITIAL>"/*" { yy_push_state(CMTMODE); yymore(); }
<CMTBEGM>{ws}+ { yymore(); } <CMTBEGM>{ws}+ { yymore(); }
<CMTBEGM,CMTMODE>"*/" { yy_pop_state(); return(VP_COMMENT); } <CMTBEGM,CMTMODE>"*/" { yy_pop_state(); return VP_COMMENT; }
<CMTBEGM,CMTMODE>{crnl} { linenoInc(); yymore(); } <CMTBEGM,CMTMODE>{crnl} { linenoInc(); yymore(); }
<CMTBEGM,CMTMODE><<EOF>> { yyerrorf("EOF in '/* ... */' block comment\n"); yyleng=0; yyterminate(); } <CMTBEGM,CMTMODE><<EOF>> { yyerrorf("EOF in '/* ... */' block comment\n"); yyleng=0; yyterminate(); }
<CMTMODE>{word} { yymore(); } <CMTMODE>{word} { yymore(); }
@ -261,19 +261,19 @@ bom [\357\273\277]
/* Define calls */ /* Define calls */
/* symbdef prevents normal lex rules from making `\`"foo a symbol {`"foo} instead of a BACKQUOTE */ /* symbdef prevents normal lex rules from making `\`"foo a symbol {`"foo} instead of a BACKQUOTE */
<INITIAL>"`"{symbdef} { return (VP_DEFREF); } <INITIAL>"`"{symbdef} { return VP_DEFREF; }
<INITIAL>"`"{symbdef}`` { yyleng-=2; return (VP_DEFREF_JOIN); } <INITIAL>"`"{symbdef}`` { yyleng-=2; return VP_DEFREF_JOIN; }
/* Generics */ /* Generics */
<INITIAL>{crnl} { linenoInc(); yytext=(char*)"\n"; yyleng=1; return(VP_WHITE); } <INITIAL>{crnl} { linenoInc(); yytext=(char*)"\n"; yyleng=1; return VP_WHITE; }
<INITIAL><<EOF>> { yyterminate(); } /* A "normal" EOF */ <INITIAL><<EOF>> { yyterminate(); } /* A "normal" EOF */
<INITIAL>{symb} { return (VP_SYMBOL); } <INITIAL>{symb} { return VP_SYMBOL; }
<INITIAL>{symb}`` { yyleng-=2; return (VP_SYMBOL_JOIN); } <INITIAL>{symb}`` { yyleng-=2; return VP_SYMBOL_JOIN; }
<INITIAL>`` { yyleng-=2; return (VP_JOIN); } <INITIAL>`` { yyleng-=2; return VP_JOIN; }
<INITIAL>{wsn}+ { return (VP_WHITE); } <INITIAL>{wsn}+ { return VP_WHITE; }
<INITIAL>{drop} { } <INITIAL>{drop} { }
<INITIAL>[\r] { } <INITIAL>[\r] { }
<INITIAL>. { return (VP_TEXT); } <INITIAL>. { return VP_TEXT; }
%% %%
void V3PreLex::pushStateDefArg(int level) { void V3PreLex::pushStateDefArg(int level) {
@ -303,7 +303,7 @@ void V3PreLex::pushStateIncFilename() {
yymore(); yymore();
} }
void V3PreLex::debug(int level) { yy_flex_debug=level; } void V3PreLex::debug(int level) { yy_flex_debug = level; }
int V3PreLex::debug() { return yy_flex_debug; } int V3PreLex::debug() { return yy_flex_debug; }
int V3PreLex::lex() { int V3PreLex::lex() {
@ -320,7 +320,10 @@ size_t V3PreLex::inputToLex(char* buf, size_t max_size) {
// become a stale invalid pointer. // become a stale invalid pointer.
// //
VPreStream* streamp = curStreamp(); VPreStream* streamp = curStreamp();
if (debug()>=10) { cout<<"- pp:inputToLex ITL s="<<max_size<<" bs="<<streamp->m_buffers.size()<<endl; dumpStack(); } if (debug()>=10) {
cout<<"- pp:inputToLex ITL s="<<max_size<<" bs="<<streamp->m_buffers.size()<<endl;
dumpStack();
}
// For testing, use really small chunks // For testing, use really small chunks
//if (max_size > 13) max_size=13; //if (max_size > 13) max_size=13;
again: again:
@ -340,7 +343,7 @@ size_t V3PreLex::inputToLex(char* buf, size_t max_size) {
got += len; got += len;
} }
if (!got) { // end of stream; try "above" file if (!got) { // end of stream; try "above" file
bool again=false; bool again = false;
string forceOut = endOfStream(again/*ref*/); string forceOut = endOfStream(again/*ref*/);
streamp = curStreamp(); // May have been updated streamp = curStreamp(); // May have been updated
if (forceOut != "") { if (forceOut != "") {
@ -365,7 +368,9 @@ size_t V3PreLex::inputToLex(char* buf, size_t max_size) {
string V3PreLex::endOfStream(bool& againr) { string V3PreLex::endOfStream(bool& againr) {
// Switch to file or next unputString // Switch to file or next unputString
againr = false; againr = false;
if (yy_flex_debug) cout<<"-EOS state="<<curStreamp()->m_termState<<" at "<<curFilelinep()<<endl; if (yy_flex_debug) {
cout<<"-EOS state="<<curStreamp()->m_termState<<" at "<<curFilelinep()<<endl;
}
if (curStreamp()->m_eof) return ""; // Don't delete the final "EOF" stream if (curStreamp()->m_eof) return ""; // Don't delete the final "EOF" stream
bool exited_file = curStreamp()->m_file; bool exited_file = curStreamp()->m_file;
if (!exited_file) { if (!exited_file) {

View File

@ -37,13 +37,13 @@ extern void yyerrorf(const char* format, ...);
#define SYMP PARSEP->symp() #define SYMP PARSEP->symp()
#define YY_INPUT(buf,result,max_size) \ #define YY_INPUT(buf,result,max_size) \
result = PARSEP->flexPpInputToLex(buf,max_size); result = PARSEP->flexPpInputToLex(buf, max_size);
//====================================================================== //======================================================================
#define NEXTLINE() {PARSEP->linenoInc();} #define NEXTLINE() {PARSEP->linenoInc();}
#define LINECHECKS(textp,len) { const char* cp=textp; for (int n=len; n; --n) if (cp[n]=='\n') NEXTLINE(); } #define LINECHECKS(textp,len) { const char* cp=textp; for (int n=len; n; --n) if (cp[n]=='\n') NEXTLINE(); }
#define LINECHECK() LINECHECKS(yytext,yyleng) #define LINECHECK() LINECHECKS(yytext, yyleng)
#define CRELINE() (PARSEP->copyOrSameFileLine()) #define CRELINE() (PARSEP->copyOrSameFileLine())
#define FL { yylval.fl = CRELINE(); } #define FL { yylval.fl = CRELINE(); }
@ -79,8 +79,8 @@ void yyerrorf(const char* format, ...) {
char msg[maxlen]; char msg[maxlen];
va_list ap; va_list ap;
va_start(ap,format); va_start(ap, format);
VL_VSNPRINTF(msg,maxlen,format,ap); VL_VSNPRINTF(msg, maxlen, format, ap);
msg[maxlen-1] = '\0'; msg[maxlen-1] = '\0';
va_end(ap); va_end(ap);
@ -318,18 +318,18 @@ vnum {vnum1}|{vnum2}|{vnum3}|{vnum4}|{vnum5}
"xnor" { FL; return yXNOR; } "xnor" { FL; return yXNOR; }
"xor" { FL; return yXOR; } "xor" { FL; return yXOR; }
/* Special errors */ /* Special errors */
"$displayb" { FL; RETURN_BBOX_SYS_OR_MSG("Unsupported: Use $display with %%b format instead: %s",yytext); } "$displayb" { FL; RETURN_BBOX_SYS_OR_MSG("Unsupported: Use $display with %%b format instead: %s", yytext); }
"$displayh" { FL; RETURN_BBOX_SYS_OR_MSG("Unsupported: Use $display with %%x format instead: %s",yytext); } "$displayh" { FL; RETURN_BBOX_SYS_OR_MSG("Unsupported: Use $display with %%x format instead: %s", yytext); }
"$displayo" { FL; RETURN_BBOX_SYS_OR_MSG("Unsupported: Use $display with %%o format instead: %s",yytext); } "$displayo" { FL; RETURN_BBOX_SYS_OR_MSG("Unsupported: Use $display with %%o format instead: %s", yytext); }
"$fdisplayb" { FL; RETURN_BBOX_SYS_OR_MSG("Unsupported: Use $fdisplay with %%b format instead: %s",yytext); } "$fdisplayb" { FL; RETURN_BBOX_SYS_OR_MSG("Unsupported: Use $fdisplay with %%b format instead: %s", yytext); }
"$fdisplayh" { FL; RETURN_BBOX_SYS_OR_MSG("Unsupported: Use $fdisplay with %%x format instead: %s",yytext); } "$fdisplayh" { FL; RETURN_BBOX_SYS_OR_MSG("Unsupported: Use $fdisplay with %%x format instead: %s", yytext); }
"$fdisplayo" { FL; RETURN_BBOX_SYS_OR_MSG("Unsupported: Use $fdisplay with %%o format instead: %s",yytext); } "$fdisplayo" { FL; RETURN_BBOX_SYS_OR_MSG("Unsupported: Use $fdisplay with %%o format instead: %s", yytext); }
"$fwriteb" { FL; RETURN_BBOX_SYS_OR_MSG("Unsupported: Use $fwrite with %%b format instead: %s",yytext); } "$fwriteb" { FL; RETURN_BBOX_SYS_OR_MSG("Unsupported: Use $fwrite with %%b format instead: %s", yytext); }
"$fwriteh" { FL; RETURN_BBOX_SYS_OR_MSG("Unsupported: Use $fwrite with %%x format instead: %s",yytext); } "$fwriteh" { FL; RETURN_BBOX_SYS_OR_MSG("Unsupported: Use $fwrite with %%x format instead: %s", yytext); }
"$fwriteo" { FL; RETURN_BBOX_SYS_OR_MSG("Unsupported: Use $fwrite with %%o format instead: %s",yytext); } "$fwriteo" { FL; RETURN_BBOX_SYS_OR_MSG("Unsupported: Use $fwrite with %%o format instead: %s", yytext); }
"$writeb" { FL; RETURN_BBOX_SYS_OR_MSG("Unsupported: Use $write with %%b format instead: %s",yytext); } "$writeb" { FL; RETURN_BBOX_SYS_OR_MSG("Unsupported: Use $write with %%b format instead: %s", yytext); }
"$writeh" { FL; RETURN_BBOX_SYS_OR_MSG("Unsupported: Use $write with %%x format instead: %s",yytext); } "$writeh" { FL; RETURN_BBOX_SYS_OR_MSG("Unsupported: Use $write with %%x format instead: %s", yytext); }
"$writeo" { FL; RETURN_BBOX_SYS_OR_MSG("Unsupported: Use $write with %%o format instead: %s",yytext); } "$writeo" { FL; RETURN_BBOX_SYS_OR_MSG("Unsupported: Use $write with %%o format instead: %s", yytext); }
} }
/* Verilog 2001 */ /* Verilog 2001 */
@ -351,16 +351,16 @@ vnum {vnum1}|{vnum2}|{vnum3}|{vnum4}|{vnum5}
"signed" { FL; return ySIGNED; } "signed" { FL; return ySIGNED; }
"unsigned" { FL; return yUNSIGNED; } "unsigned" { FL; return yUNSIGNED; }
/* Generic unsupported keywords */ /* Generic unsupported keywords */
"cell" { yyerrorf("Unsupported: Verilog 2001-config reserved word not implemented: %s",yytext); } "cell" { yyerrorf("Unsupported: Verilog 2001-config reserved word not implemented: %s", yytext); }
"config" { yyerrorf("Unsupported: Verilog 2001-config reserved word not implemented: %s",yytext); } "config" { yyerrorf("Unsupported: Verilog 2001-config reserved word not implemented: %s", yytext); }
"design" { yyerrorf("Unsupported: Verilog 2001-config reserved word not implemented: %s",yytext); } "design" { yyerrorf("Unsupported: Verilog 2001-config reserved word not implemented: %s", yytext); }
"endconfig" { yyerrorf("Unsupported: Verilog 2001-config reserved word not implemented: %s",yytext); } "endconfig" { yyerrorf("Unsupported: Verilog 2001-config reserved word not implemented: %s", yytext); }
"incdir" { yyerrorf("Unsupported: Verilog 2001-config reserved word not implemented: %s",yytext); } "incdir" { yyerrorf("Unsupported: Verilog 2001-config reserved word not implemented: %s", yytext); }
"include" { yyerrorf("Unsupported: Verilog 2001-config reserved word not implemented; probably you want `include instead: %s",yytext); } "include" { yyerrorf("Unsupported: Verilog 2001-config reserved word not implemented; probably you want `include instead: %s", yytext); }
"instance" { yyerrorf("Unsupported: Verilog 2001-config reserved word not implemented: %s",yytext); } "instance" { yyerrorf("Unsupported: Verilog 2001-config reserved word not implemented: %s", yytext); }
"liblist" { yyerrorf("Unsupported: Verilog 2001-config reserved word not implemented: %s",yytext); } "liblist" { yyerrorf("Unsupported: Verilog 2001-config reserved word not implemented: %s", yytext); }
"library" { yyerrorf("Unsupported: Verilog 2001-config reserved word not implemented: %s",yytext); } "library" { yyerrorf("Unsupported: Verilog 2001-config reserved word not implemented: %s", yytext); }
"use" { yyerrorf("Unsupported: Verilog 2001-config reserved word not implemented: %s",yytext); } "use" { yyerrorf("Unsupported: Verilog 2001-config reserved word not implemented: %s", yytext); }
} }
/* Verilog 2005 */ /* Verilog 2005 */
@ -457,44 +457,44 @@ vnum {vnum1}|{vnum2}|{vnum3}|{vnum4}|{vnum5}
"void" { FL; return yVOID; } "void" { FL; return yVOID; }
/* Generic unsupported warnings */ /* Generic unsupported warnings */
/* Note assert_strobe was in SystemVerilog 3.1, but removed for SystemVerilog 2005 */ /* Note assert_strobe was in SystemVerilog 3.1, but removed for SystemVerilog 2005 */
"$root" { yyerrorf("Unsupported: SystemVerilog 2005 reserved word not implemented: %s",yytext); } "$root" { yyerrorf("Unsupported: SystemVerilog 2005 reserved word not implemented: %s", yytext); }
"before" { yyerrorf("Unsupported: SystemVerilog 2005 reserved word not implemented: %s",yytext); } "before" { yyerrorf("Unsupported: SystemVerilog 2005 reserved word not implemented: %s", yytext); }
"bins" { yyerrorf("Unsupported: SystemVerilog 2005 reserved word not implemented: %s",yytext); } "bins" { yyerrorf("Unsupported: SystemVerilog 2005 reserved word not implemented: %s", yytext); }
"binsof" { yyerrorf("Unsupported: SystemVerilog 2005 reserved word not implemented: %s",yytext); } "binsof" { yyerrorf("Unsupported: SystemVerilog 2005 reserved word not implemented: %s", yytext); }
"class" { yyerrorf("Unsupported: SystemVerilog 2005 reserved word not implemented: %s",yytext); } "class" { yyerrorf("Unsupported: SystemVerilog 2005 reserved word not implemented: %s", yytext); }
"constraint" { yyerrorf("Unsupported: SystemVerilog 2005 reserved word not implemented: %s",yytext); } "constraint" { yyerrorf("Unsupported: SystemVerilog 2005 reserved word not implemented: %s", yytext); }
"covergroup" { yyerrorf("Unsupported: SystemVerilog 2005 reserved word not implemented: %s",yytext); } "covergroup" { yyerrorf("Unsupported: SystemVerilog 2005 reserved word not implemented: %s", yytext); }
"coverpoint" { yyerrorf("Unsupported: SystemVerilog 2005 reserved word not implemented: %s",yytext); } "coverpoint" { yyerrorf("Unsupported: SystemVerilog 2005 reserved word not implemented: %s", yytext); }
"cross" { yyerrorf("Unsupported: SystemVerilog 2005 reserved word not implemented: %s",yytext); } "cross" { yyerrorf("Unsupported: SystemVerilog 2005 reserved word not implemented: %s", yytext); }
"dist" { yyerrorf("Unsupported: SystemVerilog 2005 reserved word not implemented: %s",yytext); } "dist" { yyerrorf("Unsupported: SystemVerilog 2005 reserved word not implemented: %s", yytext); }
"endclass" { yyerrorf("Unsupported: SystemVerilog 2005 reserved word not implemented: %s",yytext); } "endclass" { yyerrorf("Unsupported: SystemVerilog 2005 reserved word not implemented: %s", yytext); }
"endgroup" { yyerrorf("Unsupported: SystemVerilog 2005 reserved word not implemented: %s",yytext); } "endgroup" { yyerrorf("Unsupported: SystemVerilog 2005 reserved word not implemented: %s", yytext); }
"endsequence" { yyerrorf("Unsupported: SystemVerilog 2005 reserved word not implemented: %s",yytext); } "endsequence" { yyerrorf("Unsupported: SystemVerilog 2005 reserved word not implemented: %s", yytext); }
"expect" { yyerrorf("Unsupported: SystemVerilog 2005 reserved word not implemented: %s",yytext); } "expect" { yyerrorf("Unsupported: SystemVerilog 2005 reserved word not implemented: %s", yytext); }
"extends" { yyerrorf("Unsupported: SystemVerilog 2005 reserved word not implemented: %s",yytext); } "extends" { yyerrorf("Unsupported: SystemVerilog 2005 reserved word not implemented: %s", yytext); }
"first_match" { yyerrorf("Unsupported: SystemVerilog 2005 reserved word not implemented: %s",yytext); } "first_match" { yyerrorf("Unsupported: SystemVerilog 2005 reserved word not implemented: %s", yytext); }
"ignore_bins" { yyerrorf("Unsupported: SystemVerilog 2005 reserved word not implemented: %s",yytext); } "ignore_bins" { yyerrorf("Unsupported: SystemVerilog 2005 reserved word not implemented: %s", yytext); }
"illegal_bins" { yyerrorf("Unsupported: SystemVerilog 2005 reserved word not implemented: %s",yytext); } "illegal_bins" { yyerrorf("Unsupported: SystemVerilog 2005 reserved word not implemented: %s", yytext); }
"intersect" { yyerrorf("Unsupported: SystemVerilog 2005 reserved word not implemented: %s",yytext); } "intersect" { yyerrorf("Unsupported: SystemVerilog 2005 reserved word not implemented: %s", yytext); }
"join_any" { yyerrorf("Unsupported: SystemVerilog 2005 reserved word not implemented: %s",yytext); } "join_any" { yyerrorf("Unsupported: SystemVerilog 2005 reserved word not implemented: %s", yytext); }
"join_none" { yyerrorf("Unsupported: SystemVerilog 2005 reserved word not implemented: %s",yytext); } "join_none" { yyerrorf("Unsupported: SystemVerilog 2005 reserved word not implemented: %s", yytext); }
"local" { yyerrorf("Unsupported: SystemVerilog 2005 reserved word not implemented: %s",yytext); } "local" { yyerrorf("Unsupported: SystemVerilog 2005 reserved word not implemented: %s", yytext); }
"matches" { yyerrorf("Unsupported: SystemVerilog 2005 reserved word not implemented: %s",yytext); } "matches" { yyerrorf("Unsupported: SystemVerilog 2005 reserved word not implemented: %s", yytext); }
"new" { yyerrorf("Unsupported: SystemVerilog 2005 reserved word not implemented: %s",yytext); } "new" { yyerrorf("Unsupported: SystemVerilog 2005 reserved word not implemented: %s", yytext); }
"protected" { yyerrorf("Unsupported: SystemVerilog 2005 reserved word not implemented: %s",yytext); } "protected" { yyerrorf("Unsupported: SystemVerilog 2005 reserved word not implemented: %s", yytext); }
"randomize" { yyerrorf("Unsupported: SystemVerilog 2005 reserved word not implemented: %s",yytext); } "randomize" { yyerrorf("Unsupported: SystemVerilog 2005 reserved word not implemented: %s", yytext); }
"randsequence" { yyerrorf("Unsupported: SystemVerilog 2005 reserved word not implemented: %s",yytext); } "randsequence" { yyerrorf("Unsupported: SystemVerilog 2005 reserved word not implemented: %s", yytext); }
"sequence" { yyerrorf("Unsupported: SystemVerilog 2005 reserved word not implemented: %s",yytext); } "sequence" { yyerrorf("Unsupported: SystemVerilog 2005 reserved word not implemented: %s", yytext); }
"solve" { yyerrorf("Unsupported: SystemVerilog 2005 reserved word not implemented: %s",yytext); } "solve" { yyerrorf("Unsupported: SystemVerilog 2005 reserved word not implemented: %s", yytext); }
"super" { yyerrorf("Unsupported: SystemVerilog 2005 reserved word not implemented: %s",yytext); } "super" { yyerrorf("Unsupported: SystemVerilog 2005 reserved word not implemented: %s", yytext); }
"tagged" { yyerrorf("Unsupported: SystemVerilog 2005 reserved word not implemented: %s",yytext); } "tagged" { yyerrorf("Unsupported: SystemVerilog 2005 reserved word not implemented: %s", yytext); }
"this" { yyerrorf("Unsupported: SystemVerilog 2005 reserved word not implemented: %s",yytext); } "this" { yyerrorf("Unsupported: SystemVerilog 2005 reserved word not implemented: %s", yytext); }
"throughout" { yyerrorf("Unsupported: SystemVerilog 2005 reserved word not implemented: %s",yytext); } "throughout" { yyerrorf("Unsupported: SystemVerilog 2005 reserved word not implemented: %s", yytext); }
"virtual" { yyerrorf("Unsupported: SystemVerilog 2005 reserved word not implemented: %s",yytext); } "virtual" { yyerrorf("Unsupported: SystemVerilog 2005 reserved word not implemented: %s", yytext); }
"wait_order" { yyerrorf("Unsupported: SystemVerilog 2005 reserved word not implemented: %s",yytext); } "wait_order" { yyerrorf("Unsupported: SystemVerilog 2005 reserved word not implemented: %s", yytext); }
"wildcard" { yyerrorf("Unsupported: SystemVerilog 2005 reserved word not implemented: %s",yytext); } "wildcard" { yyerrorf("Unsupported: SystemVerilog 2005 reserved word not implemented: %s", yytext); }
"with" { yyerrorf("Unsupported: SystemVerilog 2005 reserved word not implemented: %s",yytext); } "with" { yyerrorf("Unsupported: SystemVerilog 2005 reserved word not implemented: %s", yytext); }
"within" { yyerrorf("Unsupported: SystemVerilog 2005 reserved word not implemented: %s",yytext); } "within" { yyerrorf("Unsupported: SystemVerilog 2005 reserved word not implemented: %s", yytext); }
} }
/* SystemVerilog 2009 */ /* SystemVerilog 2009 */
@ -503,35 +503,35 @@ vnum {vnum1}|{vnum2}|{vnum3}|{vnum4}|{vnum5}
"global" { FL; return yGLOBAL__LEX; } "global" { FL; return yGLOBAL__LEX; }
"unique0" { FL; return yUNIQUE0; } "unique0" { FL; return yUNIQUE0; }
/* Generic unsupported warnings */ /* Generic unsupported warnings */
"accept_on" { yyerrorf("Unsupported: SystemVerilog 2009 reserved word not implemented: %s",yytext); } "accept_on" { yyerrorf("Unsupported: SystemVerilog 2009 reserved word not implemented: %s", yytext); }
"checker" { yyerrorf("Unsupported: SystemVerilog 2009 reserved word not implemented: %s",yytext); } "checker" { yyerrorf("Unsupported: SystemVerilog 2009 reserved word not implemented: %s", yytext); }
"endchecker" { yyerrorf("Unsupported: SystemVerilog 2009 reserved word not implemented: %s",yytext); } "endchecker" { yyerrorf("Unsupported: SystemVerilog 2009 reserved word not implemented: %s", yytext); }
"eventually" { yyerrorf("Unsupported: SystemVerilog 2009 reserved word not implemented: %s",yytext); } "eventually" { yyerrorf("Unsupported: SystemVerilog 2009 reserved word not implemented: %s", yytext); }
"implies" { yyerrorf("Unsupported: SystemVerilog 2009 reserved word not implemented: %s",yytext); } "implies" { yyerrorf("Unsupported: SystemVerilog 2009 reserved word not implemented: %s", yytext); }
"let" { yyerrorf("Unsupported: SystemVerilog 2009 reserved word not implemented: %s",yytext); } "let" { yyerrorf("Unsupported: SystemVerilog 2009 reserved word not implemented: %s", yytext); }
"nexttime" { yyerrorf("Unsupported: SystemVerilog 2009 reserved word not implemented: %s",yytext); } "nexttime" { yyerrorf("Unsupported: SystemVerilog 2009 reserved word not implemented: %s", yytext); }
"reject_on" { yyerrorf("Unsupported: SystemVerilog 2009 reserved word not implemented: %s",yytext); } "reject_on" { yyerrorf("Unsupported: SystemVerilog 2009 reserved word not implemented: %s", yytext); }
"s_always" { yyerrorf("Unsupported: SystemVerilog 2009 reserved word not implemented: %s",yytext); } "s_always" { yyerrorf("Unsupported: SystemVerilog 2009 reserved word not implemented: %s", yytext); }
"s_eventually" { yyerrorf("Unsupported: SystemVerilog 2009 reserved word not implemented: %s",yytext); } "s_eventually" { yyerrorf("Unsupported: SystemVerilog 2009 reserved word not implemented: %s", yytext); }
"s_nexttime" { yyerrorf("Unsupported: SystemVerilog 2009 reserved word not implemented: %s",yytext); } "s_nexttime" { yyerrorf("Unsupported: SystemVerilog 2009 reserved word not implemented: %s", yytext); }
"s_until" { yyerrorf("Unsupported: SystemVerilog 2009 reserved word not implemented: %s",yytext); } "s_until" { yyerrorf("Unsupported: SystemVerilog 2009 reserved word not implemented: %s", yytext); }
"s_until_with" { yyerrorf("Unsupported: SystemVerilog 2009 reserved word not implemented: %s",yytext); } "s_until_with" { yyerrorf("Unsupported: SystemVerilog 2009 reserved word not implemented: %s", yytext); }
"strong" { yyerrorf("Unsupported: SystemVerilog 2009 reserved word not implemented: %s",yytext); } "strong" { yyerrorf("Unsupported: SystemVerilog 2009 reserved word not implemented: %s", yytext); }
"sync_accept_on" { yyerrorf("Unsupported: SystemVerilog 2009 reserved word not implemented: %s",yytext); } "sync_accept_on" { yyerrorf("Unsupported: SystemVerilog 2009 reserved word not implemented: %s", yytext); }
"sync_reject_on" { yyerrorf("Unsupported: SystemVerilog 2009 reserved word not implemented: %s",yytext); } "sync_reject_on" { yyerrorf("Unsupported: SystemVerilog 2009 reserved word not implemented: %s", yytext); }
"until" { yyerrorf("Unsupported: SystemVerilog 2009 reserved word not implemented: %s",yytext); } "until" { yyerrorf("Unsupported: SystemVerilog 2009 reserved word not implemented: %s", yytext); }
"until_with" { yyerrorf("Unsupported: SystemVerilog 2009 reserved word not implemented: %s",yytext); } "until_with" { yyerrorf("Unsupported: SystemVerilog 2009 reserved word not implemented: %s", yytext); }
"untyped" { yyerrorf("Unsupported: SystemVerilog 2009 reserved word not implemented: %s",yytext); } "untyped" { yyerrorf("Unsupported: SystemVerilog 2009 reserved word not implemented: %s", yytext); }
"weak" { yyerrorf("Unsupported: SystemVerilog 2009 reserved word not implemented: %s",yytext); } "weak" { yyerrorf("Unsupported: SystemVerilog 2009 reserved word not implemented: %s", yytext); }
} }
/* System Verilog 2012 */ /* System Verilog 2012 */
<S12,S17,SAX>{ <S12,S17,SAX>{
/* Keywords */ /* Keywords */
"implements" { yyerrorf("Unsupported: SystemVerilog 2012 reserved word not implemented: %s",yytext); } "implements" { yyerrorf("Unsupported: SystemVerilog 2012 reserved word not implemented: %s", yytext); }
"interconnect" { yyerrorf("Unsupported: SystemVerilog 2012 reserved word not implemented: %s",yytext); } "interconnect" { yyerrorf("Unsupported: SystemVerilog 2012 reserved word not implemented: %s", yytext); }
"nettype" { yyerrorf("Unsupported: SystemVerilog 2012 reserved word not implemented: %s",yytext); } "nettype" { yyerrorf("Unsupported: SystemVerilog 2012 reserved word not implemented: %s", yytext); }
"soft" { yyerrorf("Unsupported: SystemVerilog 2012 reserved word not implemented: %s",yytext); } "soft" { yyerrorf("Unsupported: SystemVerilog 2012 reserved word not implemented: %s", yytext); }
} }
/* System Verilog 2017 */ /* System Verilog 2017 */
@ -539,12 +539,12 @@ vnum {vnum1}|{vnum2}|{vnum3}|{vnum4}|{vnum5}
/* Default PLI rule */ /* Default PLI rule */
<V95,V01,V05,VA5,S05,S09,S12,S17,SAX>{ <V95,V01,V05,VA5,S05,S09,S12,S17,SAX>{
"$"[a-zA-Z_$][a-zA-Z0-9_$]* { string str (yytext,yyleng); "$"[a-zA-Z_$][a-zA-Z0-9_$]* { string str (yytext, yyleng);
yylval.strp = PARSEP->newString(AstNode::encodeName(str)); yylval.strp = PARSEP->newString(AstNode::encodeName(str));
// Lookup unencoded name including the $, to avoid hitting normal signals // Lookup unencoded name including the $, to avoid hitting normal signals
if (SYMP->symCurrentp()->findIdFallback(str)) { if (SYMP->symCurrentp()->findIdFallback(str)) {
FL; return yaD_DPI; FL; return yaD_DPI;
} else { FL; RETURN_BBOX_SYS_OR_MSG("Unsupported or unknown PLI call: %s",yytext); } } else { FL; RETURN_BBOX_SYS_OR_MSG("Unsupported or unknown PLI call: %s", yytext); }
} }
} }
@ -553,92 +553,92 @@ vnum {vnum1}|{vnum2}|{vnum3}|{vnum4}|{vnum5}
<VA5,SAX>{ <VA5,SAX>{
/* Generic unsupported warnings */ /* Generic unsupported warnings */
"above" { yyerrorf("Unsupported: AMS reserved word not implemented: %s",yytext); } "above" { yyerrorf("Unsupported: AMS reserved word not implemented: %s", yytext); }
"abs" { yyerrorf("Unsupported: AMS reserved word not implemented: %s",yytext); } "abs" { yyerrorf("Unsupported: AMS reserved word not implemented: %s", yytext); }
"absdelay" { yyerrorf("Unsupported: AMS reserved word not implemented: %s",yytext); } "absdelay" { yyerrorf("Unsupported: AMS reserved word not implemented: %s", yytext); }
"abstol" { yyerrorf("Unsupported: AMS reserved word not implemented: %s",yytext); } "abstol" { yyerrorf("Unsupported: AMS reserved word not implemented: %s", yytext); }
"ac_stim" { yyerrorf("Unsupported: AMS reserved word not implemented: %s",yytext); } "ac_stim" { yyerrorf("Unsupported: AMS reserved word not implemented: %s", yytext); }
"access" { yyerrorf("Unsupported: AMS reserved word not implemented: %s",yytext); } "access" { yyerrorf("Unsupported: AMS reserved word not implemented: %s", yytext); }
"acos" { yyerrorf("Unsupported: AMS reserved word not implemented: %s",yytext); } "acos" { yyerrorf("Unsupported: AMS reserved word not implemented: %s", yytext); }
"acosh" { yyerrorf("Unsupported: AMS reserved word not implemented: %s",yytext); } "acosh" { yyerrorf("Unsupported: AMS reserved word not implemented: %s", yytext); }
"aliasparam" { yyerrorf("Unsupported: AMS reserved word not implemented: %s",yytext); } "aliasparam" { yyerrorf("Unsupported: AMS reserved word not implemented: %s", yytext); }
"analog" { yyerrorf("Unsupported: AMS reserved word not implemented: %s",yytext); } "analog" { yyerrorf("Unsupported: AMS reserved word not implemented: %s", yytext); }
"analysis" { yyerrorf("Unsupported: AMS reserved word not implemented: %s",yytext); } "analysis" { yyerrorf("Unsupported: AMS reserved word not implemented: %s", yytext); }
"asin" { FL; return yD_ASIN; } "asin" { FL; return yD_ASIN; }
"asinh" { FL; return yD_ASINH; } "asinh" { FL; return yD_ASINH; }
"assert" { yyerrorf("Unsupported: AMS reserved word not implemented: %s",yytext); } "assert" { yyerrorf("Unsupported: AMS reserved word not implemented: %s", yytext); }
"atan" { FL; return yD_ATAN; } "atan" { FL; return yD_ATAN; }
"atan2" { FL; return yD_ATAN2; } "atan2" { FL; return yD_ATAN2; }
"atanh" { FL; return yD_ATANH; } "atanh" { FL; return yD_ATANH; }
"branch" { yyerrorf("Unsupported: AMS reserved word not implemented: %s",yytext); } "branch" { yyerrorf("Unsupported: AMS reserved word not implemented: %s", yytext); }
"ceil" { FL; return yD_CEIL; } "ceil" { FL; return yD_CEIL; }
"connect" { yyerrorf("Unsupported: AMS reserved word not implemented: %s",yytext); } "connect" { yyerrorf("Unsupported: AMS reserved word not implemented: %s", yytext); }
"connectmodule" { yyerrorf("Unsupported: AMS reserved word not implemented: %s",yytext); } "connectmodule" { yyerrorf("Unsupported: AMS reserved word not implemented: %s", yytext); }
"connectrules" { yyerrorf("Unsupported: AMS reserved word not implemented: %s",yytext); } "connectrules" { yyerrorf("Unsupported: AMS reserved word not implemented: %s", yytext); }
"continuous" { yyerrorf("Unsupported: AMS reserved word not implemented: %s",yytext); } "continuous" { yyerrorf("Unsupported: AMS reserved word not implemented: %s", yytext); }
"cos" { FL; return yD_COS; } "cos" { FL; return yD_COS; }
"cosh" { FL; return yD_COSH; } "cosh" { FL; return yD_COSH; }
"cross" { yyerrorf("Unsupported: AMS reserved word not implemented: %s",yytext); } "cross" { yyerrorf("Unsupported: AMS reserved word not implemented: %s", yytext); }
"ddt" { yyerrorf("Unsupported: AMS reserved word not implemented: %s",yytext); } "ddt" { yyerrorf("Unsupported: AMS reserved word not implemented: %s", yytext); }
"ddt_nature" { yyerrorf("Unsupported: AMS reserved word not implemented: %s",yytext); } "ddt_nature" { yyerrorf("Unsupported: AMS reserved word not implemented: %s", yytext); }
"ddx" { yyerrorf("Unsupported: AMS reserved word not implemented: %s",yytext); } "ddx" { yyerrorf("Unsupported: AMS reserved word not implemented: %s", yytext); }
"discipline" { yyerrorf("Unsupported: AMS reserved word not implemented: %s",yytext); } "discipline" { yyerrorf("Unsupported: AMS reserved word not implemented: %s", yytext); }
"discrete" { yyerrorf("Unsupported: AMS reserved word not implemented: %s",yytext); } "discrete" { yyerrorf("Unsupported: AMS reserved word not implemented: %s", yytext); }
"domain" { yyerrorf("Unsupported: AMS reserved word not implemented: %s",yytext); } "domain" { yyerrorf("Unsupported: AMS reserved word not implemented: %s", yytext); }
"driver_update" { yyerrorf("Unsupported: AMS reserved word not implemented: %s",yytext); } "driver_update" { yyerrorf("Unsupported: AMS reserved word not implemented: %s", yytext); }
"endconnectrules" { yyerrorf("Unsupported: AMS reserved word not implemented: %s",yytext); } "endconnectrules" { yyerrorf("Unsupported: AMS reserved word not implemented: %s", yytext); }
"enddiscipline" { yyerrorf("Unsupported: AMS reserved word not implemented: %s",yytext); } "enddiscipline" { yyerrorf("Unsupported: AMS reserved word not implemented: %s", yytext); }
"endnature" { yyerrorf("Unsupported: AMS reserved word not implemented: %s",yytext); } "endnature" { yyerrorf("Unsupported: AMS reserved word not implemented: %s", yytext); }
"endparamset" { yyerrorf("Unsupported: AMS reserved word not implemented: %s",yytext); } "endparamset" { yyerrorf("Unsupported: AMS reserved word not implemented: %s", yytext); }
"exclude" { yyerrorf("Unsupported: AMS reserved word not implemented: %s",yytext); } "exclude" { yyerrorf("Unsupported: AMS reserved word not implemented: %s", yytext); }
"exp" { FL; return yD_EXP; } "exp" { FL; return yD_EXP; }
"final_step" { yyerrorf("Unsupported: AMS reserved word not implemented: %s",yytext); } "final_step" { yyerrorf("Unsupported: AMS reserved word not implemented: %s", yytext); }
"flicker_noise" { yyerrorf("Unsupported: AMS reserved word not implemented: %s",yytext); } "flicker_noise" { yyerrorf("Unsupported: AMS reserved word not implemented: %s", yytext); }
"floor" { FL; return yD_FLOOR; } "floor" { FL; return yD_FLOOR; }
"flow" { yyerrorf("Unsupported: AMS reserved word not implemented: %s",yytext); } "flow" { yyerrorf("Unsupported: AMS reserved word not implemented: %s", yytext); }
"from" { yyerrorf("Unsupported: AMS reserved word not implemented: %s",yytext); } "from" { yyerrorf("Unsupported: AMS reserved word not implemented: %s", yytext); }
"ground" { yyerrorf("Unsupported: AMS reserved word not implemented: %s",yytext); } "ground" { yyerrorf("Unsupported: AMS reserved word not implemented: %s", yytext); }
"hypot" { FL; return yD_HYPOT; } "hypot" { FL; return yD_HYPOT; }
"idt" { yyerrorf("Unsupported: AMS reserved word not implemented: %s",yytext); } "idt" { yyerrorf("Unsupported: AMS reserved word not implemented: %s", yytext); }
"idt_nature" { yyerrorf("Unsupported: AMS reserved word not implemented: %s",yytext); } "idt_nature" { yyerrorf("Unsupported: AMS reserved word not implemented: %s", yytext); }
"idtmod" { yyerrorf("Unsupported: AMS reserved word not implemented: %s",yytext); } "idtmod" { yyerrorf("Unsupported: AMS reserved word not implemented: %s", yytext); }
"inf" { yyerrorf("Unsupported: AMS reserved word not implemented: %s",yytext); } "inf" { yyerrorf("Unsupported: AMS reserved word not implemented: %s", yytext); }
"initial_step" { yyerrorf("Unsupported: AMS reserved word not implemented: %s",yytext); } "initial_step" { yyerrorf("Unsupported: AMS reserved word not implemented: %s", yytext); }
"laplace_nd" { yyerrorf("Unsupported: AMS reserved word not implemented: %s",yytext); } "laplace_nd" { yyerrorf("Unsupported: AMS reserved word not implemented: %s", yytext); }
"laplace_np" { yyerrorf("Unsupported: AMS reserved word not implemented: %s",yytext); } "laplace_np" { yyerrorf("Unsupported: AMS reserved word not implemented: %s", yytext); }
"laplace_zd" { yyerrorf("Unsupported: AMS reserved word not implemented: %s",yytext); } "laplace_zd" { yyerrorf("Unsupported: AMS reserved word not implemented: %s", yytext); }
"laplace_zp" { yyerrorf("Unsupported: AMS reserved word not implemented: %s",yytext); } "laplace_zp" { yyerrorf("Unsupported: AMS reserved word not implemented: %s", yytext); }
"last_crossing" { yyerrorf("Unsupported: AMS reserved word not implemented: %s",yytext); } "last_crossing" { yyerrorf("Unsupported: AMS reserved word not implemented: %s", yytext); }
"limexp" { yyerrorf("Unsupported: AMS reserved word not implemented: %s",yytext); } "limexp" { yyerrorf("Unsupported: AMS reserved word not implemented: %s", yytext); }
"ln" { FL; return yD_LN; } "ln" { FL; return yD_LN; }
"log" { FL; return yD_LOG10; } "log" { FL; return yD_LOG10; }
"max" { yyerrorf("Unsupported: AMS reserved word not implemented: %s",yytext); } "max" { yyerrorf("Unsupported: AMS reserved word not implemented: %s", yytext); }
"merged" { yyerrorf("Unsupported: AMS reserved word not implemented: %s",yytext); } "merged" { yyerrorf("Unsupported: AMS reserved word not implemented: %s", yytext); }
"min" { yyerrorf("Unsupported: AMS reserved word not implemented: %s",yytext); } "min" { yyerrorf("Unsupported: AMS reserved word not implemented: %s", yytext); }
"nature" { yyerrorf("Unsupported: AMS reserved word not implemented: %s",yytext); } "nature" { yyerrorf("Unsupported: AMS reserved word not implemented: %s", yytext); }
"net_resolution" { yyerrorf("Unsupported: AMS reserved word not implemented: %s",yytext); } "net_resolution" { yyerrorf("Unsupported: AMS reserved word not implemented: %s", yytext); }
"noise_table" { yyerrorf("Unsupported: AMS reserved word not implemented: %s",yytext); } "noise_table" { yyerrorf("Unsupported: AMS reserved word not implemented: %s", yytext); }
"paramset" { yyerrorf("Unsupported: AMS reserved word not implemented: %s",yytext); } "paramset" { yyerrorf("Unsupported: AMS reserved word not implemented: %s", yytext); }
"potential" { yyerrorf("Unsupported: AMS reserved word not implemented: %s",yytext); } "potential" { yyerrorf("Unsupported: AMS reserved word not implemented: %s", yytext); }
"pow" { FL; return yD_POW; } "pow" { FL; return yD_POW; }
"resolveto" { yyerrorf("Unsupported: AMS reserved word not implemented: %s",yytext); } "resolveto" { yyerrorf("Unsupported: AMS reserved word not implemented: %s", yytext); }
"sin" { FL; return yD_SIN; } "sin" { FL; return yD_SIN; }
"sinh" { FL; return yD_SINH; } "sinh" { FL; return yD_SINH; }
"slew" { yyerrorf("Unsupported: AMS reserved word not implemented: %s",yytext); } "slew" { yyerrorf("Unsupported: AMS reserved word not implemented: %s", yytext); }
"split" { yyerrorf("Unsupported: AMS reserved word not implemented: %s",yytext); } "split" { yyerrorf("Unsupported: AMS reserved word not implemented: %s", yytext); }
"sqrt" { FL; return yD_SQRT; } "sqrt" { FL; return yD_SQRT; }
"string" { FL; return ySTRING; } "string" { FL; return ySTRING; }
"tan" { FL; return yD_TAN; } "tan" { FL; return yD_TAN; }
"tanh" { FL; return yD_TANH; } "tanh" { FL; return yD_TANH; }
"timer" { yyerrorf("Unsupported: AMS reserved word not implemented: %s",yytext); } "timer" { yyerrorf("Unsupported: AMS reserved word not implemented: %s", yytext); }
"transition" { yyerrorf("Unsupported: AMS reserved word not implemented: %s",yytext); } "transition" { yyerrorf("Unsupported: AMS reserved word not implemented: %s", yytext); }
"units" { yyerrorf("Unsupported: AMS reserved word not implemented: %s",yytext); } "units" { yyerrorf("Unsupported: AMS reserved word not implemented: %s", yytext); }
"white_noise" { yyerrorf("Unsupported: AMS reserved word not implemented: %s",yytext); } "white_noise" { yyerrorf("Unsupported: AMS reserved word not implemented: %s", yytext); }
"wreal" { FL; return yWREAL; } "wreal" { FL; return yWREAL; }
"zi_nd" { yyerrorf("Unsupported: AMS reserved word not implemented: %s",yytext); } "zi_nd" { yyerrorf("Unsupported: AMS reserved word not implemented: %s", yytext); }
"zi_np" { yyerrorf("Unsupported: AMS reserved word not implemented: %s",yytext); } "zi_np" { yyerrorf("Unsupported: AMS reserved word not implemented: %s", yytext); }
"zi_zd" { yyerrorf("Unsupported: AMS reserved word not implemented: %s",yytext); } "zi_zd" { yyerrorf("Unsupported: AMS reserved word not implemented: %s", yytext); }
"zi_zp" { yyerrorf("Unsupported: AMS reserved word not implemented: %s",yytext); } "zi_zp" { yyerrorf("Unsupported: AMS reserved word not implemented: %s", yytext); }
} }
/************************************************************************/ /************************************************************************/
@ -646,7 +646,7 @@ vnum {vnum1}|{vnum2}|{vnum3}|{vnum4}|{vnum5}
/* Converted from //{cmt}verilator ...{cmt} by preprocessor */ /* Converted from //{cmt}verilator ...{cmt} by preprocessor */
<V95,V01,V05,VA5,S05,S09,S12,S17,SAX>{ <V95,V01,V05,VA5,S05,S09,S12,S17,SAX>{
"/*verilator"{ws}*"*/" {} /* Ignore empty comments, may be `endif // verilator */ "/*verilator"{ws}*"*/" { } /* Ignore empty comments, may be `endif // verilator */
"/*verilator clock_enable*/" { FL; return yVL_CLOCK_ENABLE; } "/*verilator clock_enable*/" { FL; return yVL_CLOCK_ENABLE; }
"/*verilator coverage_block_off*/" { FL; return yVL_COVERAGE_BLOCK_OFF; } "/*verilator coverage_block_off*/" { FL; return yVL_COVERAGE_BLOCK_OFF; }
"/*verilator full_case*/" { FL; return yVL_FULL_CASE; } "/*verilator full_case*/" { FL; return yVL_FULL_CASE; }
@ -799,7 +799,7 @@ vnum {vnum1}|{vnum2}|{vnum3}|{vnum4}|{vnum5}
{id} { FL; yylval.strp = PARSEP->newString(AstNode::encodeName(string(yytext))); {id} { FL; yylval.strp = PARSEP->newString(AstNode::encodeName(string(yytext)));
return yaID__LEX; return yaID__LEX;
} }
\"[^\"\\]*\" { FL; yylval.strp = PARSEP->newString(yytext+1,yyleng-2); \"[^\"\\]*\" { FL; yylval.strp = PARSEP->newString(yytext+1, yyleng-2);
return yaSTRING; return yaSTRING;
} }
\" { yy_push_state(STRING); yymore(); } \" { yy_push_state(STRING); yymore(); }
@ -812,18 +812,18 @@ vnum {vnum1}|{vnum2}|{vnum3}|{vnum4}|{vnum5}
if (shortlen) { if (shortlen) {
// Push rest for later parse // Push rest for later parse
PARSEP->unputString(yytext+shortlen, yyleng-shortlen); PARSEP->unputString(yytext+shortlen, yyleng-shortlen);
FL; LINECHECKS(yytext,shortlen); FL; LINECHECKS(yytext, shortlen);
// Return is stuff before the tick // Return is stuff before the tick
yytext[shortlen] = '\0'; yytext[shortlen] = '\0';
yylval.nump = PARSEP->newNumber(yylval.fl, (char*)yytext); yylval.nump = PARSEP->newNumber(yylval.fl, (char*)yytext);
return yaINTNUM; return yaINTNUM;
} }
} }
FL; LINECHECK(); yylval.nump = PARSEP->newNumber(yylval.fl,(char*)yytext); FL; LINECHECK(); yylval.nump = PARSEP->newNumber(yylval. fl, (char*)yytext);
return yaINTNUM; return yaINTNUM;
} }
[0-9][_0-9]* { [0-9][_0-9]* {
FL; yylval.nump = PARSEP->newNumber(yylval.fl,(char*)yytext); FL; yylval.nump = PARSEP->newNumber(yylval.fl, (char*)yytext);
return yaINTNUM; return yaINTNUM;
} }
[0-9][_0-9]*(\.[_0-9]+)([eE][-+]?[_0-9]+)? { [0-9][_0-9]*(\.[_0-9]+)([eE][-+]?[_0-9]+)? {
@ -847,7 +847,7 @@ vnum {vnum1}|{vnum2}|{vnum3}|{vnum4}|{vnum5}
<STRING>\\{crnl} { yymore(); NEXTLINE(); } <STRING>\\{crnl} { yymore(); NEXTLINE(); }
<STRING>\\. { yymore(); } <STRING>\\. { yymore(); }
<STRING>\" { yy_pop_state(); <STRING>\" { yy_pop_state();
FL; yylval.strp = PARSEP->newString(yytext+1,yyleng-2); FL; yylval.strp = PARSEP->newString(yytext+1, yyleng-2);
return yaSTRING; } return yaSTRING; }
<STRING>{word} { yymore(); } <STRING>{word} { yymore(); }
<STRING>. { yymore(); } <STRING>. { yymore(); }
@ -872,7 +872,7 @@ vnum {vnum1}|{vnum2}|{vnum3}|{vnum4}|{vnum5}
/* Tables */ /* Tables */
<TABLE>\\{crnl} { yymore(); NEXTLINE(); } <TABLE>\\{crnl} { yymore(); NEXTLINE(); }
<TABLE>{crnl} { NEXTLINE(); yymore(); } <TABLE>{crnl} { NEXTLINE(); yymore(); }
<TABLE>";" { FL; yylval.strp = PARSEP->newString(yytext,yyleng); return yaTABLELINE; } <TABLE>";" { FL; yylval.strp = PARSEP->newString(yytext, yyleng); return yaTABLELINE; }
<TABLE>"endtable" { yy_pop_state(); FL; return yENDTABLE; } <TABLE>"endtable" { yy_pop_state(); FL; return yENDTABLE; }
<TABLE>. { yymore(); } <TABLE>. { yymore(); }
<TABLE><<EOF>> { yyerrorf("EOF in TABLE"); yyleng = 0; yy_pop_state(); } <TABLE><<EOF>> { yyerrorf("EOF in TABLE"); yyleng = 0; yy_pop_state(); }
@ -886,10 +886,10 @@ vnum {vnum1}|{vnum2}|{vnum3}|{vnum4}|{vnum5}
"`autoexpand_vectornets" { } // Verilog-XL compatibility "`autoexpand_vectornets" { } // Verilog-XL compatibility
"`celldefine" { PARSEP->inCellDefine(true); } "`celldefine" { PARSEP->inCellDefine(true); }
"`default_decay_time"{ws}+[^\n\r]* { } // Verilog spec - delays only "`default_decay_time"{ws}+[^\n\r]* { } // Verilog spec - delays only
"`default_nettype"{ws}+"wire" { PARSEP->fileline()->warnOn(V3ErrorCode::I_DEF_NETTYPE_WIRE,true); } "`default_nettype"{ws}+"wire" { PARSEP->fileline()->warnOn(V3ErrorCode::I_DEF_NETTYPE_WIRE, true); }
"`default_nettype"{ws}+"none" { PARSEP->fileline()->warnOn(V3ErrorCode::I_DEF_NETTYPE_WIRE,false); } "`default_nettype"{ws}+"none" { PARSEP->fileline()->warnOn(V3ErrorCode::I_DEF_NETTYPE_WIRE, false); }
"`default_nettype"{ws}+[a-zA-Z0-9]* { yyerrorf("Unsupported: `default_nettype of other than none or wire: %s",yytext); } "`default_nettype"{ws}+[a-zA-Z0-9]* { yyerrorf("Unsupported: `default_nettype of other than none or wire: %s", yytext); }
"`default_trireg_strength"{ws}+[^\n\r]* { yyerrorf("Unsupported: Verilog optional directive not implemented: %s",yytext); } "`default_trireg_strength"{ws}+[^\n\r]* { yyerrorf("Unsupported: Verilog optional directive not implemented: %s", yytext); }
"`delay_mode_distributed" { } // Verilog spec - delays only "`delay_mode_distributed" { } // Verilog spec - delays only
"`delay_mode_path" { } // Verilog spec - delays only "`delay_mode_path" { } // Verilog spec - delays only
"`delay_mode_unit" { } // Verilog spec - delays only "`delay_mode_unit" { } // Verilog spec - delays only
@ -912,7 +912,7 @@ vnum {vnum1}|{vnum2}|{vnum3}|{vnum4}|{vnum5}
"`protect" { } "`protect" { }
"`remove_gatenames" { } // Verilog-XL compatibility "`remove_gatenames" { } // Verilog-XL compatibility
"`remove_netnames" { } // Verilog-XL compatibility "`remove_netnames" { } // Verilog-XL compatibility
"`resetall" { PARSEP->fileline()->warnOn(V3ErrorCode::I_DEF_NETTYPE_WIRE,true); } // Rest handled by preproc "`resetall" { PARSEP->fileline()->warnOn(V3ErrorCode::I_DEF_NETTYPE_WIRE, true); } // Rest handled by preproc
"`suppress_faults" { } // Verilog-XL compatibility "`suppress_faults" { } // Verilog-XL compatibility
"`timescale"{ws}+[^\n\r]* { } // Verilog spec - not supported "`timescale"{ws}+[^\n\r]* { } // Verilog spec - not supported
@ -958,7 +958,7 @@ vnum {vnum1}|{vnum2}|{vnum3}|{vnum4}|{vnum5}
/* Default rules - leave last */ /* Default rules - leave last */
<V95,V01,V05,VA5,S05,S09,S12,S17,SAX,VLT>{ <V95,V01,V05,VA5,S05,S09,S12,S17,SAX,VLT>{
"`"[a-zA-Z_0-9]+ { FL; yyerrorf("Define or directive not defined: %s",yytext); } "`"[a-zA-Z_0-9]+ { FL; yyerrorf("Define or directive not defined: %s", yytext); }
"//"[^\n]* { } /* throw away single line comments */ "//"[^\n]* { } /* throw away single line comments */
. { FL; return yytext[0]; } /* return single char ops. */ . { FL; return yytext[0]; } /* return single char ops. */
} }
@ -1022,8 +1022,9 @@ void V3ParseImp::lexToken() {
// "consume" it. Must set again if want another token under temp scope // "consume" it. Must set again if want another token under temp scope
SYMP->nextId(NULL); SYMP->nextId(NULL);
} else { } else {
UINFO(7," lexToken: find upward "<<SYMP->symCurrentp()<<" for '"<<*(yylval.strp)<<"'"<<endl); UINFO(7," lexToken: find upward "<<SYMP->symCurrentp()
//if (debug()>=9) SYMP->symCurrentp()->dump(cout," -findtree: ",true); <<" for '"<<*(yylval.strp)<<"'"<<endl);
//if (debug()>=9) SYMP->symCurrentp()->dump(cout," -findtree: ", true);
foundp = SYMP->symCurrentp()->findIdFallback(*(yylval.strp)); foundp = SYMP->symCurrentp()->findIdFallback(*(yylval.strp));
} }
if (foundp) { if (foundp) {
@ -1055,7 +1056,9 @@ int V3ParseImp::lexToBison() {
if (debugFlex()>=6 || debugBison()>=6) { if (debugFlex()>=6 || debugBison()>=6) {
cout<<" {"<<yylval.fl->filenameLetters()<<yylval.fl->lineno() cout<<" {"<<yylval.fl->filenameLetters()<<yylval.fl->lineno()
<<"} lexToBison TOKEN="<<yylval.token<<" "<<tokenName(yylval.token); <<"} lexToBison TOKEN="<<yylval.token<<" "<<tokenName(yylval.token);
if (yylval.token == yaID__ETC || yylval.token == yaID__LEX || yylval.token == yaID__aTYPE) { if (yylval.token == yaID__ETC
|| yylval.token == yaID__LEX
|| yylval.token == yaID__aTYPE) {
cout<<" strp='"<<*(yylval.strp)<<"'"; cout<<" strp='"<<*(yylval.strp)<<"'";
} }
cout<<endl; cout<<endl;