package
0.1.0-alpha.6
Repository: https://github.com/slosive/sloscribe.git
Documentation: pkg.go.dev

# README

options

import "github.com/slosive/sloscribe/internal/parser/options"

Package options contains the different options available for the Parser struct

Index

type Option

Option is a more atomic to configure the different Options rather than passing the entire Options struct.

type Option func(p *Options)

func Include

func Include(dirs ...string) Option

Include configure the parser to parse the given included directories SourceFile and SourceContent will override this, if present.

func Language

func Language(lang lang.Target) Option

Language configure the parser to parse using a specific target language

func Logger

func Logger(logger *logging.Logger) Option

Logger configure the parser's logger

func SourceContent

func SourceContent(content io.ReadCloser) Option

SourceContent configure the parser to parse a specific io.Reader Shouldn't be used together with SourceFile

func SourceFile

func SourceFile(file string) Option

SourceFile configure the parser to parse a specific file Shouldn't be used together with SourceContent

func Specification

func Specification(target specification.Target) Option

Specification configure the parser to parse for a specific target specification

type Options

Options is a struct contains all the configurations available for the parser

type Options struct {
    // TargetSpecification is the specification targeted by the parser, i.e: sloth.
    // the parser will parse the source code for the target annotations.
    // Option: func Specification(target specification.Target) Option
    TargetSpecification specification.Target

    // TargetLanguage is the language targeted by the parser, i.e: go.
    // Option: func Language(lang lang.Target) Option
    TargetLanguage lang.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

    // SourceFile is the file the parser will parse. Shouldn't be used together with SourceContent
    // Option: func SourceFile(file string) Option
    SourceFile string

    // SourceContent is the io.Reader the parser will parse. Shouldn't be used together with SourceFile
    // Option: func SourceContent(content io.ReadCloser) Option
    SourceContent io.ReadCloser
}

Generated by gomarkdoc