Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ContinueFunc ¶
ContinueFunc is a function that is executed to determine if the parser should continue. The input of a function is the parsed result and if the function returns true the parser will continue, otherwise it will stop
type Parser ¶
type Parser struct {
// Lines that match this regex will be ignored. Usually used to ignore
// comments
Ignore *regexp.Regexp
// Lines that match this regex will be captured and the captures returned.
// The capturing groups must be named
Capture *regexp.Regexp
}
Parser Struct that is capable of parsing single-line files using a regex
func (*Parser) Parse ¶
Parse will parse a file's lines. Lines will be first checked to see if they match the Ignore regex, if they do they will be ignored. Else they will be checked against the Capture regex. The function returns a slice where each element is a map of capture group name to captured value
func (*Parser) WithParsedResults ¶
func (p *Parser) WithParsedResults(ctx context.Context, scanner *bufio.Scanner, f ContinueFunc) error
WithParsedResults Executes a ContinueFunc for each parsed result within a given file. It also requires a context to allow the scanning to be cancelled if it is taking too long