github.com/MontFerret/ferret@v0.18.0/pkg/compiler/listener.go (about) 1 package compiler 2 3 import ( 4 "github.com/antlr/antlr4/runtime/Go/antlr/v4" 5 "github.com/pkg/errors" 6 ) 7 8 type errorListener struct { 9 *antlr.DiagnosticErrorListener 10 } 11 12 func newErrorListener() *errorListener { 13 return &errorListener{ 14 antlr.NewDiagnosticErrorListener(false), 15 } 16 } 17 18 func (d *errorListener) ReportAttemptingFullContext(_ antlr.Parser, _ *antlr.DFA, _, _ int, _ *antlr.BitSet, _ antlr.ATNConfigSet) { 19 } 20 21 func (d *errorListener) ReportContextSensitivity(_ antlr.Parser, _ *antlr.DFA, _, _, _ int, _ antlr.ATNConfigSet) { 22 } 23 24 func (d *errorListener) SyntaxError(_ antlr.Recognizer, _ interface{}, line, column int, msg string, _ antlr.RecognitionException) { 25 panic(errors.Errorf("%s at %d:%d", msg, line, column)) 26 }