parser

package
v0.0.0-...-5124d2e Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2024 License: MIT Imports: 10 Imported by: 16

Documentation

Index

Constants

This section is empty.

Variables

View Source
var SkipValidBlocks map[string]struct{} = map[string]struct{}{}

SkipValidBlocks defines a list of valid blocks to be skipped during initialization. This string is split by newline characters, with each trimmed block name added to the SkipValidBlocks mapping.

View Source
var ValidDirectives map[string]string = map[string]string{}

ValidDirectives mapped directives easily find todo: this could handle the allowed blocks as well

Functions

This section is empty.

Types

type Option

type Option func(*Parser)

Option parsing option

func WithCustomDirectives

func WithCustomDirectives(directives ...string) Option

WithCustomDirectives add your custom directives as valid directives

func WithDefaultOptions

func WithDefaultOptions() Option

WithDefaultOptions default options

func WithIncludeParsing

func WithIncludeParsing() Option

WithIncludeParsing enable parsing included files

func WithSameOptions

func WithSameOptions(p *Parser) Option

WithSameOptions copy options from another parser

func WithSkipComments

func WithSkipComments() Option

WithSkipComments default options

func WithSkipIncludeParsingErr

func WithSkipIncludeParsingErr() Option

WithSkipIncludeParsingErr ignores include parsing errors

func WithSkipValidBlocks

func WithSkipValidBlocks(directives ...string) Option

WithSkipValidBlocks add your custom block as valid

func WithSkipValidDirectivesErr

func WithSkipValidDirectivesErr() Option

WithSkipValidDirectivesErr ignores unknown directive errors

type Parser

type Parser struct {
	// contains filtered or unexported fields
}

Parser is an nginx config parser

func NewParser

func NewParser(filePath string, opts ...Option) (*Parser, error)

NewParser create new parser

func NewParserFromLexer

func NewParserFromLexer(lexer *lexer, opts ...Option) *Parser

NewParserFromLexer initilizes a new Parser

func NewStringParser

func NewStringParser(str string, opts ...Option) *Parser

NewStringParser parses nginx conf from string

func (*Parser) Close

func (p *Parser) Close() (err error)

Close closes the file handler and releases the resources

func (*Parser) Parse

func (p *Parser) Parse() (*config.Config, error)

Parse the gonginx.

func (*Parser) ParseInclude

func (p *Parser) ParseInclude(include *config.Include) (config.IDirective, error)

ParseInclude just parse include confs

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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