Documentation
¶
Overview ¶
Package scanner implements a scanner for Extract tokens.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Scanner ¶
type Scanner struct {
// contains filtered or unexported fields
}
Scanner produces Extract parser tokens from an io.Reader.
func New ¶
New returns a new Scanner which reads from r. The Scanner starts before the first token, so the user must call [Scan] at least once before accessing tokens.
func (*Scanner) All ¶
All returns a single-use iterator which yields all of the tokens from the scanner in turn. If an error is encountered during the iteration, [Err] will return it.
func (*Scanner) Err ¶
Err returns whatever error caused the scanner to stop, or nil if the scanner has not yet stopped or if the scanner stopped because it completely drained the underlying io.Reader without any errors.
type Token ¶
Token is an Extract language parser token. If the token is valid, Val will be one of the token types defined in this package.
type TokenError ¶
TokenError is yielded when an unexpected error occurs during the scanning of a token. Line and Col are for the beginning of the token, not the exact location of the error.
func (*TokenError) Error ¶
func (err *TokenError) Error() string
func (*TokenError) Unwrap ¶
func (err *TokenError) Unwrap() error
type UnexpectedRuneError ¶
UnexpectedRuneError is yielded when an unexpected rune is found during the course of scanning.
func (*UnexpectedRuneError) Error ¶
func (err *UnexpectedRuneError) Error() string