regex

package
v0.8.3 Latest Latest
Warning

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

Go to latest
Published: Nov 2, 2023 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

View Source
const (
	BaseImport = `[A-Za-z](\/?[A-Z-a-z0-9._-])*`
	Import     = `((` + BaseImport + `)|("` + BaseImport + `")|"\.")`
	GoToken    = `[A-Za-z][A-Za-z0-9_]*`
	YamlToken  = `[A-Za-z]((\.|-|_)?[A-Za-z0-9])*`
	GoFunc     = `((?P<import>` + Import + `)\.)?(?P<fn>` + GoToken + `)`

	MetaPkg                  = GoToken
	MetaContainerType        = GoToken
	MetaContainerConstructor = GoToken
	MetaImport               = Import
	MetaImportAlias          = YamlToken
	MetaFn                   = GoToken
	MetaGoFn                 = GoFunc

	ParamName = YamlToken

	ServiceName   = YamlToken
	ServiceGetter = GoToken
	ServiceType   = `(?P<ptr>\*)?` + `((?P<import>` + Import + `)\.)?(?P<type>` + GoToken + `)`
	// ServiceValue supports
	// Value
	// &Value
	// my/import.Value
	// "my/import".GlobalVar.Field
	// &"my/import".GlobalVar.Field
	// MyStruct{}
	// &MyStruct{}
	// my/import.MyStruct{}
	// &my/import.MyStruct{}
	ServiceValue = `((?P<v1>(?P<ptr>\&)?((?P<import>` + Import + `)\.)?(?P<value>` + GoToken + `(\.` + GoToken + `)*` + `))` +
		`|(?P<v2>(?P<ptr2>\&)?((?P<import2>` + Import + `)\.)?(?P<struct2>` + GoToken + `)\{\}))`
	ServiceConstructor = GoFunc
	ServiceCallName    = GoToken
	ServiceFieldName   = GoToken
	ServiceTag         = YamlToken

	PrefixService = `@`
	ArgService    = PrefixService + "(?P<service>" + YamlToken + ")"
	PrefixTagged  = `!tagged\s+`
	ArgTagged     = PrefixTagged + "(?P<tag>" + YamlToken + ")"
	PrefixValue   = `!value\s+`
	ArgValue      = PrefixValue + "((?P<argval>" + ServiceValue + "))"

	DecoratorTag    = `(\*|(` + ServiceTag + `))`
	DecoratorMethod = GoFunc
)

Variables

This section is empty.

Functions

func Match

func Match(r *regexp.Regexp, s string) (bool, map[string]string)

func MustCompileAz

func MustCompileAz(r string) *regexp.Regexp

MustCompileAz wraps input by `\A(` and `)\z` and compiles into regexp.Regexp struct.

Types

This section is empty.

Jump to

Keyboard shortcuts

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