go-toml/comment.go

20 lines
470 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.Sequence(
c.Drop(c.OneOrMore(a.Hash)),
c.Trim(c.ZeroOrMore(c.Not(a.EndOfLine)), " \t"),
c.Drop(a.EndOfLine))
func startComment(p *parsekit.P) {
p.Expects("comment")
if p.On(comment).Accept().RouteReturn().End() {
p.EmitLiteral(ItemComment)
}
}