Table of Contents

Enum CssTokenKind

Namespace
Egami.Css
Assembly
Egami.Css.dll

The kinds of token the CSS Syntax 3 tokenizer produces.

public enum CssTokenKind

Fields

AtKeyword = 2

An at-keyword, such as @media.

BadString = 5

A string cut off by a newline.

BadUrl = 7

An unquoted url(...) with characters it may not contain.

Cdc = 14

-->.

Cdo = 13

<!--.

Colon = 15

:.

Comma = 17

,.

Delim = 8

Any other single character, such as * or >.

Dimension = 11

A number followed by a unit, such as 12px.

EndOfFile = 24

The end of the input. Tokenize(string, CssParseOptions?) does not return it.

Function = 1

A function name with its opening parenthesis, such as rgb(.

Hash = 3

A hash, such as #fff or #main.

Ident = 0

An identifier, such as red or --x.

LeftCurly = 22

{.

LeftParenthesis = 20

(.

LeftSquare = 18

[.

Number = 9

A number.

Percentage = 10

A number followed by %.

RightCurly = 23

}.

RightParenthesis = 21

).

RightSquare = 19

].

Semicolon = 16

;.

[SuppressMessage("Naming", "CA1720", Justification = "The CSS Syntax token's name.")] String = 4

A quoted string.

Url = 6

An unquoted url(...).

Whitespace = 12

One or more whitespace characters.

Examples

// CSS Syntax 3 tokens, and component values: tokens, functions and simple blocks.
IReadOnlyList<CssToken> tokens = CssTokenizer.Tokenize("rgb(255 0 0 / 50%) 12px");
CssToken first = tokens[0];
bool isFunction = first.Kind == CssTokenKind.Function; // "rgb(" at line 1, column 1

IReadOnlyList<CssComponentValue> values = CssComponentValue.ParseList("calc(100% - 2px) [a] x");
var calc = (CssFunction)values[0];
var block = (CssSimpleBlock)values[2];
var word = (CssTokenValue)values[4];
string text = CssComponentValue.Serialize(values); // "calc(100% - 2px) [a] x"