parser

package
v0.8.0-beta Latest Latest
Warning

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

Go to latest
Published: Apr 9, 2022 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ANNOTATION_OPT = "@knit"
	ANNOTATION_BEG = "@+knit"
	ANNOTATION_END = "@!knit"

	BEG_PATTERN    = `(.*)@\+knit(.*)`
	END_PATTERN    = `(.*)@!knit(.*)`
	OPTION_PATTERN = "@knit.(\\w*).([^`\\n]*)(?:`((.|\\n)*?(?<!\\\\))`)?"

	GROUP_OPTION_TYPE    = 1
	GROUP_OPTION_VALUE   = 2
	GROUP_OPTION_LITERAL = 3
)

Variables

This section is empty.

Functions

func BeginAnnotation

func BeginAnnotation(input string) (string, error)

BeginAnnotation uses regexp to match parser.BEG_PATTERN in the given input text. Returns an error if no match was found

func EndAnnotation

func EndAnnotation(input string) (string, error)

EndAnnotation uses regexp to match parser.END_PATTERN in the given input text. Returns an error if no match was found

Types

type Option

type Option struct {
	Type    string
	Value   string
	Literal string
}

Option represents options read through the regex parser.

func Options

func Options(input string) ([]*Option, error)

Options uses regexp to match all parser.OPTION_PATTERN in the given input text. Returns a slice of *Option representing the parsed results. This function will match everything including the option type, option value and any option literal defined.

Jump to

Keyboard shortcuts

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