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