regex

package
v0.0.12 Latest Latest
Warning

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

Go to latest
Published: Sep 28, 2023 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuiltInRegexExtension

func BuiltInRegexExtension(extension string) (core.Extension, error)

Types

type Extension

type Extension struct {
	OnlyStats bool
	Glob      glob.Glob
	Patterns  []*regexp.Regexp
}

Extension is a FileAnalyzer that uses regular expressions to find snippets. It can be configured to only match certain files using a glob. For a snippet to be recorded, it must be in a group with a name. For example, the following regex will match a function named "foo" and a function named "bar": (?P<function>func foo\(\) {.*?})|(?P<function>func bar\(\) {.*?})

See https://www.regular-expressions.info/named.html for more information on named groups.

func (*Extension) AnalyzeFile

func (s *Extension) AnalyzeFile(theFile file.File) *file.Results

func (*Extension) Init

func (s *Extension) Init(a core.Analyzer) error

type ExtensionYamlFile

type ExtensionYamlFile struct {
	Extensions map[string]*embeddedExtensionDefinition `yaml:"extensions"`
}

Jump to

Keyboard shortcuts

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