| 137 | } |
| 138 | |
| 139 | void Statements::AddFlags(std::shared_ptr<FlagsType>& f) |
| 140 | { |
| 141 | if (f == nullptr) |
| 142 | yyerror("Flags is null!"); |
| 143 | if (f->name->empty()) |
| 144 | yyerror("Flags name is invalid!"); |
| 145 | if (!f->body) |
| 146 | yyerror("Flags is empty - " + *f->name.get()); |
| 147 | |
| 148 | // Check for duplicates |
| 149 | auto it = std::find_if(flags.begin(), flags.end(), [&f](auto item)->bool { return *item->name.get() == *f->name.get(); }); |
| 150 | if (it != flags.end()) |
| 151 | yyerror("Duplicate flags name " + *f->name.get()); |
| 152 | |
| 153 | flags.push_back(f); |
| 154 | } |
| 155 | |
| 156 | void Statements::AddStruct(std::shared_ptr<StructType>& s) |
| 157 | { |