searchstring

package
v0.0.0-...-d1a9080 Latest Latest
Warning

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

Go to latest
Published: May 5, 2021 License: AGPL-3.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Scanner

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

Scanner is the search string scanner.

func NewScanner

func NewScanner(input string) *Scanner

NewScanner returns a new instance of Scanner.

func (Scanner) Scan

func (s Scanner) Scan() (Token, string)

Scan scans the next token in the string.

type SearchTerm

type SearchTerm struct {
	Field  string
	Value  string
	Quotes bool
}

SearchTerm is a search term part.

func Parse

func Parse(input string) ([]SearchTerm, error)

Parse returns a list of SearchTerm from input string.

type Token

type Token int

Token is the type of parsed token.

const (
	// EOF is the end of file token.
	EOF Token = iota
	// STR is a string token.
	STR
	// STRQ is a quoted string
	STRQ
	// FIELD is a field token.
	FIELD
)

Jump to

Keyboard shortcuts

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