go-toml/comment.go

21 lines
469 B
Go

package parser
import (
"git.makaay.nl/mauricem/go-parsekit"
)
// 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(
m.Drop(c.OneOrMore(a.Hash)),
m.Trim(c.ZeroOrMore(c.Not(a.EndOfLine)), " \t"),
m.Drop(a.EndOfLine))
func startComment(p *parsekit.P) {
p.Expects("comment")
if p.On(comment).Accept().End() {
p.EmitLiteral(ItemComment)
p.RouteReturn()
}
}