go-toml/toml.go

25 lines
799 B
Go

package parser
import "git.makaay.nl/mauricem/go-parsekit"
// Item types that are produced by this parser.
const (
ItemComment parsekit.ItemType = iota // Comment string
ItemKey // Key of a key/value pair
ItemKeyDot // Dot for a dotted key
ItemAssignment // Value assignment coming up (=)
ItemString // A value of type string
)
var (
c, a = parsekit.C, parsekit.A
optionalWhitespace = c.Optional(a.Whitespace)
anyQuote = c.AnyOf(a.SingleQuote, a.DoubleQuote)
)
// NewParser creates a new parser, using the provided input string
// as the data to parse.
func NewParser(input string) *parsekit.P {
return parsekit.New(input, startKeyValuePair)
}