package scanner
Import Path
go/scanner (on golang.org and go.dev)
Dependency Relation
imports 9 packages, and imported by one package
Involved Source Files
errors.go
d-> scanner.go
Exported Type Names
type Error (struct)
In an ErrorList, an error is represented by an *Error.
The position Pos, if valid, points to the beginning of
the offending token, and the error condition is described
by Msg.
Msg string
Pos token.Position
(T) Error() string
T : error
type ErrorHandler (func)
An ErrorHandler may be provided to Scanner.Init. If a syntax error is
encountered and a handler was installed, the handler is called with a
position and an error message. The position points to the beginning of
the offending token.
func (*Scanner).Init(file *token.File, src []byte, err ErrorHandler, mode Mode)
type ErrorList ([])
ErrorList is a list of *Errors.
The zero value for an ErrorList is an empty ErrorList ready to use.
(*T) Add(pos token.Position, msg string)
(T) Err() error
(T) Error() string
(T) Len() int
(T) Less(i, j int) bool
(*T) RemoveMultiples()
(*T) Reset()
(T) Sort()
(T) Swap(i, j int)
T : error
T : sort.Interface
type Mode uint
A mode value is a set of flags (or 0).
They control scanner behavior.
func (*Scanner).Init(file *token.File, src []byte, err ErrorHandler, mode Mode)
const ScanComments
type Scanner (struct)
A Scanner holds the scanner's internal state while processing
a given text. It can be allocated as part of another data
structure but must be initialized via Init before use.
ErrorCount int
(*T) Init(file *token.File, src []byte, err ErrorHandler, mode Mode)
(*T) Scan() (pos token.Pos, tok token.Token, lit string)
Exported Values
func PrintError(w io.Writer, err error)
PrintError is a utility function that prints a list of errors to w,
one error per line, if the err parameter is an ErrorList. Otherwise
it prints the err string.
const ScanComments Mode = 1 // return comments as COMMENT tokens
![]() |
The pages are generated with Golds v0.1.6. (GOOS=darwin GOARCH=amd64) Golds is a Go 101 project and developed by Tapir Liu. PR and bug reports are welcome and can be submitted to the issue list. Please follow @Go100and1 (reachable from the left QR code) to get the latest news of Golds. |