aboutsummaryrefslogtreecommitdiff
path: root/grammar/semantic_error.go
blob: ca84cf08a5b705857162da02cfd25d3599be9b42 (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
package grammar

type SemanticError struct {
	message string
}

func newSemanticError(message string) *SemanticError {
	return &SemanticError{
		message: message,
	}
}

func (e *SemanticError) Error() string {
	return e.message
}

var (
	semErrNoProduction        = newSemanticError("a grammar needs at least one production")
	semErrUndefinedSym        = newSemanticError("undefined symbol")
	semErrDuplicateProduction = newSemanticError("duplicate production")
	semErrDuplicateSym        = newSemanticError("duplicate symbol")
	semErrDirInvalidName      = newSemanticError("invalid directive name")
	semErrDirInvalidParam     = newSemanticError("invalid parameter")
)