Documentation ¶
Index ¶
- Constants
- func IsZeroPosition(p Position) bool
- func PositionsEqual(p1, p2 Position) bool
- func ScanRegexenAfter(tokens ...int) *reAfter
- func TokenString(tok rune) string
- type Double
- type Doubles
- type ErrFunc
- type Keyword
- type KeywordMap
- type Keywords
- type Option
- type Position
- type RunePair
- type RunePairs
- type ScanMode
- type Scanner
- func (s *Scanner) Disable(mode ...ScanMode)
- func (s *Scanner) Enable(mode ...ScanMode)
- func (s *Scanner) Next() rune
- func (s *Scanner) Peek() rune
- func (s *Scanner) Position() Position
- func (s *Scanner) Regex() *regexp.Regexp
- func (s *Scanner) Scan() (tok rune)
- func (s *Scanner) StdSize() stdsize.Value
- func (s *Scanner) Text() string
- func (s *Scanner) Timespan() *timespan.Timespan
- func (s *Scanner) Token() int
- func (s *Scanner) TokenString(tok rune) string
- type Source
Constants ¶
View Source
const ( // Token types exposed from "text/scanner" EOF = ts.EOF Ident = ts.Ident String = ts.String RawString = ts.RawString Comment = ts.Comment Float = ts.Float Int = ts.Int )
View Source
const ( KeyWord // A registered keyword HashComment // A shell-style # comments Timespan // A toolman.org/timespan literal Regex // A regular expression literal StdSize // A toolman.org/numbers/stdsize Value )
View Source
const ( // Scan mode bits exposed from "text/scanner" ScanIdents = ScanMode(ts.ScanIdents) ScanInts = ScanMode(ts.ScanInts) ScanFloats = ScanMode(ts.ScanFloats) ScanChars = ScanMode(ts.ScanChars) ScanStrings = ScanMode(ts.ScanStrings) ScanRawStrings = ScanMode(ts.ScanRawStrings) ScanComments = ScanMode(ts.ScanComments) SkipComments = ScanMode(ts.SkipComments) GoTokens = ScanMode(ts.GoTokens) )
View Source
const ( // ScanHashComments is a scanner Option that enabled scanning of // hash comments. For Go style comments, see ScanComments. Similar // to ScanComments, the SkipComments option may be used to treat // comments as white space. ScanHashComments = ScanMode(1 << -HashComment) // ScanTimespans is a scanner Option that enabled scanning of // Timespan literals as defined by the toolman.org/timespan package. ScanTimespans = ScanMode(1 << -Timespan) // ScanRegexen is a scanner Option that enables unconditional // scanning of regular expression. For a more restrictive regular // expression option, which only enables scanning after specific // tokens, see ScanRegexenAfter. ScanRegexen = ScanMode(1 << -Regex) // ScanStdSizes is a scanner Option that enabled scanning ofstandard // size designations as defined by the toolman.org/numbers/stdsize // package. ScanStdSizes = ScanMode(1 << -StdSize) )
Variables ¶
This section is empty.
Functions ¶
func IsZeroPosition ¶ added in v0.7.0
func PositionsEqual ¶ added in v0.7.0
func ScanRegexenAfter ¶
func ScanRegexenAfter(tokens ...int) *reAfter
ScanRegexenAfter returns a scanner Option that enables the scanning of regular expressions immediately following one of the provided tokens. Regular expression scanning is otherwise disabled.
This option should not be used in conjunction with the broader ScanRegexen, which enables regular expression scanning unconditionally.
func TokenString ¶
Types ¶
type KeywordMap ¶
type Scanner ¶
type Scanner struct {
// contains filtered or unexported fields
}
func (*Scanner) Position ¶
Position returns the position of the most recently scanned token or, if that is invalid, the position of the character immediately following the most recently scanned token or character.
func (*Scanner) TokenString ¶
Click to show internal directories.
Click to hide internal directories.