blob: 28154e2e546ec6448599257c602cf23c826ab3c2 (
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
|
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 (
semErrMDInvalidName = newSemanticError("invalid meta data name")
semErrMDInvalidParam = newSemanticError("invalid parameter")
semErrUnusedProduction = newSemanticError("unused production")
semErrUnusedTerminal = newSemanticError("unused terminal")
semErrTermCannotBeSkipped = newSemanticError("a terminal used in productions cannot be skipped")
semErrNoProduction = newSemanticError("a grammar needs at least one production")
semErrUndefinedSym = newSemanticError("undefined symbol")
semErrDuplicateProduction = newSemanticError("duplicate production")
semErrDuplicateTerminal = newSemanticError("duplicate terminal")
semErrDuplicateName = newSemanticError("duplicate names are not allowed between terminals and non-terminals")
semErrDirInvalidName = newSemanticError("invalid directive name")
semErrDirInvalidParam = newSemanticError("invalid parameter")
)
|