2018-09-18 16:42:38 -04:00
|
|
|
package compiler
|
|
|
|
|
|
|
|
import (
|
|
|
|
"github.com/antlr/antlr4/runtime/Go/antlr"
|
|
|
|
"github.com/pkg/errors"
|
|
|
|
)
|
|
|
|
|
|
|
|
type errorListener struct {
|
2021-07-13 21:34:22 -04:00
|
|
|
*antlr.DiagnosticErrorListener
|
|
|
|
}
|
|
|
|
|
|
|
|
func newErrorListener() *errorListener {
|
|
|
|
return &errorListener{
|
|
|
|
antlr.NewDiagnosticErrorListener(false),
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
func (d *errorListener) ReportAttemptingFullContext(_ antlr.Parser, _ *antlr.DFA, _, _ int, _ *antlr.BitSet, _ antlr.ATNConfigSet) {
|
|
|
|
}
|
|
|
|
|
|
|
|
func (d *errorListener) ReportContextSensitivity(_ antlr.Parser, _ *antlr.DFA, _, _, _ int, _ antlr.ATNConfigSet) {
|
2018-09-18 16:42:38 -04:00
|
|
|
}
|
|
|
|
|
2018-10-05 17:20:48 -04:00
|
|
|
func (d *errorListener) SyntaxError(_ antlr.Recognizer, _ interface{}, line, column int, msg string, _ antlr.RecognitionException) {
|
2018-09-18 16:42:38 -04:00
|
|
|
panic(errors.Errorf("%s at %d:%d", msg, line, column))
|
|
|
|
}
|