cssvalue

package
v0.0.0-...-52816d5 Latest Latest
Warning

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

Go to latest
Published: Sep 19, 2021 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AllOf

type AllOf struct {
	Operands []Term
}

AllOf represents two or more components, all of which must occur, in any order.

type AnyOf

type AnyOf struct {
	Operands []Term
}

AnyOf represents two or more options: one or more of them must occur, in any order.

type BasicType

type BasicType struct {
	Name  string
	Range *Range
}

BasicType represents CSS basic data types, which appear between < and > (e.g., <length>, <percentage>, etc.). For numeric data types, this type notation can annotate any range restrictions using the bracketed range notation described below.

type Capture

type Capture struct {
	Name   string
	Values []Token
}

func Match

func Match(ctx *Context, term Term, r io.Reader) []Capture

type Context

type Context struct {
	Properties   map[string]Term
	NonTerminals map[string]Term
	Functions    map[string]*Function
}

type Function

type Function struct {
	Params []Term
	Type   *BasicType
}

type Group

type Group struct {
	Name     string
	Required bool

	Operand Term
}

Group represents a group of components. If Required is true, the group must produce at least one value.

type Keyword

type Keyword string

Keyword represents keyword values (such as auto, disc, etc.), which appear literally, without quotes (e.g. auto).

type Literal

type Literal string

Literal represents a literal character.

type NonTerminal

type NonTerminal string

NonTerminal represents non-terminals that do not share the same name as a property.

type OneOf

type OneOf struct {
	Operands []Term
}

OneOf represents two or more alternatives: exactly one of them must occur.

type OneOrMore

type OneOrMore struct {
	Operand Term
}

OneOrMore indicates that the operand occurs one or more times.

type PropertyType

type PropertyType string

PropertyType represents types that have the same range of values as a property bearing the same name (e.g., <'border-width'>, <'background-attachment'>, etc.)

type Range

type Range struct {
	Min float64
	Max float64
}

Range represents a CSS bracketed range.

type Repeat

type Repeat struct {
	Min    int
	Max    int
	Commas bool

	Operand Term
}

Range indicates that the operand occurs at least Min and at most Max times. If Commas is true, values must be separated by commas.

type Seq

type Seq struct {
	Name     string
	Operands []Term
}

Seq represents a juxtaposition of components that means that all of them must occur, in the given order.

type Term

type Term interface {
	// contains filtered or unexported methods
}

Term represents a term in a CSS value grammar.

func ParseGrammar

func ParseGrammar(r io.Reader) (Term, error)

type Token

type Token struct {
	Type  css.TokenType
	Value string
}

type ZeroOrMore

type ZeroOrMore struct {
	Operand Term
}

ZeroOrMore indicates that the operand occurs zero or more times.

type ZeroOrOne

type ZeroOrOne struct {
	Operand Term
}

ZeroOrOne indicates that the operand is optional (occurs zero or one times).

Jump to

Keyboard shortcuts

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