selector

package
v0.0.0-...-e22fc2a Latest Latest
Warning

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

Go to latest
Published: Nov 20, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AttributeSelector

type AttributeSelector struct {
	Key      string
	Value    string
	Operator string // =, ~=, |=, ^=, $=, *=
}

type Matcher

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

func NewMatcher

func NewMatcher(selector string) *Matcher

func (*Matcher) Matches

func (m *Matcher) Matches(node *dom.Node) bool

type Parser

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

func NewParser

func NewParser(selector string) *Parser

func (*Parser) Parse

func (p *Parser) Parse() []*Selector

type Selector

type Selector struct {
	Type      SelectorType
	Value     string
	Classes   []string
	ID        string
	Tag       string
	Attribute *AttributeSelector
}

type SelectorType

type SelectorType int
const (
	SelectorTypeTag SelectorType = iota
	SelectorTypeID
	SelectorTypeClass
	SelectorTypeUniversal
	SelectorTypeCompound
)

type Token

type Token struct {
	Type  TokenType
	Value string
}

type TokenType

type TokenType int
const (
	TokenTypeTag TokenType = iota
	TokenTypeID
	TokenTypeClass
	TokenTypeSpace
	TokenTypeCombinator // >, +, ~
	TokenTypeAttribute  // [attr=value]
	TokenTypeInvalid
)

type Tokenizer

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

func NewTokenizer

func NewTokenizer(input string) *Tokenizer

Jump to

Keyboard shortcuts

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