-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathresult.go
More file actions
51 lines (43 loc) · 1.18 KB
/
result.go
File metadata and controls
51 lines (43 loc) · 1.18 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
package calcmark
import (
"github.com/CalcMark/go-calcmark/spec/types"
)
// Result contains the evaluation results and any diagnostics.
type Result struct {
// Value is the final computed value (for single expressions).
// For multi-line documents, this is the last value.
Value types.Type
// AllValues contains all computed values (for multi-line documents).
AllValues []types.Type
// Diagnostics contains any errors, warnings, or hints from semantic analysis.
Diagnostics []Diagnostic
}
// Diagnostic represents a semantic issue (error, warning, or hint).
type Diagnostic struct {
Severity Severity
Code string
Message string
Detailed string // Detailed explanation with context and guidance
}
// Severity indicates the severity level of a diagnostic.
type Severity int
const (
// Error indicates a blocking error that prevents interpretation.
Error Severity = iota
// Warning indicates a potential issue that doesn't block interpretation.
Warning
// Hint indicates a suggestion for improvement.
Hint
)
func (s Severity) String() string {
switch s {
case Error:
return "ERROR"
case Warning:
return "WARNING"
case Hint:
return "HINT"
default:
return "UNKNOWN"
}
}