Documentation
¶
Index ¶
- func MustParseTime(lit string) time.Time
- func ParseDuration(lit string) ([]ast.Duration, error)
- func ParseFile(f *token.File, src []byte) *ast.File
- func ParseRegexp(lit string) (*regexp.Regexp, error)
- func ParseString(lit string) (string, error)
- func ParseTime(lit string) (time.Time, error)
- type Scanner
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func MustParseTime ¶ added in v0.21.0
MustParseTime parses a time literal and panics in the case of an error.
func ParseDuration ¶ added in v0.21.0
ParseDuration will convert a string into components of the duration.
func ParseRegexp ¶ added in v0.21.0
ParseRegexp converts text surrounded by forward slashes into a regular expression.
func ParseString ¶ added in v0.21.0
ParseString removes quotes and unescapes the string literal.
Types ¶
type Scanner ¶
type Scanner interface {
// Scan will scan the next token.
Scan() (pos token.Pos, tok token.Token, lit string)
// ScanWithRegex will scan the next token and include any regex literals.
ScanWithRegex() (pos token.Pos, tok token.Token, lit string)
// ScanStringExpr will scan the next token in a string expression context
ScanStringExpr() (pos token.Pos, tok token.Token, lit string)
// File returns the file being processed by the Scanner.
File() *token.File
// Unread will unread back to the previous location within the Scanner.
// This can only be called once so the maximum lookahead is one.
Unread()
}
Scanner defines the interface for reading a stream of tokens.
Click to show internal directories.
Click to hide internal directories.