18 lines
447 B
Go
18 lines
447 B
Go
package parser
|
|
|
|
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.emitCommand(cComment, p.Result().String())
|
|
} else {
|
|
p.Expected("comment")
|
|
}
|
|
}
|