| 129 | } |
| 130 | |
| 131 | void validatePortName(const std::string& name, int line_number) |
| 132 | { |
| 133 | const auto line_str = std::to_string(line_number); |
| 134 | if(name.empty()) |
| 135 | { |
| 136 | throw RuntimeError("Error at line ", line_str, ": Port name cannot be empty"); |
| 137 | } |
| 138 | if(std::isdigit(static_cast<unsigned char>(name[0])) != 0) |
| 139 | { |
| 140 | throw RuntimeError("Error at line ", line_str, ": Port name '", name, |
| 141 | "' cannot start with a digit"); |
| 142 | } |
| 143 | if(char c = findForbiddenChar(name); c != '\0') |
| 144 | { |
| 145 | throw RuntimeError("Error at line ", line_str, ": Port name '", name, |
| 146 | "' contains forbidden character ", formatForbiddenChar(c)); |
| 147 | } |
| 148 | if(IsReservedAttribute(name)) |
| 149 | { |
| 150 | throw RuntimeError("Error at line ", line_str, ": Port name '", name, |
| 151 | "' is a reserved attribute name"); |
| 152 | } |
| 153 | } |
| 154 | |
| 155 | void validateInstanceName(const std::string& name, int line_number) |
| 156 | { |
no test coverage detected