-
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy patherrors.go
More file actions
51 lines (43 loc) · 1.11 KB
/
errors.go
File metadata and controls
51 lines (43 loc) · 1.11 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
// Copyright 2026 TypeFox GmbH
// This program and the accompanying materials are made available under the
// terms of the MIT License, which is available in the project root.
package fastbelt
type ReferenceError struct {
Msg string
Severity int
}
func (e *ReferenceError) Error() string {
return e.Msg
}
func NewReferenceError(msg string) *ReferenceError {
return &ReferenceError{Msg: msg, Severity: 1}
}
type ParserError struct {
Msg string
// The token this error is associated with.
// `nil` if the error is due to EOF.
Token *Token
}
func NewParserError(msg string, token *Token) *ParserError {
return &ParserError{Msg: msg, Token: token}
}
type LexerError struct {
Msg string
StartOffset int
EndOffset int
StartLine int
EndLine int
StartColumn int
EndColumn int
}
func NewLexerError(msg string, startOffset, endOffset, startLine, endLine, startColumn, endColumn int) *LexerError {
return &LexerError{
Msg: msg,
StartOffset: startOffset,
EndOffset: endOffset,
StartLine: startLine,
EndLine: endLine,
StartColumn: startColumn,
EndColumn: endColumn,
}
}