const commentStart … const commentStartLen … type Identifier … // Parse collects all the notes present in a file. // If content is nil, the filename specified is read and parsed, otherwise the // content is used and the filename is used for positions and error messages. // Each comment whose text starts with @ is parsed as a comma-separated // sequence of notes. // See the package documentation for details about the syntax of those // notes. func Parse(fset *token.FileSet, filename string, content []byte) ([]*Note, error) { … } // extractModWork collects all the notes present in a go.mod file or go.work // file, by way of the shared modfile.Expr statement node. // // Each comment whose text starts with @ is parsed as a comma-separated // sequence of notes. // See the package documentation for details about the syntax of those // notes. // Only allow notes to appear with the following format: "//@mark()" or // @mark() func extractModWork(fset *token.FileSet, exprs []modfile.Expr) ([]*Note, error) { … } // ExtractGo collects all the notes present in an AST. // Each comment whose text starts with @ is parsed as a comma-separated // sequence of notes. // See the package documentation for details about the syntax of those // notes. func ExtractGo(fset *token.FileSet, file *ast.File) ([]*Note, error) { … } func getAdjustedNote(text string) (string, int) { … } const invalidToken … type tokens … func (t *tokens) Init(base token.Pos, text string) *tokens { … } func (t *tokens) Consume() string { … } func (t *tokens) Token() rune { … } func (t *tokens) Skip(r rune) int { … } func (t *tokens) TokenString() string { … } func (t *tokens) Pos() token.Pos { … } func (t *tokens) Errorf(msg string, args ...interface{ … } func parse(fset *token.FileSet, base token.Pos, text string) ([]*Note, error) { … } func parseComment(t *tokens) []*Note { … } func parseNote(t *tokens) *Note { … } func parseArgumentList(t *tokens) (args []any, named map[string]any) { … } // parseArgument returns the value of the argument ("f(value)"), // and its name if named "f(name=value)". func parseArgument(t *tokens) (name string, value any) { … }