3
0
Fork 0
mirror of https://github.com/YosysHQ/yosys synced 2025-04-24 01:25:33 +00:00

functional backends: identifiers in c++/smtlib may not start with digits

This commit is contained in:
Emily Schmidt 2024-08-27 13:10:34 +01:00
parent 459e6b913a
commit b428bf4600
3 changed files with 6 additions and 6 deletions

View file

@ -48,8 +48,8 @@ template<typename Id> struct CxxScope : public Functional::Scope<Id> {
for(const char **p = reserved_keywords; *p != nullptr; p++)
this->reserve(*p);
}
bool is_character_legal(char c) override {
return isascii(c) && (isalnum(c) || c == '_' || c == '$');
bool is_character_legal(char c, int index) override {
return isascii(c) && (isalpha(c) || (isdigit(c) && index > 0) || c == '_' || c == '$');
}
};

View file

@ -48,8 +48,8 @@ struct SmtScope : public Functional::Scope<int> {
for(const char **p = reserved_keywords; *p != nullptr; p++)
reserve(*p);
}
bool is_character_legal(char c) override {
return isascii(c) && (isalnum(c) || strchr("~!@$%^&*_-+=<>.?/", c));
bool is_character_legal(char c, int index) override {
return isascii(c) && (isalpha(c) || (isdigit(c) && index > 0) || strchr("~!@$%^&*_-+=<>.?/", c));
}
};