mirror of
https://github.com/verilator/verilator.git
synced 2026-10-06 10:03:44 +02:00
Add error on misused define.
This commit is contained in:
@@ -244,6 +244,11 @@ bom [\357\273\277]
|
||||
// Note paren level 0 means before "(" of starting args
|
||||
// Level 1 means "," between arguments
|
||||
// Level 2+ means one inside the () of an argument
|
||||
if (LEXP->m_parenLevel == 1) { // Starting (
|
||||
if (!VString::isWhitespace(LEXP->m_defValue)) {
|
||||
yyerrorf("Illegal text before '(' that starts define arguments");
|
||||
}
|
||||
}
|
||||
if (LEXP->m_parenLevel>1) {
|
||||
appendDefValue(yytext, yyleng); FL_BRK;
|
||||
} else {
|
||||
|
||||
@@ -114,6 +114,13 @@ string VString::spaceUnprintable(const string& str) {
|
||||
return out;
|
||||
}
|
||||
|
||||
bool VString::isWhitespace(const string& str) {
|
||||
for (string::const_iterator pos = str.begin(); pos != str.end(); ++pos) {
|
||||
if (!isspace(*pos)) return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
//######################################################################
|
||||
// VHashSha256
|
||||
|
||||
|
||||
@@ -74,6 +74,8 @@ public:
|
||||
// Replace any unprintable with space
|
||||
// This includes removing tabs, so column tracking is correct
|
||||
static string spaceUnprintable(const string& str);
|
||||
// Return true if only whitespace or ""
|
||||
static bool isWhitespace(const string& str);
|
||||
};
|
||||
|
||||
//######################################################################
|
||||
|
||||
Reference in New Issue
Block a user