Documentation
¶
Index ¶
- Variables
- type Option
- type Options
- type Parser
- func (p *Parser) AnnotateAllErrors(ctx context.Context, wrapErrors, annotateOnlyTodos bool) error
- func (p *Parser) AnnotateSourceErrors(ctx context.Context, filename string, wrapErrors, annotateOnlyTodos bool) error
- func (p *Parser) ParseAllSources(ctx context.Context) ([]*api.Manifest, error)
- func (p *Parser) ParseSource(ctx context.Context, content io.Reader) (*api.Manifest, error)
Constants ¶
This section is empty.
Variables ¶
var (
ErrNoTargetLanguage = errors.New("no target source language was set")
)
Functions ¶
This section is empty.
Types ¶
type Option ¶
type Option func(p *Options)
Option is a more atomic to configure the different Options rather than passing the entire Options struct.
type Options ¶
type Options struct { // TargetLanguage is the language targeted by the parser, i.e: go. TargetLanguage language.Target // IncludedDirs is the array containing all the directories that will be parsed by the parser. // SourceFile and SourceContent will override this, if present. // Option: func Include(dirs ...string) Option IncludedDirs []string // Logger is the parser's logger // Option: func Logger(logger *logging.Logger) Option Logger *logging.Logger // Strict set the parser to error hard on errors rather than keep processing Strict bool // Recursive set the parser to recursively parser the target directories Recursive bool }
Options is a struct contains all the configurations available for the parser
type Parser ¶
type Parser struct { // Opts contains the different options available to the parser. // These are applied by the parser constructor during initialization Opts *Options }
Parser parses source files containing the sloth definitions
func New ¶
New creates a new instance of the parser. See options.Option for more info on the available configuration.
func (*Parser) AnnotateAllErrors ¶
AnnotateErrors parses the data source for error declarations using the given parser configurations and returns them.
func (*Parser) AnnotateSourceErrors ¶
func (p *Parser) AnnotateSourceErrors(ctx context.Context, filename string, wrapErrors, annotateOnlyTodos bool) error
AnnotateErrors parses the data source for error declarations using the given parser configurations and returns them.
func (*Parser) ParseAllSources ¶
ParseAllSources parses the data source for the target annotations using the given parser configurations and returns a parsed specification.