internal

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Mar 1, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ComplementQuery

type ComplementQuery struct {
	Query Query
}

func (ComplementQuery) Evaluate

func (cq ComplementQuery) Evaluate(attrs, attrvals map[string]Set, indices Set) Set

type DifferenceQuery

type DifferenceQuery struct {
	Left, Right Query
}

func (DifferenceQuery) Evaluate

func (dq DifferenceQuery) Evaluate(attrs, attrvals map[string]Set, indices Set) Set

type IntersectionQuery

type IntersectionQuery struct {
	Left, Right Query
}

func (IntersectionQuery) Evaluate

func (iq IntersectionQuery) Evaluate(attrs, attrvals map[string]Set, indices Set) Set

type Node

type Node struct {
	Name       string
	Attributes map[string]string
}

type Parser

type Parser struct{}

func (Parser) Parse

func (p Parser) Parse(line string) ([]Node, error)

type Query

type Query interface {
	Evaluate(attrs, attrvals map[string]Set, indices Set) Set
}

func ParseQuery

func ParseQuery(tokens []Token) Query

type Scanner

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

func NewScanner

func NewScanner(s string) Scanner

func (Scanner) Len

func (s Scanner) Len() int

func (Scanner) Next

func (s Scanner) Next() (string, error)

type Set

type Set []int

func (Set) Difference

func (s Set) Difference(o Set) Set

func (Set) Intersection

func (s Set) Intersection(o Set) Set

func (Set) Union

func (s Set) Union(o Set) Set

type Stack

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

func (*Stack) IsEmpty

func (s *Stack) IsEmpty() bool

func (*Stack) Pop

func (s *Stack) Pop() Token

func (*Stack) Push

func (s *Stack) Push(token Token)

func (*Stack) Top

func (s *Stack) Top() Token

type Token

type Token struct {
	Kind TokenKind
	Text string
}

func NewToken

func NewToken(kind TokenKind, text string) Token

func Tokenize

func Tokenize(query string) ([]Token, error)

type TokenKind

type TokenKind uint8
const (
	SpaceTokenKind TokenKind = iota + 1
	LeftParenTokenKind
	RightParenTokenKind
	ComplementTokenKind
	IntersectionTokenKind
	UnionTokenKind
	DifferenceTokenKind
	ValueTokenKind
)

type UnionQuery

type UnionQuery struct {
	Left, Right Query
}

func (UnionQuery) Evaluate

func (uq UnionQuery) Evaluate(attrs, attrvals map[string]Set, indices Set) Set

type ValueQuery

type ValueQuery struct {
	Expression string
}

func (ValueQuery) Evaluate

func (vq ValueQuery) Evaluate(attrs, attrvals map[string]Set, _ Set) Set

Jump to

Keyboard shortcuts

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