Add error on misused define.

This commit is contained in:
Wilson Snyder
2020-01-11 09:16:26 -05:00
parent fe9cf9bd42
commit fe94f9891b
7 changed files with 51 additions and 0 deletions
+5
View File
@@ -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 {
+7
View File
@@ -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
+2
View File
@@ -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);
};
//######################################################################