mirror of
https://github.com/verilator/verilator.git
synced 2026-09-03 06:03:03 +02:00
Fix preprocessor to respect strings in joins (#5007)
This adheres more to the wording used in IEEE 1800-2017 22.5.1, specifying the join operator to be more of a delimiter than join: > A `` delimits lexical tokens without introducing white space, > allowing identifiers to be constructed from arguments. Before, string RHS arguments to the join operator were silently dropped. Signed-off-by: Arkadiusz Kozdra <[email protected]>
This commit is contained in:
+2
-2
@@ -1411,7 +1411,7 @@ int V3PreProcImp::getStateToken() {
|
||||
}
|
||||
}
|
||||
case ps_JOIN: {
|
||||
if (tok == VP_SYMBOL || tok == VP_TEXT) {
|
||||
if (tok == VP_SYMBOL || tok == VP_TEXT || tok == VP_STRING) {
|
||||
UASSERT(!m_joinStack.empty(), "`` join stack empty, but in a ``");
|
||||
const string lhs = m_joinStack.top();
|
||||
m_joinStack.pop();
|
||||
@@ -1423,7 +1423,7 @@ int V3PreProcImp::getStateToken() {
|
||||
unputString(out);
|
||||
statePop();
|
||||
goto next_tok;
|
||||
} else if (tok == VP_EOF || tok == VP_WHITE || tok == VP_COMMENT || tok == VP_STRING) {
|
||||
} else if (tok == VP_EOF || tok == VP_WHITE || tok == VP_COMMENT) {
|
||||
// Other compilers just ignore this, so no warning
|
||||
// "Expecting symbol to terminate ``; whitespace etc cannot
|
||||
// follow ``. Found: "+tokenName(tok)+"\n"
|
||||
|
||||
Reference in New Issue
Block a user