DiagnosticBase.inc 1.2 KB

1234567891011121314151617181920212223242526272829303132333435
  1. // Define the diagnostic mappings.
  2. class DiagMapping;
  3. def MAP_IGNORE : DiagMapping;
  4. def MAP_WARNING : DiagMapping;
  5. def MAP_ERROR : DiagMapping;
  6. def MAP_FATAL : DiagMapping;
  7. // Define the diagnostic classes.
  8. class DiagClass;
  9. def CLASS_NOTE : DiagClass;
  10. def CLASS_WARNING : DiagClass;
  11. def CLASS_EXTENSION : DiagClass;
  12. def CLASS_ERROR : DiagClass;
  13. class DiagGroup<string Name, list<DiagGroup> subgroups = []> {
  14. string GroupName = Name;
  15. list<DiagGroup> SubGroups = subgroups;
  16. string CategoryName = "";
  17. }
  18. class InGroup<DiagGroup G> { DiagGroup Group = G; }
  19. // All diagnostics emitted by the compiler are an indirect subclass of this.
  20. class Diagnostic<string text, DiagClass DC, DiagMapping defaultmapping> {
  21. string Text = text;
  22. DiagClass Class = DC;
  23. DiagMapping DefaultMapping = defaultmapping;
  24. DiagGroup Group;
  25. string CategoryName = "";
  26. }
  27. class Error<string str> : Diagnostic<str, CLASS_ERROR, MAP_ERROR>;
  28. class Warning<string str> : Diagnostic<str, CLASS_WARNING, MAP_WARNING>;
  29. class Extension<string str> : Diagnostic<str, CLASS_EXTENSION, MAP_IGNORE>;
  30. class ExtWarn<string str> : Diagnostic<str, CLASS_EXTENSION, MAP_WARNING>;
  31. class Note<string str> : Diagnostic<str, CLASS_NOTE, MAP_FATAL/*ignored*/>;