diagnostics

package
v2.0.0-alpha.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 27, 2026 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SyntaxError   diagnostics.Kind = "SyntaxError"
	NameError     diagnostics.Kind = "NameError"
	SemanticError diagnostics.Kind = "SemanticError"
)

Variables

This section is empty.

Functions

func AnalyzeSyntaxError

func AnalyzeSyntaxError(src *file.Source, err *diagnostics.Diagnostic, offending *TokenNode) bool

func NewEmptyQueryError

func NewEmptyQueryError(src *file.Source) *diagnostics.Diagnostic

func NewError

func NewError(src *file.Source, kind diagnostics.Kind, message string) *diagnostics.Diagnostic

func NewErrorListener

func NewErrorListener(src *file.Source, handler *ErrorHandler, history *TokenHistory) antlr.ErrorListener

func NewTrackingTokenStream

func NewTrackingTokenStream(stream antlr.TokenStream, history *TokenHistory) antlr.TokenStream

func NewUnexpectedError

func NewUnexpectedError(src *file.Source, message string) *diagnostics.Diagnostic

func NewUnexpectedErrorWith

func NewUnexpectedErrorWith(src *file.Source, message string, cause error) *diagnostics.Diagnostic

func SpanFromRuleContext

func SpanFromRuleContext(ctx antlr.ParserRuleContext) file.Span

func SpanFromToken

func SpanFromToken(tok antlr.Token) file.Span

Types

type ErrorHandler

type ErrorHandler struct {
	// contains filtered or unexported fields
}

func NewErrorHandler

func NewErrorHandler(src *file.Source, threshold int) *ErrorHandler

func (*ErrorHandler) Add

func (h *ErrorHandler) Add(err *diagnostics.Diagnostic)

func (*ErrorHandler) Create

func (*ErrorHandler) DuplicateMatchBinding

func (h *ErrorHandler) DuplicateMatchBinding(ctx antlr.ParserRuleContext, name string)

func (*ErrorHandler) Errors

func (*ErrorHandler) HasErrorOnLine

func (h *ErrorHandler) HasErrorOnLine(line int) bool

func (*ErrorHandler) HasErrors

func (h *ErrorHandler) HasErrors() bool

func (*ErrorHandler) InvalidRegexExpression

func (h *ErrorHandler) InvalidRegexExpression(ctx antlr.ParserRuleContext, expression string)

func (*ErrorHandler) InvalidToken

func (h *ErrorHandler) InvalidToken(token antlr.Token)

func (*ErrorHandler) MissingReturnValue

func (h *ErrorHandler) MissingReturnValue(ctx antlr.ParserRuleContext)

func (*ErrorHandler) Unwrap

func (h *ErrorHandler) Unwrap() error

func (*ErrorHandler) VariableNotFound

func (h *ErrorHandler) VariableNotFound(token antlr.Token, name string)

func (*ErrorHandler) VariableNotUnique

func (h *ErrorHandler) VariableNotUnique(ctx antlr.ParserRuleContext, name string)

type ErrorListener

type ErrorListener struct {
	*antlr.DiagnosticErrorListener
	// contains filtered or unexported fields
}

func (*ErrorListener) ReportAmbiguity

func (d *ErrorListener) ReportAmbiguity(recognizer antlr.Parser, dfa *antlr.DFA, startIndex, stopIndex int, exact bool, ambigAlts *antlr.BitSet, configs *antlr.ATNConfigSet)

func (*ErrorListener) ReportAttemptingFullContext

func (d *ErrorListener) ReportAttemptingFullContext(recognizer antlr.Parser, dfa *antlr.DFA, startIndex, stopIndex int, conflictingAlts *antlr.BitSet, configs *antlr.ATNConfigSet)

func (*ErrorListener) ReportContextSensitivity

func (d *ErrorListener) ReportContextSensitivity(recognizer antlr.Parser, dfa *antlr.DFA, startIndex, stopIndex, prediction int, configs *antlr.ATNConfigSet)

func (*ErrorListener) SyntaxError

func (d *ErrorListener) SyntaxError(_ antlr.Recognizer, offendingSymbol interface{}, line, column int, msg string, e antlr.RecognitionException)

type SyntaxErrorMatcher

type SyntaxErrorMatcher func(src *file.Source, err *diagnostics.Diagnostic, offending *TokenNode) bool

type TokenHistory

type TokenHistory struct {
	// contains filtered or unexported fields
}

func NewTokenHistory

func NewTokenHistory(cap int) *TokenHistory

func (*TokenHistory) Add

func (h *TokenHistory) Add(token antlr.Token)

func (*TokenHistory) Iterate

func (h *TokenHistory) Iterate(yield func(token antlr.Token) bool)

func (*TokenHistory) Last

func (h *TokenHistory) Last() *TokenNode

func (*TokenHistory) Size

func (h *TokenHistory) Size() int

type TokenNode

type TokenNode struct {
	// contains filtered or unexported fields
}

func (*TokenNode) GetText

func (t *TokenNode) GetText() string

func (*TokenNode) Next

func (t *TokenNode) Next() *TokenNode

func (*TokenNode) NextAt

func (t *TokenNode) NextAt(n int) *TokenNode

func (*TokenNode) Prev

func (t *TokenNode) Prev() *TokenNode

func (*TokenNode) PrevAt

func (t *TokenNode) PrevAt(n int) *TokenNode

func (*TokenNode) String

func (t *TokenNode) String() string

func (*TokenNode) Token

func (t *TokenNode) Token() antlr.Token

type TrackingTokenStream

type TrackingTokenStream struct {
	antlr.TokenStream
	// contains filtered or unexported fields
}

func (*TrackingTokenStream) Consume

func (s *TrackingTokenStream) Consume()

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL