package scanner

Import Path
	text/scanner (on golang.org and go.dev)

Dependency Relation
	imports 6 packages, and imported by one package

Involved Source Files
	d-> scanner.go

Exported Type Names

type Position (struct) A source position is represented by a Position value. A position is valid if Line > 0. Column int Filename string Line int Offset int (*T) IsValid() bool (T) String() string *T : database/sql/driver.Validator T : expvar.Var T : fmt.Stringer func (*Scanner).Pos() (pos Position)
type Scanner (struct) A Scanner implements reading of Unicode characters and tokens from an io.Reader. Error func(s *Scanner, msg string) ErrorCount int IsIdentRune func(ch rune, i int) bool Mode uint Position Position Position.Column int Position.Filename string Position.Line int Position.Offset int Whitespace uint64 (*T) Init(src io.Reader) *Scanner (*T) IsValid() bool (*T) Next() rune (*T) Peek() rune (*T) Pos() (pos Position) (*T) Scan() rune (T) String() string (*T) TokenText() string *T : database/sql/driver.Validator T : expvar.Var T : fmt.Stringer func (*Scanner).Init(src io.Reader) *Scanner
Exported Values
const Char = -5 The result of Scan is one of these tokens or a Unicode character.
const Comment = -8 The result of Scan is one of these tokens or a Unicode character.
const EOF = -1 The result of Scan is one of these tokens or a Unicode character.
const Float = -4 The result of Scan is one of these tokens or a Unicode character.
const GoTokens = 1012 Predefined mode bits to control recognition of tokens. For instance, to configure a Scanner such that it only recognizes (Go) identifiers, integers, and skips comments, set the Scanner's Mode field to: ScanIdents | ScanInts | SkipComments With the exceptions of comments, which are skipped if SkipComments is set, unrecognized tokens are not ignored. Instead, the scanner simply returns the respective individual characters (or possibly sub-tokens). For instance, if the mode is ScanIdents (not ScanStrings), the string "foo" is scanned as the token sequence '"' Ident '"'. Use GoTokens to configure the Scanner such that it accepts all Go literal tokens including Go identifiers. Comments will be skipped.
const GoWhitespace = 4294977024 GoWhitespace is the default value for the Scanner's Whitespace field. Its value selects Go's white space characters.
const Ident = -2 The result of Scan is one of these tokens or a Unicode character.
const Int = -3 The result of Scan is one of these tokens or a Unicode character.
const RawString = -7 The result of Scan is one of these tokens or a Unicode character.
const ScanChars = 32 Predefined mode bits to control recognition of tokens. For instance, to configure a Scanner such that it only recognizes (Go) identifiers, integers, and skips comments, set the Scanner's Mode field to: ScanIdents | ScanInts | SkipComments With the exceptions of comments, which are skipped if SkipComments is set, unrecognized tokens are not ignored. Instead, the scanner simply returns the respective individual characters (or possibly sub-tokens). For instance, if the mode is ScanIdents (not ScanStrings), the string "foo" is scanned as the token sequence '"' Ident '"'. Use GoTokens to configure the Scanner such that it accepts all Go literal tokens including Go identifiers. Comments will be skipped.
const ScanComments = 256 Predefined mode bits to control recognition of tokens. For instance, to configure a Scanner such that it only recognizes (Go) identifiers, integers, and skips comments, set the Scanner's Mode field to: ScanIdents | ScanInts | SkipComments With the exceptions of comments, which are skipped if SkipComments is set, unrecognized tokens are not ignored. Instead, the scanner simply returns the respective individual characters (or possibly sub-tokens). For instance, if the mode is ScanIdents (not ScanStrings), the string "foo" is scanned as the token sequence '"' Ident '"'. Use GoTokens to configure the Scanner such that it accepts all Go literal tokens including Go identifiers. Comments will be skipped.
const ScanFloats = 16 // includes Ints and hexadecimal floats Predefined mode bits to control recognition of tokens. For instance, to configure a Scanner such that it only recognizes (Go) identifiers, integers, and skips comments, set the Scanner's Mode field to: ScanIdents | ScanInts | SkipComments With the exceptions of comments, which are skipped if SkipComments is set, unrecognized tokens are not ignored. Instead, the scanner simply returns the respective individual characters (or possibly sub-tokens). For instance, if the mode is ScanIdents (not ScanStrings), the string "foo" is scanned as the token sequence '"' Ident '"'. Use GoTokens to configure the Scanner such that it accepts all Go literal tokens including Go identifiers. Comments will be skipped.
const ScanIdents = 4 Predefined mode bits to control recognition of tokens. For instance, to configure a Scanner such that it only recognizes (Go) identifiers, integers, and skips comments, set the Scanner's Mode field to: ScanIdents | ScanInts | SkipComments With the exceptions of comments, which are skipped if SkipComments is set, unrecognized tokens are not ignored. Instead, the scanner simply returns the respective individual characters (or possibly sub-tokens). For instance, if the mode is ScanIdents (not ScanStrings), the string "foo" is scanned as the token sequence '"' Ident '"'. Use GoTokens to configure the Scanner such that it accepts all Go literal tokens including Go identifiers. Comments will be skipped.
const ScanInts = 8 Predefined mode bits to control recognition of tokens. For instance, to configure a Scanner such that it only recognizes (Go) identifiers, integers, and skips comments, set the Scanner's Mode field to: ScanIdents | ScanInts | SkipComments With the exceptions of comments, which are skipped if SkipComments is set, unrecognized tokens are not ignored. Instead, the scanner simply returns the respective individual characters (or possibly sub-tokens). For instance, if the mode is ScanIdents (not ScanStrings), the string "foo" is scanned as the token sequence '"' Ident '"'. Use GoTokens to configure the Scanner such that it accepts all Go literal tokens including Go identifiers. Comments will be skipped.
const ScanRawStrings = 128 Predefined mode bits to control recognition of tokens. For instance, to configure a Scanner such that it only recognizes (Go) identifiers, integers, and skips comments, set the Scanner's Mode field to: ScanIdents | ScanInts | SkipComments With the exceptions of comments, which are skipped if SkipComments is set, unrecognized tokens are not ignored. Instead, the scanner simply returns the respective individual characters (or possibly sub-tokens). For instance, if the mode is ScanIdents (not ScanStrings), the string "foo" is scanned as the token sequence '"' Ident '"'. Use GoTokens to configure the Scanner such that it accepts all Go literal tokens including Go identifiers. Comments will be skipped.
const ScanStrings = 64 Predefined mode bits to control recognition of tokens. For instance, to configure a Scanner such that it only recognizes (Go) identifiers, integers, and skips comments, set the Scanner's Mode field to: ScanIdents | ScanInts | SkipComments With the exceptions of comments, which are skipped if SkipComments is set, unrecognized tokens are not ignored. Instead, the scanner simply returns the respective individual characters (or possibly sub-tokens). For instance, if the mode is ScanIdents (not ScanStrings), the string "foo" is scanned as the token sequence '"' Ident '"'. Use GoTokens to configure the Scanner such that it accepts all Go literal tokens including Go identifiers. Comments will be skipped.
const SkipComments = 512 // if set with ScanComments, comments become white space Predefined mode bits to control recognition of tokens. For instance, to configure a Scanner such that it only recognizes (Go) identifiers, integers, and skips comments, set the Scanner's Mode field to: ScanIdents | ScanInts | SkipComments With the exceptions of comments, which are skipped if SkipComments is set, unrecognized tokens are not ignored. Instead, the scanner simply returns the respective individual characters (or possibly sub-tokens). For instance, if the mode is ScanIdents (not ScanStrings), the string "foo" is scanned as the token sequence '"' Ident '"'. Use GoTokens to configure the Scanner such that it accepts all Go literal tokens including Go identifiers. Comments will be skipped.
const String = -6 The result of Scan is one of these tokens or a Unicode character.
func TokenString(tok rune) string TokenString returns a printable string for a token or Unicode character.