52#ifndef DOXYGEN_SHOULD_SKIP_THIS
58 void O3PRM_TYPE_NOT_FOUND(
const O3Label& val, ErrorsContainer& errors) {
59 auto pos = val.position();
60 errors.addError(std::format(
"Error : Unknown type {}", val.label()),
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::string matchList;
71 for (std::size_t i = 0; i < matches.size() - 1; ++i) {
72 matchList += matches[i] +
", ";
74 matchList += matches.back();
76 std::format(
"Error : Ambiguous name {}, found more than one elligible types: {}",
84 void O3PRM_TYPE_RESERVED(
const O3Label& val, ErrorsContainer& errors) {
85 const auto& pos = val.position();
86 errors.addError(std::format(
"Error : Type name {} is reserved", val.label()),
92 void O3PRM_TYPE_DUPPLICATE(
const O3Label& val, ErrorsContainer& errors) {
93 const auto& pos = val.position();
94 errors.addError(std::format(
"Error : Type {} exists already", val.label()),
100 void O3PRM_TYPE_CYCLIC_INHERITANCE(
const O3Label& sub_type,
102 ErrorsContainer& errors) {
103 const auto& pos = sub_type.position();
104 errors.addError(std::format(
"Error : Cyclic inheritance between type {} and type {}",
113 O3PRM_TYPE_UNKNOWN_LABEL(
const O3Label& type,
const O3Label& l, ErrorsContainer& errors) {
114 const auto& pos = l.position();
115 errors.addError(std::format(
"Error : Unknown label {} in {}", l.label(), type.label()),
121 void O3PRM_TYPE_INVALID_RANGE(
const O3IntType& val, ErrorsContainer& errors) {
122 const auto& pos = val.position();
124 std::format(
"Error : Invalid range {} -> {}", val.start().value(), val.end().value()),
130 void O3PRM_TYPE_INVALID_RANGE(
const O3RealType& val, ErrorsContainer& errors) {
131 const auto& pos = val.position();
132 errors.addError(std::format(
"Error : Found {} values in range expected at least 3",
133 val.values().size()),
139 void O3PRM_CLASS_NOT_FOUND(
const O3Label& val, ErrorsContainer& errors) {
140 const auto& pos = val.position();
141 const auto msg = std::format(
"Error : Unknown class {}", val.label());
142 errors.addError(msg, pos.file(), pos.line(), pos.column());
146 void O3PRM_CLASS_AMBIGUOUS(
const O3Label& val,
147 const std::vector< std::string >& matches,
148 ErrorsContainer& errors) {
149 const auto& pos = val.position();
150 std::string matchList;
151 for (std::size_t i = 0; i < matches.size() - 1; ++i) {
152 matchList += matches[i] +
", ";
154 matchList += matches.back();
155 errors.addError(std::format(
"Error : Name {} is ambiguous: {}", val.label(), matchList),
161 void O3PRM_CLASS_DUPLICATE(
const O3Label& val, ErrorsContainer& errors) {
163 const auto& pos = val.position();
164 errors.addError(std::format(
"Error : Class name {} exists already", val.label()),
170 void O3PRM_CLASS_CYLIC_INHERITANCE(
const O3Label& sub,
172 ErrorsContainer& errors) {
174 const auto& pos = sub.position();
175 errors.addError(std::format(
"Error : Cyclic inheritance between class {} and class {}",
183 void O3PRM_CLASS_ATTR_IMPLEMENTATION(
const O3Label& c,
186 ErrorsContainer& errors) {
187 const auto& pos = attr.position();
188 errors.addError(std::format(
"Error : Class {} attribute {} does not respect interface {}",
197 void O3PRM_CLASS_AGG_IMPLEMENTATION(
const O3Label& c,
200 ErrorsContainer& errors) {
201 const auto& pos = attr.position();
202 errors.addError(std::format(
"Error : Class {} aggregate {} does not respect interface {}",
211 void O3PRM_CLASS_REF_IMPLEMENTATION(
const O3Label& c,
214 ErrorsContainer& errors) {
215 const auto& pos = ref.position();
216 errors.addError(std::format(
"Error : Class {} reference {} does not respect interface {}",
225 void O3PRM_CLASS_MISSING_ATTRIBUTES(
const O3Label& c,
227 ErrorsContainer& errors) {
228 const auto& pos = c.position();
230 std::format(
"Error : Class {} does not implement all of interface {} attributes",
238 void O3PRM_CLASS_DUPLICATE_REFERENCE(
const O3Label& ref, ErrorsContainer& errors) {
239 const auto& pos = ref.position();
240 errors.addError(std::format(
"Error : Reference Slot name {} exists already", ref.label()),
246 void O3PRM_CLASS_SELF_REFERENCE(
const O3Label& c,
248 ErrorsContainer& errors) {
249 const auto& pos = ref.position();
250 errors.addError(std::format(
"Error : Class {} cannot reference itself", c.label()),
256 void O3PRM_CLASS_ILLEGAL_SUB_REFERENCE(
const O3Label& c,
258 ErrorsContainer& errors) {
259 const auto& pos = sub.position();
261 std::format(
"Error : Class {} cannot reference subclass {}", c.label(), sub.label()),
267 void O3PRM_CLASS_PARENT_NOT_FOUND(
const O3Label& parent, ErrorsContainer& errors) {
268 const auto& pos = parent.position();
269 errors.addError(std::format(
"Error : Parent {} not found", parent.label()),
275 void O3PRM_CLASS_ILLEGAL_PARENT(
const O3Label& parent, ErrorsContainer& errors) {
276 const auto& pos = parent.position();
277 errors.addError(std::format(
"Error : Illegal parent {}", parent.label()),
283 void O3PRM_CLASS_LINK_NOT_FOUND(
const O3Label& chain,
285 ErrorsContainer& errors) {
286 const auto& pos = chain.position();
287 errors.addError(std::format(
"Error : Link {} in chain {} not found", s, chain.label()),
293 void O3PRM_CLASS_ILLEGAL_CPT_SIZE(std::string_view c,
297 ErrorsContainer& errors) {
298 const auto& pos = attr.position();
300 std::format(
"Error : Illegal CPT size, expected {} found {} for attribute {}.{}",
310 void O3PRM_CLASS_ILLEGAL_CPT_VALUE(std::string_view c,
313 ErrorsContainer& errors) {
314 const auto& pos = f.position();
315 auto msg = std::format(
"Error : Illegal CPT value \"{}\" in attribute {}.{}",
316 f.formula().formula(),
320 auto result = f.formula().result();
321 msg += std::format(
", formula resolve to {}", result);
323 msg += std::format(
", could not resolve the following formula: \"{}\"",
324 f.formula().formula());
326 errors.addError(msg, pos.file(), pos.line(), pos.column());
329 void O3PRM_CLASS_CPT_DOES_NOT_SUM_TO_1(std::string_view c,
332 ErrorsContainer& errors) {
333 const auto& pos = attr.position();
334 errors.addError(std::format(
"Error : PRMAttribute {}.{} CPT does not sum to 1, found {}",
343 void O3PRM_CLASS_CPT_DOES_NOT_SUM_TO_1_WARNING(std::string_view c,
346 ErrorsContainer& errors) {
347 const auto& pos = attr.position();
349 std::format(
"Warning : PRMAttribute {}.{} CPT does not sum to 1, found {}",
361 ErrorsContainer& errors) {
362 const auto& pos = rule.first.front().position();
363 errors.addError(std::format(
"Error : Expected {} value(s), found {}", expected, found),
372 ErrorsContainer& errors) {
373 const auto& pos = label.position();
375 std::format(
"Error : Label {} is not part of {} domain", label.label(), parent.label()),
381 void O3PRM_CLASS_WRONG_PARENT(
const O3Label& prnt, ErrorsContainer& errors) {
382 const auto& pos = prnt.position();
383 errors.addError(std::format(
"Error : Illegal parent {}", prnt.label()),
389 void O3PRM_CLASS_WRONG_PARENT_TYPE(
const O3Label& prnt,
390 std::string_view expected,
391 std::string_view found,
392 ErrorsContainer& errors) {
393 const auto& pos = prnt.position();
394 errors.addError(std::format(
"Error : Expected type {} for parent {}, found {}",
403 void O3PRM_CLASS_ILLEGAL_OVERLOAD(
const O3Label& elt,
405 ErrorsContainer& errors) {
406 const auto& pos = elt.position();
407 errors.addError(std::format(
"Error : Illegal overload of element {} from class {}",
415 void O3PRM_CLASS_AGG_PARAMETERS(
const O3Label& agg,
418 ErrorsContainer& errors) {
419 const auto& pos = agg.position();
420 errors.addError(std::format(
"Error : Expected {} parameters , found {}", expected, found),
426 void O3PRM_CLASS_AGG_PARAMETER_NOT_FOUND(
const O3Label& agg,
428 ErrorsContainer& errors) {
429 const auto& pos = param.position();
431 std::format(
"Error : Parameter {} in aggregate {} does not match any expected values",
439 void O3PRM_INTERFACE_ILLEGAL_ARRAY(
const O3Label& val, ErrorsContainer& errors) {
440 const auto& pos = val.position();
441 errors.addError(std::format(
"Error : PRMAttribute {} can not be an array", val.label()),
447 void O3PRM_INTERFACE_NOT_FOUND(
const O3Label& val, ErrorsContainer& errors) {
448 const auto& pos = val.position();
449 errors.addError(std::format(
"Error : Interface {} not found", val.label()),
455 void O3PRM_INTERFACE_AMBIGUOUS(
const O3Label& val,
456 const std::vector< std::string >& matches,
457 ErrorsContainer& errors) {
458 const auto& pos = val.position();
459 std::string matchList;
460 for (std::size_t i = 0; i < matches.size() - 1; ++i) {
461 matchList += matches[i] +
", ";
463 matchList += matches.back();
464 errors.addError(std::format(
"Error : Name {} is ambiguous: {}", val.label(), matchList),
470 void O3PRM_INTERFACE_DUPLICATE(
const O3Label& val, ErrorsContainer& errors) {
471 const auto& pos = val.position();
472 errors.addError(std::format(
"Error : Interface name {} exists already", val.label()),
479 ErrorsContainer& errors) {
480 const auto& pos = elt.type().position();
481 errors.addError(std::format(
"Error : Element {} already exists", elt.name().label()),
487 void O3PRM_INTERFACE_CYCLIC_INHERITANCE(
const O3Label& sub,
489 ErrorsContainer& errors) {
490 const auto& pos = super.position();
492 std::format(
"Error : Cyclic inheritance between interface {} and interface {}",
500 void O3PRM_INTERFACE_SELF_REFERENCE(
const O3Interface& i,
502 ErrorsContainer& errors) {
503 const auto& pos = r.type().position();
505 std::format(
"Error : Interface {} cannot reference itself", i.name().label()),
511 void O3PRM_INTERFACE_ILLEGAL_SUB_REFERENCE(
const O3Interface& i,
513 ErrorsContainer& errors) {
514 const auto& pos = ref.type().position();
515 errors.addError(std::format(
"Error : Interface {} cannot reference subinterface {}",
524 ErrorsContainer& errors) {
525 const auto& pos = elt.type().position();
526 errors.addError(std::format(
"Error : Illegal overload of element {}", elt.name().label()),
532 void O3PRM_REFERENCE_NOT_FOUND(
const O3Label& val, ErrorsContainer& errors) {
533 const auto& pos = val.position();
534 errors.addError(std::format(
"Error : Reference Slot type {} not found", val.label()),
540 void O3PRM_REFERENCE_AMBIGUOUS(
const O3Label& val,
541 const std::vector< std::string >& matches,
542 ErrorsContainer& errors) {
543 const auto& pos = val.position();
544 std::string matchList;
545 for (std::size_t i = 0; i < matches.size() - 1; ++i) {
546 matchList += matches[i] +
", ";
548 matchList += matches.back();
549 errors.addError(std::format(
"Error : Name {} is ambiguous: {}", val.label(), matchList),
555 void O3PRM_SYSTEM_INSTANTIATION_FAILED(
const O3System& sys, ErrorsContainer& errors) {
556 const auto& pos = sys.name().position();
558 std::format(
"Error : Could not instantiate the system, some reference slots must be "
565 void O3PRM_SYSTEM_NOT_A_CLASS(
const O3Instance& i, ErrorsContainer& errors) {
566 const auto& pos = i.type().position();
567 errors.addError(std::format(
"Error : {} is not a class", i.type().label()),
573 void O3PRM_SYSTEM_DUPLICATE_INSTANCE(
const O3Instance& i, ErrorsContainer& errors) {
574 const auto& pos = i.type().position();
575 errors.addError(std::format(
"Error : Instance {} already exists", i.name().label()),
581 void O3PRM_SYSTEM_NOT_A_PARAMETER(
const O3InstanceParameter& param, ErrorsContainer& errors) {
582 const auto& pos = param.name().position();
583 errors.addError(std::format(
"Instance error : {} is not a parameter", param.name().label()),
590 ErrorsContainer& errors) {
591 const auto& pos = param.name().position();
592 errors.addError(std::format(
"Error : Parameter {} not found", param.name().label()),
599 ErrorsContainer& errors) {
600 const auto& pos = param.value().position();
601 errors.addError(std::format(
"Error : Parameter {} is an integer", param.name().label()),
608 ErrorsContainer& errors) {
609 const auto& pos = param.value().position();
610 errors.addError(std::format(
"Error : Parameter {} is a float", param.name().label()),
616 void O3PRM_SYSTEM_INVALID_LEFT_VALUE(
const O3Label& val, ErrorsContainer& errors) {
617 const auto& pos = val.position();
618 errors.addError(std::format(
"Error : Invalid left expression {}", val.label()),
624 void O3PRM_SYSTEM_INSTANCE_NOT_FOUND(
const O3Label& i, ErrorsContainer& errors) {
625 const auto& pos = i.position();
626 errors.addError(std::format(
"Error : Instance {} not found", i.label()),
632 void O3PRM_SYSTEM_REFERENCE_NOT_FOUND(
const O3Label& ref,
633 std::string_view type,
634 ErrorsContainer& errors) {
635 const auto& pos = ref.position();
637 std::format(
"Error : Reference {} not found in class {}", ref.label(), type),
643 void O3PRM_SYSTEM_NOT_AN_ARRAY(
const O3Label& val, ErrorsContainer& errors) {
644 const auto& pos = val.position();
645 errors.addError(std::format(
"Error : {} is not an array", val.label()),
651 void O3PRM_DEPRECATED_TYPE_WARNING(
const O3Label& val, ErrorsContainer& errors) {
652 const auto& pos = val.position();
654 std::format(
"Warning : {} is declared using a deprecated syntax.", val.label()),
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