33 #ifndef DOXYGEN_SHOULD_SKIP_THIS 39 void O3PRM_TYPE_NOT_FOUND(
const O3Label& val, ErrorsContainer& errors) {
40 auto pos = val.position();
41 std::stringstream msg;
43 <<
"Unknown type " << val.label();
44 errors.addError(msg.str(), pos.file(), pos.line(), pos.column());
47 void O3PRM_TYPE_AMBIGUOUS(
const O3Label& val,
48 const std::vector< std::string >& matches,
49 ErrorsContainer& errors) {
50 const auto& pos = val.position();
51 std::stringstream msg;
53 <<
"Ambiguous name " << val.label()
54 <<
", found more than one elligible types: ";
55 for (std::size_t i = 0; i < matches.size() - 1; ++i) {
56 msg << matches[i] <<
", ";
58 msg << matches.back();
59 errors.addError(msg.str(), pos.file(), pos.line(), pos.column());
62 void O3PRM_TYPE_RESERVED(
const O3Label& val, ErrorsContainer& errors) {
63 const auto& pos = val.position();
64 std::stringstream msg;
66 <<
"Type name " << val.label() <<
" is reserved";
67 errors.addError(msg.str(), pos.file(), pos.line(), pos.column());
70 void O3PRM_TYPE_DUPPLICATE(
const O3Label& val, ErrorsContainer& errors) {
71 const auto& pos = val.position();
72 std::stringstream msg;
74 <<
"Type " << val.label() <<
" exists already";
75 errors.addError(msg.str(), pos.file(), pos.line(), pos.column());
78 void O3PRM_TYPE_CYCLIC_INHERITANCE(
const O3Label& sub_type,
79 const O3Label& super_type,
80 ErrorsContainer& errors) {
81 const auto& pos = sub_type.position();
82 std::stringstream msg;
84 <<
"Cyclic inheritance between type " << sub_type.label()
85 <<
" and type " << super_type.label();
86 errors.addError(msg.str(), pos.file(), pos.line(), pos.column());
89 void O3PRM_TYPE_UNKNOWN_LABEL(
const O3Label& type,
91 ErrorsContainer& errors) {
92 const auto& pos = l.position();
93 std::stringstream msg;
95 <<
"Unknown label " << l.label() <<
" in " << type.label();
96 errors.addError(msg.str(), pos.file(), pos.line(), pos.column());
99 void O3PRM_TYPE_INVALID_RANGE(
const O3IntType& val,
100 ErrorsContainer& errors) {
101 const auto& pos = val.position();
102 std::stringstream msg;
104 <<
"Invalid range " << val.start().value() <<
" -> " 105 << val.end().value();
106 errors.addError(msg.str(), pos.file(), pos.line(), pos.column());
109 void O3PRM_TYPE_INVALID_RANGE(
const O3RealType& val,
110 ErrorsContainer& errors) {
111 const auto& pos = val.position();
112 std::stringstream msg;
114 <<
"Found " << val.values().size()
115 <<
" values in range expected at least 3";
116 errors.addError(msg.str(), pos.file(), pos.line(), pos.column());
119 void O3PRM_CLASS_NOT_FOUND(
const O3Label& val, ErrorsContainer& errors) {
120 const auto& pos = val.position();
121 std::stringstream msg;
123 <<
"Unknown class " << val.label();
124 errors.addError(msg.str(), pos.file(), pos.line(), pos.column());
128 void O3PRM_CLASS_AMBIGUOUS(
const O3Label& val,
129 const std::vector< std::string >& matches,
130 ErrorsContainer& errors) {
131 const auto& pos = val.position();
132 std::stringstream msg;
134 <<
"Name " << val.label() <<
" is ambiguous: ";
135 for (std::size_t i = 0; i < matches.size() - 1; ++i) {
136 msg << matches[i] <<
", ";
138 msg << matches.back();
139 errors.addError(msg.str(), pos.file(), pos.line(), pos.column());
142 void O3PRM_CLASS_DUPLICATE(
const O3Label& val, ErrorsContainer& errors) {
144 const auto& pos = val.position();
145 std::stringstream msg;
147 <<
"Class name " << val.label() <<
" exists already";
148 errors.addError(msg.str(), pos.file(), pos.line(), pos.column());
151 void O3PRM_CLASS_CYLIC_INHERITANCE(
const O3Label& sub,
152 const O3Label& super,
153 ErrorsContainer& errors) {
155 const auto& pos = sub.position();
156 std::stringstream msg;
158 <<
"Cyclic inheritance between class " << sub.label() <<
" and class " 160 errors.addError(msg.str(), pos.file(), pos.line(), pos.column());
164 void O3PRM_CLASS_ATTR_IMPLEMENTATION(
const O3Label& c,
167 ErrorsContainer& errors) {
168 const auto& pos = attr.position();
169 std::stringstream msg;
171 <<
"Class " << c.label() <<
" attribute " << attr.label()
172 <<
" does not respect interface " << i.label();
173 errors.addError(msg.str(), pos.file(), pos.line(), pos.column());
176 void O3PRM_CLASS_AGG_IMPLEMENTATION(
const O3Label& c,
179 ErrorsContainer& errors) {
180 const auto& pos = attr.position();
181 std::stringstream msg;
183 <<
"Class " << c.label() <<
" aggregate " << attr.label()
184 <<
" does not respect interface " << i.label();
185 errors.addError(msg.str(), pos.file(), pos.line(), pos.column());
188 void O3PRM_CLASS_REF_IMPLEMENTATION(
const O3Label& c,
191 ErrorsContainer& errors) {
192 const auto& pos = ref.position();
193 std::stringstream msg;
195 <<
"Class " << c.label() <<
" reference " << ref.label()
196 <<
" does not respect interface " << i.label();
197 errors.addError(msg.str(), pos.file(), pos.line(), pos.column());
201 void O3PRM_CLASS_MISSING_ATTRIBUTES(
const O3Label& c,
203 ErrorsContainer& errors) {
204 const auto& pos = c.position();
205 std::stringstream msg;
207 <<
"Class " << c.label() <<
" does not implement all of interface " 208 << i.label() <<
" attributes";
209 errors.addError(msg.str(), pos.file(), pos.line(), pos.column());
212 void O3PRM_CLASS_DUPLICATE_REFERENCE(
const O3Label& ref,
213 ErrorsContainer& errors) {
214 const auto& pos = ref.position();
215 std::stringstream msg;
217 <<
"Reference Slot name " << ref.label() <<
" exists already";
218 errors.addError(msg.str(), pos.file(), pos.line(), pos.column());
221 void O3PRM_CLASS_SELF_REFERENCE(
const O3Label& c,
223 ErrorsContainer& errors) {
224 const auto& pos = ref.position();
225 std::stringstream msg;
227 <<
"Class " << c.label() <<
" cannot reference itself";
228 errors.addError(msg.str(), pos.file(), pos.line(), pos.column());
231 void O3PRM_CLASS_ILLEGAL_SUB_REFERENCE(
const O3Label& c,
233 ErrorsContainer& errors) {
234 const auto& pos = sub.position();
235 std::stringstream msg;
237 <<
"Class " << c.label() <<
" cannot reference subclass " 239 errors.addError(msg.str(), pos.file(), pos.line(), pos.column());
242 void O3PRM_CLASS_PARENT_NOT_FOUND(
const O3Label& parent,
243 ErrorsContainer& errors) {
244 const auto& pos = parent.position();
245 std::stringstream msg;
247 <<
"Parent " << parent.label() <<
" not found";
248 errors.addError(msg.str(), pos.file(), pos.line(), pos.column());
251 void O3PRM_CLASS_ILLEGAL_PARENT(
const O3Label& parent,
252 ErrorsContainer& errors) {
253 const auto& pos = parent.position();
254 std::stringstream msg;
256 <<
"Illegal parent " << parent.label();
257 errors.addError(msg.str(), pos.file(), pos.line(), pos.column());
260 void O3PRM_CLASS_LINK_NOT_FOUND(
const O3Label& chain,
261 const std::string& s,
262 ErrorsContainer& errors) {
263 const auto& pos = chain.position();
264 std::stringstream msg;
266 <<
"Link " << s <<
" in chain " << chain.label() <<
" not found";
267 errors.addError(msg.str(), pos.file(), pos.line(), pos.column());
270 void O3PRM_CLASS_ILLEGAL_CPT_SIZE(
const std::string& c,
274 ErrorsContainer& errors) {
275 const auto& pos = attr.position();
276 std::stringstream msg;
278 <<
"Illegal CPT size, expected " << expected <<
" found " << found
279 <<
" for attribute " << c <<
"." << attr.label();
280 errors.addError(msg.str(), pos.file(), pos.line(), pos.column());
283 void O3PRM_CLASS_ILLEGAL_CPT_VALUE(
const std::string& c,
286 ErrorsContainer& errors) {
287 const auto& pos = f.position();
288 std::stringstream msg;
290 <<
"Illegal CPT value \"" << f.formula().formula()
291 <<
"\" in attribute " << c <<
"." << attr.label();
293 auto result = f.formula().result();
294 msg <<
", formula resolve to " << result;
296 msg <<
", could not resolve the following formula: " 297 <<
"\"" << f.formula().formula() <<
"\"";
299 errors.addError(msg.str(), pos.file(), pos.line(), pos.column());
302 void O3PRM_CLASS_CPT_DOES_NOT_SUM_TO_1(
const std::string& c,
305 ErrorsContainer& errors) {
306 const auto& pos = attr.position();
307 std::stringstream msg;
309 <<
"PRMAttribute " << c <<
"." << attr.label()
310 <<
" CPT does not sum to 1, found " << f;
311 errors.addError(msg.str(), pos.file(), pos.line(), pos.column());
314 void O3PRM_CLASS_CPT_DOES_NOT_SUM_TO_1_WARNING(
const std::string& c,
317 ErrorsContainer& errors) {
318 const auto& pos = attr.position();
319 std::stringstream msg;
321 <<
"PRMAttribute " << c <<
"." << attr.label()
322 <<
" CPT does not sum to 1, found " << f;
323 errors.addWarning(msg.str(), pos.file(), pos.line(), pos.column());
329 ErrorsContainer& errors) {
330 const auto& pos = rule.first.front().position();
331 std::stringstream msg;
333 <<
"Expected " << expected <<
" value(s), found " << found;
334 errors.addError(msg.str(), pos.file(), pos.line(), pos.column());
338 const O3Label& label,
339 const O3Label& parent,
340 ErrorsContainer& errors) {
341 const auto& pos = label.position();
342 std::stringstream msg;
344 <<
"Label " << label <<
" is not part of " << parent <<
" domain";
345 errors.addError(msg.str(), pos.file(), pos.line(), pos.column());
348 void O3PRM_CLASS_WRONG_PARENT(
const O3Label& prnt, ErrorsContainer& errors) {
349 const auto& pos = prnt.position();
350 std::stringstream msg;
352 <<
"Illegal parent " << prnt;
353 errors.addError(msg.str(), pos.file(), pos.line(), pos.column());
356 void O3PRM_CLASS_WRONG_PARENT_TYPE(
const O3Label& prnt,
357 const std::string& expected,
358 const std::string& found,
359 ErrorsContainer& errors) {
360 const auto& pos = prnt.position();
361 std::stringstream msg;
363 <<
"Expected type " << expected <<
" for parent " << prnt.label()
364 <<
", found " << found;
365 errors.addError(msg.str(), pos.file(), pos.line(), pos.column());
368 void O3PRM_CLASS_ILLEGAL_OVERLOAD(
const O3Label& elt,
370 ErrorsContainer& errors) {
371 const auto& pos = elt.position();
372 std::stringstream msg;
374 <<
"Illegal overload of element " << elt.label() <<
" from class " 376 errors.addError(msg.str(), pos.file(), pos.line(), pos.column());
379 void O3PRM_CLASS_AGG_PARAMETERS(
const O3Label& agg,
382 ErrorsContainer& errors) {
383 const auto& pos = agg.position();
384 std::stringstream msg;
386 <<
"Expected " << expected <<
" parameters " 387 <<
", found " << found;
388 errors.addError(msg.str(), pos.file(), pos.line(), pos.column());
391 void O3PRM_CLASS_AGG_PARAMETER_NOT_FOUND(
const O3Label& agg,
392 const O3Label& param,
393 ErrorsContainer& errors) {
394 const auto& pos = param.position();
395 std::stringstream msg;
397 <<
"Parameter " << param.label() <<
" in aggregate " << agg.label()
398 <<
" does not match any expected values";
399 errors.addError(msg.str(), pos.file(), pos.line(), pos.column());
402 void O3PRM_INTERFACE_ILLEGAL_ARRAY(
const O3Label& val,
403 ErrorsContainer& errors) {
404 const auto& pos = val.position();
405 std::stringstream msg;
407 <<
"PRMAttribute " << val.label() <<
" can not be an array";
408 errors.addError(msg.str(), pos.file(), pos.line(), pos.column());
411 void O3PRM_INTERFACE_NOT_FOUND(
const O3Label& val, ErrorsContainer& errors) {
412 const auto& pos = val.position();
413 std::stringstream msg;
415 <<
"Interface " << val.label() <<
" not found";
416 errors.addError(msg.str(), pos.file(), pos.line(), pos.column());
419 void O3PRM_INTERFACE_AMBIGUOUS(
const O3Label& val,
420 const std::vector< std::string >& matches,
421 ErrorsContainer& errors) {
422 const auto& pos = val.position();
423 std::stringstream msg;
425 <<
"Name " << val.label() <<
" is ambiguous: ";
426 for (std::size_t i = 0; i < matches.size() - 1; ++i) {
427 msg << matches[i] <<
", ";
429 msg << matches.back();
430 errors.addError(msg.str(), pos.file(), pos.line(), pos.column());
433 void O3PRM_INTERFACE_DUPLICATE(
const O3Label& val, ErrorsContainer& errors) {
434 const auto& pos = val.position();
435 std::stringstream msg;
437 <<
"Interface name " << val.label() <<
" exists already";
438 errors.addError(msg.str(), pos.file(), pos.line(), pos.column());
441 void O3PRM_INTERFACE_DUPLICATE_ELEMENT(
const O3InterfaceElement& elt,
442 ErrorsContainer& errors) {
443 const auto& pos = elt.type().position();
444 std::stringstream msg;
446 <<
"Element " << elt.name().label() <<
" already exists";
447 errors.addError(msg.str(), pos.file(), pos.line(), pos.column());
450 void O3PRM_INTERFACE_CYCLIC_INHERITANCE(
const O3Label& sub,
451 const O3Label& super,
452 ErrorsContainer& errors) {
453 const auto& pos = super.position();
454 std::stringstream msg;
456 <<
"Cyclic inheritance between interface " << sub.label()
457 <<
" and interface " << super.label();
458 errors.addError(msg.str(), pos.file(), pos.line(), pos.column());
461 void O3PRM_INTERFACE_SELF_REFERENCE(
const O3Interface& i,
462 const O3InterfaceElement& r,
463 ErrorsContainer& errors) {
464 const auto& pos = r.type().position();
465 std::stringstream msg;
467 <<
"Interface " << i.name().label() <<
" cannot reference itself";
468 errors.addError(msg.str(), pos.file(), pos.line(), pos.column());
471 void O3PRM_INTERFACE_ILLEGAL_SUB_REFERENCE(
const O3Interface& i,
472 const O3InterfaceElement& ref,
473 ErrorsContainer& errors) {
474 const auto& pos = ref.type().position();
475 std::stringstream msg;
477 <<
"Interface " << i.name().label()
478 <<
" cannot reference subinterface " << ref.type().label();
479 errors.addError(msg.str(), pos.file(), pos.line(), pos.column());
482 void O3PRM_INTERFACE_ILLEGAL_OVERLOAD(
const O3InterfaceElement& elt,
483 ErrorsContainer& errors) {
484 const auto& pos = elt.type().position();
485 std::stringstream msg;
487 <<
"Illegal overload of element " << elt.name().label();
488 errors.addError(msg.str(), pos.file(), pos.line(), pos.column());
491 void O3PRM_REFERENCE_NOT_FOUND(
const O3Label& val, ErrorsContainer& errors) {
492 const auto& pos = val.position();
493 std::stringstream msg;
495 <<
"Reference Slot type " << val.label() <<
" not found";
496 errors.addError(msg.str(), pos.file(), pos.line(), pos.column());
499 void O3PRM_REFERENCE_AMBIGUOUS(
const O3Label& val,
500 const std::vector< std::string >& matches,
501 ErrorsContainer& errors) {
502 const auto& pos = val.position();
503 std::stringstream msg;
505 <<
"Name " << val.label() <<
" is ambiguous: ";
506 for (std::size_t i = 0; i < matches.size() - 1; ++i) {
507 msg << matches[i] <<
", ";
509 msg << matches.back();
510 errors.addError(msg.str(), pos.file(), pos.line(), pos.column());
513 void O3PRM_SYSTEM_INSTANTIATION_FAILED(
const O3System& sys,
514 ErrorsContainer& errors) {
515 const auto& pos = sys.name().position();
516 std::stringstream msg;
518 <<
"Could not instantiate the system, some reference slots must be " 520 errors.addError(msg.str(), pos.file(), pos.line(), pos.column());
523 void O3PRM_SYSTEM_NOT_A_CLASS(
const O3Instance& i, ErrorsContainer& errors) {
524 const auto& pos = i.type().position();
525 std::stringstream msg;
526 msg <<
"Error : " << i.type().label() <<
" is not a class";
527 errors.addError(msg.str(), pos.file(), pos.line(), pos.column());
530 void O3PRM_SYSTEM_DUPLICATE_INSTANCE(
const O3Instance& i,
531 ErrorsContainer& errors) {
532 const auto& pos = i.type().position();
533 std::stringstream msg;
535 <<
"Instance " << i.name().label() <<
" already exists";
536 errors.addError(msg.str(), pos.file(), pos.line(), pos.column());
539 void O3PRM_SYSTEM_NOT_A_PARAMETER(
const O3InstanceParameter& param,
540 ErrorsContainer& errors) {
541 const auto& pos = param.name().position();
542 std::stringstream msg;
543 msg <<
"Instance error : " << param.name().label()
544 <<
" is not a parameter";
545 errors.addError(msg.str(), pos.file(), pos.line(), pos.column());
548 void O3PRM_SYSTEM_PARAMETER_NOT_FOUND(
const O3InstanceParameter& param,
549 ErrorsContainer& errors) {
550 const auto& pos = param.name().position();
551 std::stringstream msg;
553 <<
"Parameter " << param.name().label() <<
" not found";
554 errors.addError(msg.str(), pos.file(), pos.line(), pos.column());
557 void O3PRM_SYSTEM_PARAMETER_NOT_INT(
const O3InstanceParameter& param,
558 ErrorsContainer& errors) {
559 const auto& pos = param.value().position();
560 std::stringstream msg;
562 <<
"Parameter " << param.name().label() <<
" is an integer";
563 errors.addError(msg.str(), pos.file(), pos.line(), pos.column());
566 void O3PRM_SYSTEM_PARAMETER_NOT_FLOAT(
const O3InstanceParameter& param,
567 ErrorsContainer& errors) {
568 const auto& pos = param.value().position();
569 std::stringstream msg;
571 <<
"Parameter " << param.name().label() <<
" is a float";
572 errors.addError(msg.str(), pos.file(), pos.line(), pos.column());
575 void O3PRM_SYSTEM_INVALID_LEFT_VALUE(
const O3Label& val,
576 ErrorsContainer& errors) {
577 const auto& pos = val.position();
578 std::stringstream msg;
580 <<
"Invalid left expression " << val.label();
581 errors.addError(msg.str(), pos.file(), pos.line(), pos.column());
584 void O3PRM_SYSTEM_INSTANCE_NOT_FOUND(
const O3Label& i,
585 ErrorsContainer& errors) {
586 const auto& pos = i.position();
587 std::stringstream msg;
589 <<
"Instance " << i.label() <<
" not found";
590 errors.addError(msg.str(), pos.file(), pos.line(), pos.column());
593 void O3PRM_SYSTEM_REFERENCE_NOT_FOUND(
const O3Label& ref,
594 const std::string& type,
595 ErrorsContainer& errors) {
596 const auto& pos = ref.position();
597 std::stringstream msg;
599 <<
"Reference " << ref.label() <<
" not found in class " << type;
600 errors.addError(msg.str(), pos.file(), pos.line(), pos.column());
603 void O3PRM_SYSTEM_NOT_AN_ARRAY(
const O3Label& val, ErrorsContainer& errors) {
604 const auto& pos = val.position();
605 std::stringstream msg;
606 msg <<
"Error : " << val.label() <<
" is not an array";
607 errors.addError(msg.str(), pos.file(), pos.line(), pos.column());
610 void O3PRM_DEPRECATED_TYPE_WARNING(
const O3Label& val,
611 ErrorsContainer& errors) {
612 const auto& pos = val.position();
613 std::stringstream msg;
614 msg <<
"Warning : " << val.label()
615 <<
" is declared using a deprecated syntax.";
616 errors.addWarning(msg.str(), pos.file(), pos.line(), pos.column());
624 #endif // DOXYGEN_SHOULD_SKIP_THIS std::pair< O3LabelList, O3FormulaList > O3Rule
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
std::size_t Size
In aGrUM, hashed values are unsigned long int.
#define GUM_ERROR(type, msg)