21 lines
463 B
Go
21 lines
463 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() {
|
|
p.EmitLiteral(ItemComment)
|
|
p.RouteReturn()
|
|
}
|
|
}
|