To protect your data, the CISO officer has suggested users to enable 2FA as soon as possible.
Currently 2.7% of users enabled 2FA.

Commit 0e1102ee authored by Isaac Oscar Gariano's avatar Isaac Oscar Gariano
Browse files

You can now use internal zebu names (muc will act as if their is no name)

parent abf81ad5
......@@ -81,7 +81,7 @@ namespace C
std::string gen_local(std::string name = ""s) {
std::string id_name = "L("s + std::to_string(last_local_id++) + (name.empty() ? ""s : ", "s + name) + ")"s;
write_line("MuID "s + id_name + " = " + irbuilder + "->gen_sym(" + irbuilder + ", " + (name.empty() ? "NULL" : "\"@" + name + "\"")+ ");");
write_line("MuID "s + id_name + " = " + irbuilder + "->gen_sym(" + irbuilder + ", " + (name.empty() || !is_valid_mu_name(name) ? "NULL" : "\"@" + name + "\"")+ ");");
return id_name;
}
......@@ -89,7 +89,7 @@ namespace C
std::string id = std::to_string(last_global_id++);
std::string id_name = "G("s + id + (name.empty() ? ""s : ", "s + name) + ")"s;
stream << "\t" << "MuID "s + id_name + ";" << std::endl;
write_line(id_name + " = " + irbuilder + "->gen_sym(" + irbuilder + ", " + (name.empty() ? "NULL" : "\"@" + name + "\"")+ ");");
write_line(id_name + " = " + irbuilder + "->gen_sym(" + irbuilder + ", " + (name.empty() || !is_valid_mu_name(name) ? "NULL" : "\"@" + name + "\"")+ ");");
return id_name;
}
......
......@@ -61,7 +61,8 @@ namespace Runtime
id = symbols[name] = globals[name];
else {
std::string global_name = "@"s + name;
id = symbols[name] = irbuilder->gen_sym(irbuilder, global_name.c_str());
id = symbols[name] = irbuilder->gen_sym(irbuilder, is_valid_mu_name(global_name) ? global_name
.c_str() : nullptr);
if (global) {
globals[name] = id;
if (name[0] != '_')
......
......@@ -363,6 +363,8 @@ IDCHAR
| '-'
| '_'
| '.'
| '#' // Internal use only
| ':' // Internal use only
;
fragment
......
......@@ -106,4 +106,10 @@ std::size_t stosz(const std::string& str, std::size_t* pos = 0, int base = 10 )
{
static_assert(sizeof(std::size_t) <= sizeof(unsigned long long), "size_t should not be bigger than unsigned long long");
return (std::size_t)std::stoull(str, pos, base);
}
bool is_valid_mu_name(std::string s) {
return std::all_of(s.cbegin(), s.cend(), [](char c){
return std::isalnum(c) || c == '-' || c == '_' || c == '.';
});
}
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment