Documentation ¶
Overview ¶
parser contains the glue code for different parsers (e.g. go ast and go doc) and custom things like annotations.
Index ¶
- func IsNoAnnotationError(err error) bool
- type Annotation
- type AnnotationParserError
- type File
- type NoAnnotationError
- type Package
- func (p *Package) Doc() *doc.Package
- func (p *Package) FileSet() *token.FileSet
- func (p *Package) Files() []*File
- func (p *Package) FuncDoc(name string) *doc.Func
- func (p *Package) ImportPath() string
- func (p *Package) ModName() string
- func (p *Package) Name() string
- func (p *Package) Nodes() []*ast.File
- func (p *Package) Packages() []*Package
- func (p *Package) Parent() *Package
- func (p *Package) TypeDoc(name string) *doc.Type
- func (p *Package) VisitDoc(f func(pkg *doc.Package) error) error
- func (p *Package) VisitFiles(f func(file *File) error) error
- func (p *Package) VisitPackages(f func(pkg *Package) error) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsNoAnnotationError ¶
Types ¶
type Annotation ¶
An Annotation is actually an @-prefixed-named json object one-liner
func ParseAnnotation ¶
func ParseAnnotation(line string) (Annotation, error)
ParseAnnotation is a simple minimal parser which evaluates a single line as an Annotation. If the given line is not an annotation at all, *NoAnnotationError is returned. An annotation always starts with an @ followed by a char sequence with optional opening and closing braces.
Examples
*not valid: @ *not valid: @() *valid: @a *valid: @a.b.c() // some comment or text ) *invalid: @a.b.c("hello") ) // this is wrong syntax
func ParseAnnotations ¶
func ParseAnnotations(text string) ([]Annotation, error)
ParseAnnotations tries to parse all annotations from the given text and only returns ParserErrors
type AnnotationParserError ¶
An AnnotationParserError means that an annotation has been found but could not be parsed
func (*AnnotationParserError) Error ¶
func (a *AnnotationParserError) Error() string
type File ¶
type File struct {
// contains filtered or unexported fields
}
A File contains all imports and macros together
func (*File) ResolveIdentifierImportName ¶
func (*File) ResolveImportName ¶
type NoAnnotationError ¶
type NoAnnotationError struct {
Text string
}
A NoAnnotationError means that Text did not contain any annotation
func (NoAnnotationError) Error ¶
func (a NoAnnotationError) Error() string
type Package ¶
type Package struct {
// contains filtered or unexported fields
}