blob: e89add203e201c2c45c0fce8b1589efeff113ca8 (
plain) (
blame)
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
|
// SPDX-FileCopyrightText: 2024 Himbeer <himbeer@disroot.org>
//
// SPDX-License-Identifier: GPL-3.0-or-later
package main
import "fmt"
type errAlreadyDeclared struct {
name string
line int
}
func (e errAlreadyDeclared) Error() string {
return fmt.Sprintf("%d: redeclaration of %q\n", e.line, e.name)
}
type errUndeclared struct {
name string
isFunc bool
line int
}
func (e errUndeclared) Error() string {
kind := "variable"
if e.isFunc {
kind = "function"
}
return fmt.Sprintf("%d: undeclared %s %q\n", e.line, kind, e.name)
}
type errImmutable struct {
name string
line int
}
func (e errImmutable) Error() string {
return fmt.Sprintf("%d: cannot assign to constant %q\n", e.line, e.name)
}
|