go-toml/comment.go

18 lines
447 B
Go

package toml
import (
"git.makaay.nl/mauricem/go-parsekit/parse"
)
// A '#' hash symbol marks the rest of the line as a comment.
// All characters up to the end of the line are included in the comment.
var comment = c.Seq(a.Hash, c.ZeroOrMore(c.Not(a.EndOfLine)), m.Drop(a.EndOfLine))
func (t *parser) startComment(p *parse.API) {
if p.Accept(comment) {
t.addParsedItem(pComment, p.Result().String())
} else {
p.Expected("comment")
}
}