Documentation
¶
Overview ¶
Package errtoken contains standard diagnostics involving tokens, usually emitted by the lexer.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ImpureString ¶
ImpureString diagnoses a string literal that probably should not contain escapes or concatenation.
func (ImpureString) Diagnose ¶
func (e ImpureString) Diagnose(d *report.Diagnostic)
Diagnose implements report.Diagnose.
type InvalidEscape ¶
type InvalidEscape struct {
Span source.Span // The span of the offending escape within a literal.
}
InvalidEscape diagnoses an invalid escape sequence within a string literal.
func (InvalidEscape) Diagnose ¶
func (e InvalidEscape) Diagnose(d *report.Diagnostic)
Diagnose implements report.Diagnose.
type InvalidNumber ¶
errInvalidNumber diagnoses a numeric literal with invalid syntax.
func (InvalidNumber) Diagnose ¶
func (e InvalidNumber) Diagnose(d *report.Diagnostic)
Diagnose implements report.Diagnose.
type Unexpected ¶
type Unexpected struct {
// The unexpected thing (may be a token or AST node).
What source.Spanner
// The context we're in. Should be format-able with %v.
Where taxa.Place
// Useful when where is an "after" position: if non-nil, this will be
// highlighted as "previous where.Object is here"
Prev source.Spanner
// What we wanted vs. what we got. Got can be used to customize what gets
// shown, but if it's not set, we call describe(what) to get a user-visible
// description.
Want taxa.Set
// If set and want is empty, the snippet will repeat the "unexpected foo"
// text under the snippet.
RepeatUnexpected bool
Got any
// If nonempty, inserting this text will be suggested at the given offset.
Insert string
InsertAt int
InsertJustify just.Kind
Stream *token.Stream
}
Unexpected is a low-level parser error for when we hit a token we don't know how to handle.
func UnexpectedEOF ¶
func UnexpectedEOF(c *token.Cursor, where taxa.Place) Unexpected
UnexpectedEOF is a helper for constructing EOF diagnostics that need to provide *no* suggestions. This is used in places where any suggestion we could provide would be nonsensical.
func (Unexpected) Diagnose ¶
func (e Unexpected) Diagnose(d *report.Diagnostic)
type Unmatched ¶
type Unmatched struct {
Span source.Span // The offending delimiter.
Keyword keyword.Keyword
// If present, this indicates that we did match with another brace delimiter, but it
// was of the wrong kind
Mismatch source.Span
// If present, this is a brace delimiter we think we *should* have matched.
ShouldMatch source.Span
}
Unmatched diagnoses a delimiter for which we found one half of a matched delimiter but not the other.
func (Unmatched) Diagnose ¶
func (e Unmatched) Diagnose(d *report.Diagnostic)
Diagnose implements report.Diagnose.