52#ifndef DOXYGEN_SHOULD_SKIP_THIS
58 void O3PRM_TYPE_NOT_FOUND(
const O3Label& val, ErrorsContainer& errors) {
59 auto pos = val.position();
60 std::stringstream msg;
62 <<
"Unknown type " << val.label();
63 errors.addError(msg.str(), pos.file(), pos.line(), pos.column());
66 void O3PRM_TYPE_AMBIGUOUS(
const O3Label& val,
67 const std::vector< std::string >& matches,
68 ErrorsContainer& errors) {
69 const auto& pos = val.position();
70 std::stringstream msg;
72 <<
"Ambiguous name " << val.label() <<
", found more than one elligible types: ";
73 for (std::size_t i = 0; i < matches.size() - 1; ++i) {
74 msg << matches[i] <<
", ";
76 msg << matches.back();
77 errors.addError(msg.str(), pos.file(), pos.line(), pos.column());
80 void O3PRM_TYPE_RESERVED(
const O3Label& val, ErrorsContainer& errors) {
81 const auto& pos = val.position();
82 std::stringstream msg;
84 <<
"Type name " << val.label() <<
" is reserved";
85 errors.addError(msg.str(), pos.file(), pos.line(), pos.column());
88 void O3PRM_TYPE_DUPPLICATE(
const O3Label& val, ErrorsContainer& errors) {
89 const auto& pos = val.position();
90 std::stringstream msg;
92 <<
"Type " << val.label() <<
" exists already";
93 errors.addError(msg.str(), pos.file(), pos.line(), pos.column());
96 void O3PRM_TYPE_CYCLIC_INHERITANCE(
const O3Label& sub_type,
98 ErrorsContainer& errors) {
99 const auto& pos = sub_type.position();
100 std::stringstream msg;
102 <<
"Cyclic inheritance between type " << sub_type.label() <<
" and type "
103 << super_type.label();
104 errors.addError(msg.str(), pos.file(), pos.line(), pos.column());
108 O3PRM_TYPE_UNKNOWN_LABEL(
const O3Label& type,
const O3Label& l, ErrorsContainer& errors) {
109 const auto& pos = l.position();
110 std::stringstream msg;
112 <<
"Unknown label " << l.label() <<
" in " << type.label();
113 errors.addError(msg.str(), pos.file(), pos.line(), pos.column());
116 void O3PRM_TYPE_INVALID_RANGE(
const O3IntType& val, ErrorsContainer& errors) {
117 const auto& pos = val.position();
118 std::stringstream msg;
120 <<
"Invalid range " << val.start().value() <<
" -> " << val.end().value();
121 errors.addError(msg.str(), pos.file(), pos.line(), pos.column());
124 void O3PRM_TYPE_INVALID_RANGE(
const O3RealType& val, ErrorsContainer& errors) {
125 const auto& pos = val.position();
126 std::stringstream msg;
128 <<
"Found " << val.values().size() <<
" values in range expected at least 3";
129 errors.addError(msg.str(), pos.file(), pos.line(), pos.column());
132 void O3PRM_CLASS_NOT_FOUND(
const O3Label& val, ErrorsContainer& errors) {
133 const auto& pos = val.position();
134 std::stringstream msg;
136 <<
"Unknown class " << val.label();
137 errors.addError(msg.str(), pos.file(), pos.line(), pos.column());
141 void O3PRM_CLASS_AMBIGUOUS(
const O3Label& val,
142 const std::vector< std::string >& matches,
143 ErrorsContainer& errors) {
144 const auto& pos = val.position();
145 std::stringstream msg;
147 <<
"Name " << val.label() <<
" is ambiguous: ";
148 for (std::size_t i = 0; i < matches.size() - 1; ++i) {
149 msg << matches[i] <<
", ";
151 msg << matches.back();
152 errors.addError(msg.str(), pos.file(), pos.line(), pos.column());
155 void O3PRM_CLASS_DUPLICATE(
const O3Label& val, ErrorsContainer& errors) {
157 const auto& pos = val.position();
158 std::stringstream msg;
160 <<
"Class name " << val.label() <<
" exists already";
161 errors.addError(msg.str(), pos.file(), pos.line(), pos.column());
164 void O3PRM_CLASS_CYLIC_INHERITANCE(
const O3Label& sub,
166 ErrorsContainer& errors) {
168 const auto& pos = sub.position();
169 std::stringstream msg;
171 <<
"Cyclic inheritance between class " << sub.label() <<
" and class " << super.label();
172 errors.addError(msg.str(), pos.file(), pos.line(), pos.column());
175 void O3PRM_CLASS_ATTR_IMPLEMENTATION(
const O3Label& c,
178 ErrorsContainer& errors) {
179 const auto& pos = attr.position();
180 std::stringstream msg;
182 <<
"Class " << c.label() <<
" attribute " << attr.label()
183 <<
" does not respect interface " << i.label();
184 errors.addError(msg.str(), pos.file(), pos.line(), pos.column());
187 void O3PRM_CLASS_AGG_IMPLEMENTATION(
const O3Label& c,
190 ErrorsContainer& errors) {
191 const auto& pos = attr.position();
192 std::stringstream msg;
194 <<
"Class " << c.label() <<
" aggregate " << attr.label()
195 <<
" does not respect interface " << i.label();
196 errors.addError(msg.str(), pos.file(), pos.line(), pos.column());
199 void O3PRM_CLASS_REF_IMPLEMENTATION(
const O3Label& c,
202 ErrorsContainer& errors) {
203 const auto& pos = ref.position();
204 std::stringstream msg;
206 <<
"Class " << c.label() <<
" reference " << ref.label()
207 <<
" does not respect interface " << i.label();
208 errors.addError(msg.str(), pos.file(), pos.line(), pos.column());
211 void O3PRM_CLASS_MISSING_ATTRIBUTES(
const O3Label& c,
213 ErrorsContainer& errors) {
214 const auto& pos = c.position();
215 std::stringstream msg;
217 <<
"Class " << c.label() <<
" does not implement all of interface " << i.label()
219 errors.addError(msg.str(), pos.file(), pos.line(), pos.column());
222 void O3PRM_CLASS_DUPLICATE_REFERENCE(
const O3Label& ref, ErrorsContainer& errors) {
223 const auto& pos = ref.position();
224 std::stringstream msg;
226 <<
"Reference Slot name " << ref.label() <<
" exists already";
227 errors.addError(msg.str(), pos.file(), pos.line(), pos.column());
230 void O3PRM_CLASS_SELF_REFERENCE(
const O3Label& c,
232 ErrorsContainer& errors) {
233 const auto& pos = ref.position();
234 std::stringstream msg;
236 <<
"Class " << c.label() <<
" cannot reference itself";
237 errors.addError(msg.str(), pos.file(), pos.line(), pos.column());
240 void O3PRM_CLASS_ILLEGAL_SUB_REFERENCE(
const O3Label& c,
242 ErrorsContainer& errors) {
243 const auto& pos = sub.position();
244 std::stringstream msg;
246 <<
"Class " << c.label() <<
" cannot reference subclass " << sub.label();
247 errors.addError(msg.str(), pos.file(), pos.line(), pos.column());
250 void O3PRM_CLASS_PARENT_NOT_FOUND(
const O3Label& parent, ErrorsContainer& errors) {
251 const auto& pos = parent.position();
252 std::stringstream msg;
254 <<
"Parent " << parent.label() <<
" not found";
255 errors.addError(msg.str(), pos.file(), pos.line(), pos.column());
258 void O3PRM_CLASS_ILLEGAL_PARENT(
const O3Label& parent, ErrorsContainer& errors) {
259 const auto& pos = parent.position();
260 std::stringstream msg;
262 <<
"Illegal parent " << parent.label();
263 errors.addError(msg.str(), pos.file(), pos.line(), pos.column());
266 void O3PRM_CLASS_LINK_NOT_FOUND(
const O3Label& chain,
267 const std::string& s,
268 ErrorsContainer& errors) {
269 const auto& pos = chain.position();
270 std::stringstream msg;
272 <<
"Link " << s <<
" in chain " << chain.label() <<
" not found";
273 errors.addError(msg.str(), pos.file(), pos.line(), pos.column());
276 void O3PRM_CLASS_ILLEGAL_CPT_SIZE(
const std::string& c,
280 ErrorsContainer& errors) {
281 const auto& pos = attr.position();
282 std::stringstream msg;
284 <<
"Illegal CPT size, expected " << expected <<
" found " << found <<
" for attribute "
285 << c <<
"." << attr.label();
286 errors.addError(msg.str(), pos.file(), pos.line(), pos.column());
289 void O3PRM_CLASS_ILLEGAL_CPT_VALUE(
const std::string& c,
292 ErrorsContainer& errors) {
293 const auto& pos = f.position();
294 std::stringstream msg;
296 <<
"Illegal CPT value \"" << f.formula().formula() <<
"\" in attribute " << c <<
"."
299 auto result = f.formula().result();
300 msg <<
", formula resolve to " << result;
302 msg <<
", could not resolve the following formula: "
303 <<
"\"" << f.formula().formula() <<
"\"";
305 errors.addError(msg.str(), pos.file(), pos.line(), pos.column());
308 void O3PRM_CLASS_CPT_DOES_NOT_SUM_TO_1(
const std::string& c,
311 ErrorsContainer& errors) {
312 const auto& pos = attr.position();
313 std::stringstream msg;
315 <<
"PRMAttribute " << c <<
"." << attr.label() <<
" CPT does not sum to 1, found " << f;
316 errors.addError(msg.str(), pos.file(), pos.line(), pos.column());
319 void O3PRM_CLASS_CPT_DOES_NOT_SUM_TO_1_WARNING(
const std::string& c,
322 ErrorsContainer& errors) {
323 const auto& pos = attr.position();
324 std::stringstream msg;
326 <<
"PRMAttribute " << c <<
"." << attr.label() <<
" CPT does not sum to 1, found " << f;
327 errors.addWarning(msg.str(), pos.file(), pos.line(), pos.column());
333 ErrorsContainer& errors) {
334 const auto& pos = rule.first.front().position();
335 std::stringstream msg;
337 <<
"Expected " << expected <<
" value(s), found " << found;
338 errors.addError(msg.str(), pos.file(), pos.line(), pos.column());
344 ErrorsContainer& errors) {
345 const auto& pos = label.position();
346 std::stringstream msg;
348 <<
"Label " << label <<
" is not part of " << parent <<
" domain";
349 errors.addError(msg.str(), pos.file(), pos.line(), pos.column());
352 void O3PRM_CLASS_WRONG_PARENT(
const O3Label& prnt, ErrorsContainer& errors) {
353 const auto& pos = prnt.position();
354 std::stringstream msg;
356 <<
"Illegal parent " << prnt;
357 errors.addError(msg.str(), pos.file(), pos.line(), pos.column());
360 void O3PRM_CLASS_WRONG_PARENT_TYPE(
const O3Label& prnt,
361 const std::string& expected,
362 const std::string& found,
363 ErrorsContainer& errors) {
364 const auto& pos = prnt.position();
365 std::stringstream msg;
367 <<
"Expected type " << expected <<
" for parent " << prnt.label() <<
", found "
369 errors.addError(msg.str(), pos.file(), pos.line(), pos.column());
372 void O3PRM_CLASS_ILLEGAL_OVERLOAD(
const O3Label& elt,
374 ErrorsContainer& errors) {
375 const auto& pos = elt.position();
376 std::stringstream msg;
378 <<
"Illegal overload of element " << elt.label() <<
" from class " << c.label();
379 errors.addError(msg.str(), pos.file(), pos.line(), pos.column());
382 void O3PRM_CLASS_AGG_PARAMETERS(
const O3Label& agg,
385 ErrorsContainer& errors) {
386 const auto& pos = agg.position();
387 std::stringstream msg;
389 <<
"Expected " << expected <<
" parameters "
390 <<
", found " << found;
391 errors.addError(msg.str(), pos.file(), pos.line(), pos.column());
394 void O3PRM_CLASS_AGG_PARAMETER_NOT_FOUND(
const O3Label& agg,
396 ErrorsContainer& errors) {
397 const auto& pos = param.position();
398 std::stringstream msg;
400 <<
"Parameter " << param.label() <<
" in aggregate " << agg.label()
401 <<
" does not match any expected values";
402 errors.addError(msg.str(), pos.file(), pos.line(), pos.column());
405 void O3PRM_INTERFACE_ILLEGAL_ARRAY(
const O3Label& val, ErrorsContainer& errors) {
406 const auto& pos = val.position();
407 std::stringstream msg;
409 <<
"PRMAttribute " << val.label() <<
" can not be an array";
410 errors.addError(msg.str(), pos.file(), pos.line(), pos.column());
413 void O3PRM_INTERFACE_NOT_FOUND(
const O3Label& val, ErrorsContainer& errors) {
414 const auto& pos = val.position();
415 std::stringstream msg;
417 <<
"Interface " << val.label() <<
" not found";
418 errors.addError(msg.str(), pos.file(), pos.line(), pos.column());
421 void O3PRM_INTERFACE_AMBIGUOUS(
const O3Label& val,
422 const std::vector< std::string >& matches,
423 ErrorsContainer& errors) {
424 const auto& pos = val.position();
425 std::stringstream msg;
427 <<
"Name " << val.label() <<
" is ambiguous: ";
428 for (std::size_t i = 0; i < matches.size() - 1; ++i) {
429 msg << matches[i] <<
", ";
431 msg << matches.back();
432 errors.addError(msg.str(), pos.file(), pos.line(), pos.column());
435 void O3PRM_INTERFACE_DUPLICATE(
const O3Label& val, ErrorsContainer& errors) {
436 const auto& pos = val.position();
437 std::stringstream msg;
439 <<
"Interface name " << val.label() <<
" exists already";
440 errors.addError(msg.str(), pos.file(), pos.line(), pos.column());
444 ErrorsContainer& errors) {
445 const auto& pos = elt.type().position();
446 std::stringstream msg;
448 <<
"Element " << elt.name().label() <<
" already exists";
449 errors.addError(msg.str(), pos.file(), pos.line(), pos.column());
452 void O3PRM_INTERFACE_CYCLIC_INHERITANCE(
const O3Label& sub,
454 ErrorsContainer& errors) {
455 const auto& pos = super.position();
456 std::stringstream msg;
458 <<
"Cyclic inheritance between interface " << sub.label() <<
" and interface "
460 errors.addError(msg.str(), pos.file(), pos.line(), pos.column());
463 void O3PRM_INTERFACE_SELF_REFERENCE(
const O3Interface& i,
465 ErrorsContainer& errors) {
466 const auto& pos = r.type().position();
467 std::stringstream msg;
469 <<
"Interface " << i.name().label() <<
" cannot reference itself";
470 errors.addError(msg.str(), pos.file(), pos.line(), pos.column());
473 void O3PRM_INTERFACE_ILLEGAL_SUB_REFERENCE(
const O3Interface& i,
475 ErrorsContainer& errors) {
476 const auto& pos = ref.type().position();
477 std::stringstream msg;
479 <<
"Interface " << i.name().label() <<
" cannot reference subinterface "
480 << ref.type().label();
481 errors.addError(msg.str(), pos.file(), pos.line(), pos.column());
485 ErrorsContainer& errors) {
486 const auto& pos = elt.type().position();
487 std::stringstream msg;
489 <<
"Illegal overload of element " << elt.name().label();
490 errors.addError(msg.str(), pos.file(), pos.line(), pos.column());
493 void O3PRM_REFERENCE_NOT_FOUND(
const O3Label& val, ErrorsContainer& errors) {
494 const auto& pos = val.position();
495 std::stringstream msg;
497 <<
"Reference Slot type " << val.label() <<
" not found";
498 errors.addError(msg.str(), pos.file(), pos.line(), pos.column());
501 void O3PRM_REFERENCE_AMBIGUOUS(
const O3Label& val,
502 const std::vector< std::string >& matches,
503 ErrorsContainer& errors) {
504 const auto& pos = val.position();
505 std::stringstream msg;
507 <<
"Name " << val.label() <<
" is ambiguous: ";
508 for (std::size_t i = 0; i < matches.size() - 1; ++i) {
509 msg << matches[i] <<
", ";
511 msg << matches.back();
512 errors.addError(msg.str(), pos.file(), pos.line(), pos.column());
515 void O3PRM_SYSTEM_INSTANTIATION_FAILED(
const O3System& sys, ErrorsContainer& errors) {
516 const auto& pos = sys.name().position();
517 std::stringstream msg;
519 <<
"Could not instantiate the system, some reference slots must be "
521 errors.addError(msg.str(), pos.file(), pos.line(), pos.column());
524 void O3PRM_SYSTEM_NOT_A_CLASS(
const O3Instance& i, ErrorsContainer& errors) {
525 const auto& pos = i.type().position();
526 std::stringstream msg;
527 msg <<
"Error : " << i.type().label() <<
" is not a class";
528 errors.addError(msg.str(), pos.file(), pos.line(), pos.column());
531 void O3PRM_SYSTEM_DUPLICATE_INSTANCE(
const O3Instance& i, 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, ErrorsContainer& errors) {
540 const auto& pos = param.name().position();
541 std::stringstream msg;
542 msg <<
"Instance error : " << param.name().label() <<
" is not a parameter";
543 errors.addError(msg.str(), pos.file(), pos.line(), pos.column());
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());
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());
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, ErrorsContainer& errors) {
574 const auto& pos = val.position();
575 std::stringstream msg;
577 <<
"Invalid left expression " << val.label();
578 errors.addError(msg.str(), pos.file(), pos.line(), pos.column());
581 void O3PRM_SYSTEM_INSTANCE_NOT_FOUND(
const O3Label& i, ErrorsContainer& errors) {
582 const auto& pos = i.position();
583 std::stringstream msg;
585 <<
"Instance " << i.label() <<
" not found";
586 errors.addError(msg.str(), pos.file(), pos.line(), pos.column());
589 void O3PRM_SYSTEM_REFERENCE_NOT_FOUND(
const O3Label& ref,
590 const std::string& type,
591 ErrorsContainer& errors) {
592 const auto& pos = ref.position();
593 std::stringstream msg;
595 <<
"Reference " << ref.label() <<
" not found in class " << type;
596 errors.addError(msg.str(), pos.file(), pos.line(), pos.column());
599 void O3PRM_SYSTEM_NOT_AN_ARRAY(
const O3Label& val, ErrorsContainer& errors) {
600 const auto& pos = val.position();
601 std::stringstream msg;
602 msg <<
"Error : " << val.label() <<
" is not an array";
603 errors.addError(msg.str(), pos.file(), pos.line(), pos.column());
606 void O3PRM_DEPRECATED_TYPE_WARNING(
const O3Label& val, ErrorsContainer& errors) {
607 const auto& pos = val.position();
608 std::stringstream msg;
609 msg <<
"Warning : " << val.label() <<
" is declared using a deprecated syntax.";
610 errors.addWarning(msg.str(), pos.file(), pos.line(), pos.column());
The O3InstanceParameter is part of the AST of the O3PRM language.
The O3Instance is part of the AST of the O3PRM language.
The O3IntType is part of the AST of the O3PRM language.
The O3InterfaceElement is part of the AST of the O3PRM language.
The O3Interface is part of the AST of the O3PRM language.
The O3Label is part of the AST of the O3PRM language.
The O3RealType is part of the AST of the O3PRM language.
std::pair< O3LabelList, O3FormulaList > O3Rule
The O3System is part of the AST of the O3PRM language.
Functions for error messages.
#define GUM_ERROR(type, msg)
std::size_t Size
In aGrUM, hashed values are unsigned long int.
namespace for all probabilistic relational models entities
gum is the global namespace for all aGrUM entities