mirror of
https://github.com/YosysHQ/yosys
synced 2025-04-25 10:05:33 +00:00
preprocessor: do not destroy double slash escaped identifiers
The preprocessor currently destroys double slash containing escaped identifiers (for example \a//b ). This is due to next_token trying to convert single line comments (//) into /* */ comments. This then leads to an unintuitive error message like this: ERROR: syntax error, unexpected '*' This patch fixes the error by recognizing escaped identifiers and returning them as single token. It also adds a testcase.
This commit is contained in:
parent
477eeefd9b
commit
4cd2f03e36
2 changed files with 29 additions and 0 deletions
|
@ -142,6 +142,16 @@ static std::string next_token(bool pass_newline = false)
|
|||
return_char(ch);
|
||||
}
|
||||
}
|
||||
else if (ch == '\\')
|
||||
{
|
||||
while ((ch = next_char()) != 0) {
|
||||
if (ch < 33 || ch > 126) {
|
||||
return_char(ch);
|
||||
break;
|
||||
}
|
||||
token += ch;
|
||||
}
|
||||
}
|
||||
else if (ch == '/')
|
||||
{
|
||||
if ((ch = next_char()) != 0) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue