alecthomas / participle

A parser library for Go

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

document "filename" parameter for the Parser methods ?

marco-m opened this issue · comments

Hello,
consider for example

// Lex uses the parser's lexer to tokenise input.
func (p *Parser) Lex(filename string, r io.Reader) ([]lexer.Token, error) {

It is not immediately evident what filename is for.

What do you think about adding something like:

// Lex uses the parser's lexer to tokenise input.
// Parameter filename is used as an opaque prefix in error messages.
func (p *Parser) Lex(filename string, r io.Reader) ([]lexer.Token, error) {

to all the methods taking filename?

I can provide a PR if you see value.

For sure, doc improvements are always welcome!