Documentation
¶
Overview ¶
Package genlang provides parsing for godoc comment annotations
Index ¶
Constants ¶
const ( ArgsRequired keywordFlag = 1 << iota // ArgsRequired requires a keyword to have an accompanying argument. NoArgs // NoArgs requires a keyword to be called without arguments. Exclusive // Exclusive limits the keyword to a single use per instance of field or struct. )
If a flag's requirement is violated the scanner will return an error.
const ( ScanStruct scanMode = iota ScanField ScanNamedType )
Scanning modes configure the scanner for different generation/parser types.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Arg ¶ added in v0.8.0
type Arg string
Arg is the raw string passed to a keyword that accepts an argument.
type ArgMap ¶ added in v0.8.0
type ArgMap struct {
// contains filtered or unexported fields
}
ArgMap maps a singular key (string) to multiple values ([]Args), with convenience methods for accessing the values.
type KeywordOpts ¶
type KeywordOpts map[scanMode]keywordFlag
KeywordOpts is used to configure the flags for keywords based on the scan mode (field or struct).
type NamedTypeAnnotations ¶ added in v0.8.0
type NamedTypeAnnotations struct {
Named ArgMap
}
NamedTypeAnnotations holds the MultiMap of keywords and arguments for a parser.NamedType
type Scanner ¶
type Scanner interface {
ScanStruct(*parser.Struct) (StructAnnotations, error)
ScanNamedType(*parser.NamedType) (NamedTypeAnnotations, error)
}
Scanner provides methods for parsing godoc annotations on various types from the generation/parser package.
func NewScanner ¶
func NewScanner(keywords map[string]KeywordOpts) Scanner
NewScanner constructs a Scanner with the given keywords and keyword options.
type StructAnnotations ¶ added in v0.8.0
StructAnnotations holds the MultiMaps of keywords and arguments for a parser.Struct and each of its fields.