ANTLR Parse listener implementations
(recognizer antlr.Recognizer, offendingSymbol any, line, column int, msg string, e antlr.RecognitionException)
| 910 | |
| 911 | // ANTLR Parse listener implementations |
| 912 | func (p *parser) SyntaxError(recognizer antlr.Recognizer, offendingSymbol any, line, column int, msg string, e antlr.RecognitionException) { |
| 913 | offset := p.helper.sourceInfo.ComputeOffset(int32(line), int32(column)) |
| 914 | l := p.helper.getLocationByOffset(offset) |
| 915 | // Hack to keep existing error messages consistent with previous versions of CEL when a reserved word |
| 916 | // is used as an identifier. This behavior needs to be overhauled to provide consistent, normalized error |
| 917 | // messages out of ANTLR to prevent future breaking changes related to error message content. |
| 918 | if strings.Contains(msg, "no viable alternative") { |
| 919 | msg = reservedIdentifier.ReplaceAllString(msg, mismatchedReservedIdentifier) |
| 920 | } |
| 921 | // Ensure that no more than 100 syntax errors are reported as this will halt attempts to recover from a |
| 922 | // seriously broken expression. |
| 923 | if p.errorReports < p.errorReportingLimit { |
| 924 | p.errorReports++ |
| 925 | p.errors.syntaxError(l, msg) |
| 926 | } else { |
| 927 | tme := &tooManyErrors{errorReportingLimit: p.errorReportingLimit} |
| 928 | p.errors.syntaxError(l, tme.Error()) |
| 929 | panic(tme) |
| 930 | } |
| 931 | } |
| 932 | |
| 933 | func (p *parser) ReportAmbiguity(recognizer antlr.Parser, dfa *antlr.DFA, startIndex, stopIndex int, exact bool, ambigAlts *antlr.BitSet, configs *antlr.ATNConfigSet) { |
| 934 | // Intentional |
nothing calls this directly
no test coverage detected