plc_diagnostics/
reporter.rs1use plc_source::source_location::CodeSpan;
2
3use crate::diagnostics::Severity;
4
5pub mod clang;
6pub mod codespan;
7pub mod null;
8
9pub trait DiagnosticReporter {
12 fn report(&mut self, diagnostics: &[ResolvedDiagnostics]);
14 fn register(&mut self, path: String, src: String) -> usize;
18
19 fn buffer(&self) -> Option<String> {
20 None
21 }
22}
23
24#[derive(Clone, Debug, PartialEq, Eq)]
25pub struct ResolvedLocation {
26 pub file_handle: usize,
27 pub span: CodeSpan,
28}
29
30impl ResolvedLocation {
31 pub(crate) fn is_internal(&self) -> bool {
32 self.span == CodeSpan::None
33 }
34}
35
36#[derive(Clone, Debug, PartialEq, Eq)]
37pub struct ResolvedDiagnostics {
38 pub code: String,
39 pub message: String,
40 pub severity: Severity,
41 pub main_location: ResolvedLocation,
42 pub additional_locations: Option<Vec<ResolvedLocation>>,
43}