ianlancetaylor / demangle

C++ symbol name demangler written in Go
BSD 3-Clause "New" or "Revised" License
166 stars 24 forks source link

demangle: make parsing syntax doc comments format better #15

Closed rsc closed 2 years ago

rsc commented 2 years ago

Right now, most of the parser doc comments are interpreted as a single-line paragraph followed by a \

 block, as in:

% go doc -u unresolvedName
package demangle // import "github.com/ianlancetaylor/demangle"

func (st *state) unresolvedName() AST
    <unresolved-name> ::= [gs] <base-unresolved-name>

        ::= sr <unresolved-type> <base-unresolved-name>
        ::= srN <unresolved-type> <unresolved-qualifier-level>+ E <base-unresolved-name>
        ::= [gs] sr <unresolved-qualifier-level>+ E <base-unresolved-name>

Note the blank line separating the paragraph from the \

 block.
(The difference is more obvious in HTML.)

This commit changes all the doc comments to put the entire grammar in a \

 block, introduced by text like “unresolvedName parses:”

This matters only because the package is vendored into the main Go repo as part of cmd/pprof, and some upcoming gofmt changes will mishandle the comments.

rsc commented 2 years ago

I am impressed how badly GitHub is doing at rendering that commit message! (Fixed.)

ianlancetaylor commented 2 years ago

Thanks for going through all that.