31 #ifndef DOXYGEN_SHOULD_SKIP_THIS 37 void O3PRM_TYPE_NOT_FOUND(
const O3Label& val, ErrorsContainer& errors) {
38 auto pos = val.position();
39 std::stringstream msg;
41 <<
"Unknown type " << val.label();
42 errors.addError(msg.str(), pos.file(), pos.line(), pos.column());
45 void O3PRM_TYPE_AMBIGUOUS(
const O3Label& val,
46 const std::vector< std::string >& matches,
47 ErrorsContainer& errors) {
48 const auto& pos = val.position();
49 std::stringstream msg;
51 <<
"Ambiguous name " << val.label()
52 <<
", found more than one elligible types: ";
53 for (std::size_t i = 0; i < matches.size() - 1; ++i) {
54 msg << matches[i] <<
", ";
56 msg << matches.back();
57 errors.addError(msg.str(), pos.file(), pos.line(), pos.column());
60 void O3PRM_TYPE_RESERVED(
const O3Label& val, ErrorsContainer& errors) {
61 const auto& pos = val.position();
62 std::stringstream msg;
64 <<
"Type name " << val.label() <<
" is reserved";
65 errors.addError(msg.str(), pos.file(), pos.line(), pos.column());
68 void O3PRM_TYPE_DUPPLICATE(
const O3Label& val, ErrorsContainer& errors) {
69 const auto& pos = val.position();
70 std::stringstream msg;
72 <<
"Type " << val.label() <<
" exists already";
73 errors.addError(msg.str(), pos.file(), pos.line(), pos.column());
76 void O3PRM_TYPE_CYCLIC_INHERITANCE(
const O3Label& sub_type,
77 const O3Label& super_type,
78 ErrorsContainer& errors) {
79 const auto& pos = sub_type.position();
80 std::stringstream msg;
82 <<
"Cyclic inheritance between type " << sub_type.label()
83 <<
" and type " << super_type.label();
84 errors.addError(msg.str(), pos.file(), pos.line(), pos.column());
87 void O3PRM_TYPE_UNKNOWN_LABEL(
const O3Label& type,
89 ErrorsContainer& errors) {
90 const auto& pos = l.position();
91 std::stringstream msg;
93 <<
"Unknown label " << l.label() <<
" in " << type.label();
94 errors.addError(msg.str(), pos.file(), pos.line(), pos.column());
97 void O3PRM_TYPE_INVALID_RANGE(
const O3IntType& val,
98 ErrorsContainer& errors) {
99 const auto& pos = val.position();
100 std::stringstream msg;
102 <<
"Invalid range " << val.start().value() <<
" -> " 103 << val.end().value();
104 errors.addError(msg.str(), pos.file(), pos.line(), pos.column());
107 void O3PRM_TYPE_INVALID_RANGE(
const O3RealType& val,
108 ErrorsContainer& errors) {
109 const auto& pos = val.position();
110 std::stringstream msg;
112 <<
"Found " << val.values().size()
113 <<
" values in range expected at least 3";
114 errors.addError(msg.str(), pos.file(), pos.line(), pos.column());
117 void O3PRM_CLASS_NOT_FOUND(
const O3Label& val, ErrorsContainer& errors) {
118 const auto& pos = val.position();
119 std::stringstream msg;
121 <<
"Unknown class " << val.label();
122 errors.addError(msg.str(), pos.file(), pos.line(), pos.column());
126 void O3PRM_CLASS_AMBIGUOUS(
const O3Label& val,
127 const std::vector< std::string >& matches,
128 ErrorsContainer& errors) {
129 const auto& pos = val.position();
130 std::stringstream msg;
132 <<
"Name " << val.label() <<
" is ambiguous: ";
133 for (std::size_t i = 0; i < matches.size() - 1; ++i) {
134 msg << matches[i] <<
", ";
136 msg << matches.back();
137 errors.addError(msg.str(), pos.file(), pos.line(), pos.column());
140 void O3PRM_CLASS_DUPLICATE(
const O3Label& val, ErrorsContainer& errors) {
142 const auto& pos = val.position();
143 std::stringstream msg;
145 <<
"Class name " << val.label() <<
" exists already";
146 errors.addError(msg.str(), pos.file(), pos.line(), pos.column());
149 void O3PRM_CLASS_CYLIC_INHERITANCE(
const O3Label& sub,
150 const O3Label& super,
151 ErrorsContainer& errors) {
153 const auto& pos = sub.position();
154 std::stringstream msg;
156 <<
"Cyclic inheritance between class " << sub.label() <<
" and class " 158 errors.addError(msg.str(), pos.file(), pos.line(), pos.column());
162 void O3PRM_CLASS_ATTR_IMPLEMENTATION(
const O3Label& c,
165 ErrorsContainer& errors) {
166 const auto& pos = attr.position();
167 std::stringstream msg;
169 <<
"Class " << c.label() <<
" attribute " << attr.label()
170 <<
" does not respect interface " << i.label();
171 errors.addError(msg.str(), pos.file(), pos.line(), pos.column());
174 void O3PRM_CLASS_AGG_IMPLEMENTATION(
const O3Label& c,
177 ErrorsContainer& errors) {
178 const auto& pos = attr.position();
179 std::stringstream msg;
181 <<
"Class " << c.label() <<
" aggregate " << attr.label()
182 <<
" does not respect interface " << i.label();
183 errors.addError(msg.str(), pos.file(), pos.line(), pos.column());
186 void O3PRM_CLASS_REF_IMPLEMENTATION(
const O3Label& c,
189 ErrorsContainer& errors) {
190 const auto& pos = ref.position();
191 std::stringstream msg;
193 <<
"Class " << c.label() <<
" reference " << ref.label()
194 <<
" does not respect interface " << i.label();
195 errors.addError(msg.str(), pos.file(), pos.line(), pos.column());
199 void O3PRM_CLASS_MISSING_ATTRIBUTES(
const O3Label& c,
201 ErrorsContainer& errors) {
202 const auto& pos = c.position();
203 std::stringstream msg;
205 <<
"Class " << c.label() <<
" does not implement all of interface " 206 << i.label() <<
" attributes";
207 errors.addError(msg.str(), pos.file(), pos.line(), pos.column());
210 void O3PRM_CLASS_DUPLICATE_REFERENCE(
const O3Label& ref,
211 ErrorsContainer& errors) {
212 const auto& pos = ref.position();
213 std::stringstream msg;
215 <<
"Reference Slot name " << ref.label() <<
" exists already";
216 errors.addError(msg.str(), pos.file(), pos.line(), pos.column());
219 void O3PRM_CLASS_SELF_REFERENCE(
const O3Label& c,
221 ErrorsContainer& errors) {
222 const auto& pos = ref.position();
223 std::stringstream msg;
225 <<
"Class " << c.label() <<
" cannot reference itself";
226 errors.addError(msg.str(), pos.file(), pos.line(), pos.column());
229 void O3PRM_CLASS_ILLEGAL_SUB_REFERENCE(
const O3Label& c,
231 ErrorsContainer& errors) {
232 const auto& pos = sub.position();
233 std::stringstream msg;
235 <<
"Class " << c.label() <<
" cannot reference subclass " 237 errors.addError(msg.str(), pos.file(), pos.line(), pos.column());
240 void O3PRM_CLASS_PARENT_NOT_FOUND(
const O3Label& parent,
241 ErrorsContainer& errors) {
242 const auto& pos = parent.position();
243 std::stringstream msg;
245 <<
"Parent " << parent.label() <<
" not found";
246 errors.addError(msg.str(), pos.file(), pos.line(), pos.column());
249 void O3PRM_CLASS_ILLEGAL_PARENT(
const O3Label& parent,
250 ErrorsContainer& errors) {
251 const auto& pos = parent.position();
252 std::stringstream msg;
254 <<
"Illegal parent " << parent.label();
255 errors.addError(msg.str(), pos.file(), pos.line(), pos.column());
258 void O3PRM_CLASS_LINK_NOT_FOUND(
const O3Label& chain,
259 const std::string& s,
260 ErrorsContainer& errors) {
261 const auto& pos = chain.position();
262 std::stringstream msg;
264 <<
"Link " << s <<
" in chain " << chain.label() <<
" not found";
265 errors.addError(msg.str(), pos.file(), pos.line(), pos.column());
268 void O3PRM_CLASS_ILLEGAL_CPT_SIZE(
const std::string& c,
272 ErrorsContainer& errors) {
273 const auto& pos = attr.position();
274 std::stringstream msg;
276 <<
"Illegal CPT size, expected " << expected <<
" found " << found
277 <<
" for attribute " << c <<
"." << attr.label();
278 errors.addError(msg.str(), pos.file(), pos.line(), pos.column());
281 void O3PRM_CLASS_ILLEGAL_CPT_VALUE(
const std::string& c,
284 ErrorsContainer& errors) {
285 const auto& pos = f.position();
286 std::stringstream msg;
288 <<
"Illegal CPT value \"" << f.formula().formula()
289 <<
"\" in attribute " << c <<
"." << attr.label();
291 auto result = f.formula().result();
292 msg <<
", formula resolve to " << result;
294 msg <<
", could not resolve the following formula: " 295 <<
"\"" << f.formula().formula() <<
"\"";
297 errors.addError(msg.str(), pos.file(), pos.line(), pos.column());
300 void O3PRM_CLASS_CPT_DOES_NOT_SUM_TO_1(
const std::string& c,
303 ErrorsContainer& errors) {
304 const auto& pos = attr.position();
305 std::stringstream msg;
307 <<
"PRMAttribute " << c <<
"." << attr.label()
308 <<
" CPT does not sum to 1, found " << f;
309 errors.addError(msg.str(), pos.file(), pos.line(), pos.column());
312 void O3PRM_CLASS_CPT_DOES_NOT_SUM_TO_1_WARNING(
const std::string& c,
315 ErrorsContainer& errors) {
316 const auto& pos = attr.position();
317 std::stringstream msg;
319 <<
"PRMAttribute " << c <<
"." << attr.label()
320 <<
" CPT does not sum to 1, found " << f;
321 errors.addWarning(msg.str(), pos.file(), pos.line(), pos.column());
327 ErrorsContainer& errors) {
328 const auto& pos = rule.first.front().position();
329 std::stringstream msg;
331 <<
"Expected " << expected <<
" value(s), found " << found;
332 errors.addError(msg.str(), pos.file(), pos.line(), pos.column());
336 const O3Label& label,
337 const O3Label& parent,
338 ErrorsContainer& errors) {
339 const auto& pos = label.position();
340 std::stringstream msg;
342 <<
"Label " << label <<
" is not part of " << parent <<
" domain";
343 errors.addError(msg.str(), pos.file(), pos.line(), pos.column());
346 void O3PRM_CLASS_WRONG_PARENT(
const O3Label& prnt, ErrorsContainer& errors) {
347 const auto& pos = prnt.position();
348 std::stringstream msg;
350 <<
"Illegal parent " << prnt;
351 errors.addError(msg.str(), pos.file(), pos.line(), pos.column());
354 void O3PRM_CLASS_WRONG_PARENT_TYPE(
const O3Label& prnt,
355 const std::string& expected,
356 const std::string& found,
357 ErrorsContainer& errors) {
358 const auto& pos = prnt.position();
359 std::stringstream msg;
361 <<
"Expected type " << expected <<
" for parent " << prnt.label()
362 <<
", found " << found;
363 errors.addError(msg.str(), pos.file(), pos.line(), pos.column());
366 void O3PRM_CLASS_ILLEGAL_OVERLOAD(
const O3Label& elt,
368 ErrorsContainer& errors) {
369 const auto& pos = elt.position();
370 std::stringstream msg;
372 <<
"Illegal overload of element " << elt.label() <<
" from class " 374 errors.addError(msg.str(), pos.file(), pos.line(), pos.column());
377 void O3PRM_CLASS_AGG_PARAMETERS(
const O3Label& agg,
380 ErrorsContainer& errors) {
381 const auto& pos = agg.position();
382 std::stringstream msg;
384 <<
"Expected " << expected <<
" parameters " 385 <<
", found " << found;
386 errors.addError(msg.str(), pos.file(), pos.line(), pos.column());
389 void O3PRM_CLASS_AGG_PARAMETER_NOT_FOUND(
const O3Label& agg,
390 const O3Label& param,
391 ErrorsContainer& errors) {
392 const auto& pos = param.position();
393 std::stringstream msg;
395 <<
"Parameter " << param.label() <<
" in aggregate " << agg.label()
396 <<
" does not match any expected values";
397 errors.addError(msg.str(), pos.file(), pos.line(), pos.column());
400 void O3PRM_INTERFACE_ILLEGAL_ARRAY(
const O3Label& val,
401 ErrorsContainer& errors) {
402 const auto& pos = val.position();
403 std::stringstream msg;
405 <<
"PRMAttribute " << val.label() <<
" can not be an array";
406 errors.addError(msg.str(), pos.file(), pos.line(), pos.column());
409 void O3PRM_INTERFACE_NOT_FOUND(
const O3Label& val, ErrorsContainer& errors) {
410 const auto& pos = val.position();
411 std::stringstream msg;
413 <<
"Interface " << val.label() <<
" not found";
414 errors.addError(msg.str(), pos.file(), pos.line(), pos.column());
417 void O3PRM_INTERFACE_AMBIGUOUS(
const O3Label& val,
418 const std::vector< std::string >& matches,
419 ErrorsContainer& errors) {
420 const auto& pos = val.position();
421 std::stringstream msg;
423 <<
"Name " << val.label() <<
" is ambiguous: ";
424 for (std::size_t i = 0; i < matches.size() - 1; ++i) {
425 msg << matches[i] <<
", ";
427 msg << matches.back();
428 errors.addError(msg.str(), pos.file(), pos.line(), pos.column());
431 void O3PRM_INTERFACE_DUPLICATE(
const O3Label& val, ErrorsContainer& errors) {
432 const auto& pos = val.position();
433 std::stringstream msg;
435 <<
"Interface name " << val.label() <<
" exists already";
436 errors.addError(msg.str(), pos.file(), pos.line(), pos.column());
439 void O3PRM_INTERFACE_DUPLICATE_ELEMENT(
const O3InterfaceElement& elt,
440 ErrorsContainer& errors) {
441 const auto& pos = elt.type().position();
442 std::stringstream msg;
444 <<
"Element " << elt.name().label() <<
" already exists";
445 errors.addError(msg.str(), pos.file(), pos.line(), pos.column());
448 void O3PRM_INTERFACE_CYCLIC_INHERITANCE(
const O3Label& sub,
449 const O3Label& super,
450 ErrorsContainer& errors) {
451 const auto& pos = super.position();
452 std::stringstream msg;
454 <<
"Cyclic inheritance between interface " << sub.label()
455 <<
" and interface " << super.label();
456 errors.addError(msg.str(), pos.file(), pos.line(), pos.column());
459 void O3PRM_INTERFACE_SELF_REFERENCE(
const O3Interface& i,
460 const O3InterfaceElement& r,
461 ErrorsContainer& errors) {
462 const auto& pos = r.type().position();
463 std::stringstream msg;
465 <<
"Interface " << i.name().label() <<
" cannot reference itself";
466 errors.addError(msg.str(), pos.file(), pos.line(), pos.column());
469 void O3PRM_INTERFACE_ILLEGAL_SUB_REFERENCE(
const O3Interface& i,
470 const O3InterfaceElement& ref,
471 ErrorsContainer& errors) {
472 const auto& pos = ref.type().position();
473 std::stringstream msg;
475 <<
"Interface " << i.name().label()
476 <<
" cannot reference subinterface " << ref.type().label();
477 errors.addError(msg.str(), pos.file(), pos.line(), pos.column());
480 void O3PRM_INTERFACE_ILLEGAL_OVERLOAD(
const O3InterfaceElement& elt,
481 ErrorsContainer& errors) {
482 const auto& pos = elt.type().position();
483 std::stringstream msg;
485 <<
"Illegal overload of element " << elt.name().label();
486 errors.addError(msg.str(), pos.file(), pos.line(), pos.column());
489 void O3PRM_REFERENCE_NOT_FOUND(
const O3Label& val, ErrorsContainer& errors) {
490 const auto& pos = val.position();
491 std::stringstream msg;
493 <<
"Reference Slot type " << val.label() <<
" not found";
494 errors.addError(msg.str(), pos.file(), pos.line(), pos.column());
497 void O3PRM_REFERENCE_AMBIGUOUS(
const O3Label& val,
498 const std::vector< std::string >& matches,
499 ErrorsContainer& errors) {
500 const auto& pos = val.position();
501 std::stringstream msg;
503 <<
"Name " << val.label() <<
" is ambiguous: ";
504 for (std::size_t i = 0; i < matches.size() - 1; ++i) {
505 msg << matches[i] <<
", ";
507 msg << matches.back();
508 errors.addError(msg.str(), pos.file(), pos.line(), pos.column());
511 void O3PRM_SYSTEM_INSTANTIATION_FAILED(
const O3System& sys,
512 ErrorsContainer& errors) {
513 const auto& pos = sys.name().position();
514 std::stringstream msg;
516 <<
"Could not instantiate the system, some reference slots must be " 518 errors.addError(msg.str(), pos.file(), pos.line(), pos.column());
521 void O3PRM_SYSTEM_NOT_A_CLASS(
const O3Instance& i, ErrorsContainer& errors) {
522 const auto& pos = i.type().position();
523 std::stringstream msg;
524 msg <<
"Error : " << i.type().label() <<
" is not a class";
525 errors.addError(msg.str(), pos.file(), pos.line(), pos.column());
528 void O3PRM_SYSTEM_DUPLICATE_INSTANCE(
const O3Instance& i,
529 ErrorsContainer& errors) {
530 const auto& pos = i.type().position();
531 std::stringstream msg;
533 <<
"Instance " << i.name().label() <<
" already exists";
534 errors.addError(msg.str(), pos.file(), pos.line(), pos.column());
537 void O3PRM_SYSTEM_NOT_A_PARAMETER(
const O3InstanceParameter& param,
538 ErrorsContainer& errors) {
539 const auto& pos = param.name().position();
540 std::stringstream msg;
541 msg <<
"Instance error : " << param.name().label()
542 <<
" is not a parameter";
543 errors.addError(msg.str(), pos.file(), pos.line(), pos.column());
546 void O3PRM_SYSTEM_PARAMETER_NOT_FOUND(
const O3InstanceParameter& param,
547 ErrorsContainer& errors) {
548 const auto& pos = param.name().position();
549 std::stringstream msg;
551 <<
"Parameter " << param.name().label() <<
" not found";
552 errors.addError(msg.str(), pos.file(), pos.line(), pos.column());
555 void O3PRM_SYSTEM_PARAMETER_NOT_INT(
const O3InstanceParameter& param,
556 ErrorsContainer& errors) {
557 const auto& pos = param.value().position();
558 std::stringstream msg;
560 <<
"Parameter " << param.name().label() <<
" is an integer";
561 errors.addError(msg.str(), pos.file(), pos.line(), pos.column());
564 void O3PRM_SYSTEM_PARAMETER_NOT_FLOAT(
const O3InstanceParameter& param,
565 ErrorsContainer& errors) {
566 const auto& pos = param.value().position();
567 std::stringstream msg;
569 <<
"Parameter " << param.name().label() <<
" is a float";
570 errors.addError(msg.str(), pos.file(), pos.line(), pos.column());
573 void O3PRM_SYSTEM_INVALID_LEFT_VALUE(
const O3Label& val,
574 ErrorsContainer& errors) {
575 const auto& pos = val.position();
576 std::stringstream msg;
578 <<
"Invalid left expression " << val.label();
579 errors.addError(msg.str(), pos.file(), pos.line(), pos.column());
582 void O3PRM_SYSTEM_INSTANCE_NOT_FOUND(
const O3Label& i,
583 ErrorsContainer& errors) {
584 const auto& pos = i.position();
585 std::stringstream msg;
587 <<
"Instance " << i.label() <<
" not found";
588 errors.addError(msg.str(), pos.file(), pos.line(), pos.column());
591 void O3PRM_SYSTEM_REFERENCE_NOT_FOUND(
const O3Label& ref,
592 const std::string& type,
593 ErrorsContainer& errors) {
594 const auto& pos = ref.position();
595 std::stringstream msg;
597 <<
"Reference " << ref.label() <<
" not found in class " << type;
598 errors.addError(msg.str(), pos.file(), pos.line(), pos.column());
601 void O3PRM_SYSTEM_NOT_AN_ARRAY(
const O3Label& val, ErrorsContainer& errors) {
602 const auto& pos = val.position();
603 std::stringstream msg;
604 msg <<
"Error : " << val.label() <<
" is not an array";
605 errors.addError(msg.str(), pos.file(), pos.line(), pos.column());
608 void O3PRM_DEPRECATED_TYPE_WARNING(
const O3Label& val,
609 ErrorsContainer& errors) {
610 const auto& pos = val.position();
611 std::stringstream msg;
612 msg <<
"Warning : " << val.label()
613 <<
" is declared using a deprecated syntax.";
614 errors.addWarning(msg.str(), pos.file(), pos.line(), pos.column());
622 #endif // DOXYGEN_SHOULD_SKIP_THIS std::pair< O3LabelList, O3FormulaList > O3Rule
Functions for error messages.
gum is the global namespace for all aGrUM entities
std::size_t Size
In aGrUM, hashed values are unsigned long int.
#define GUM_ERROR(type, msg)