const comments … const directives … type scanner … func (s *scanner) init(src io.Reader, errh func(line, col uint, msg string), mode uint) { … } // errorf reports an error at the most recently read character position. func (s *scanner) errorf(format string, args ...interface{ … } // errorAtf reports an error at a byte column offset relative to the current token start. func (s *scanner) errorAtf(offset int, format string, args ...interface{ … } // setLit sets the scanner state for a recognized _Literal token. func (s *scanner) setLit(kind LitKind, ok bool) { … } // next advances the scanner by reading the next token. // // If a read, source encoding, or lexical error occurs, next calls // the installed error handler with the respective error position // and message. The error message is guaranteed to be non-empty and // never starts with a '/'. The error handler must exist. // // If the scanner mode includes the comments flag and a comment // (including comments containing directives) is encountered, the // error handler is also called with each comment position and text // (including opening /* or // and closing */, but without a newline // at the end of line comments). Comment text always starts with a / // which can be used to distinguish these handler calls from errors. // // If the scanner mode includes the directives (but not the comments) // flag, only comments containing a //line, /*line, or //go: directive // are reported, in the same way as regular comments. func (s *scanner) next() { … } func (s *scanner) ident() { … } // tokStrFast is a faster version of token.String, which assumes that tok // is one of the valid tokens - and can thus skip bounds checks. func tokStrFast(tok token) string { … } func (s *scanner) atIdentChar(first bool) bool { … } // hash is a perfect hash function for keywords. // It assumes that s has at least length 2. func hash(s []byte) uint { … } var keywordMap … func init() { … } func lower(ch rune) rune { … } func isLetter(ch rune) bool { … } func isDecimal(ch rune) bool { … } func isHex(ch rune) bool { … } // digits accepts the sequence { digit | '_' }. // If base <= 10, digits accepts any decimal digit but records // the index (relative to the literal start) of a digit >= base // in *invalid, if *invalid < 0. // digits returns a bitset describing whether the sequence contained // digits (bit 0 is set), or separators '_' (bit 1 is set). func (s *scanner) digits(base int, invalid *int) (digsep int) { … } func (s *scanner) number(seenPoint bool) { … } func baseName(base int) string { … } // invalidSep returns the index of the first invalid separator in x, or -1. func invalidSep(x string) int { … } func (s *scanner) rune() { … } func (s *scanner) stdString() { … } func (s *scanner) rawString() { … } func (s *scanner) comment(text string) { … } func (s *scanner) skipLine() { … } func (s *scanner) lineComment() { … } func (s *scanner) skipComment() bool { … } func (s *scanner) fullComment() { … } func (s *scanner) escape(quote rune) bool { … }