expect

package
v0.0.0-...-46a75af Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 14, 2024 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Overview

Translation of go/expect/extract.go for protobuf sources

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Identifier

type Identifier string

Identifier is the type for an identifier in an Note argument list.

type Note

type Note struct {
	Pos     ast.SourcePos // The position at which the note identifier appears
	Comment ast.Comment   // The comment from which the note was extracted
	Name    string        // the name associated with the note
	Args    []any         // the arguments for the note
}

Note is a parsed note from an expect comment. It knows the position of the start of the comment, and the name and arguments that make up the note.

func ExtractProto

func ExtractProto(fileNode *ast.FileNode) ([]*Note, error)

func Parse

func Parse(filename string, content []byte) ([]*Note, error)

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL