SyntaxFacts Class
Answers questions about CSS kinds and names without needing a tree.
public static class SyntaxFactsMethods
| Name | Description |
|---|---|
| GetAtRuleKind(string) | Gets the kind of the at-rule named name at the top level of a style sheet or in a block that is not specific to it. |
| GetClosingKind(SyntaxKind) | Gets the closing token of a block opened by kind, or SyntaxKind.None. |
| GetDelimKind(char) | Gets the kind of the delimiter c, or SyntaxKind.DelimToken when it has none of its own. |
| GetText(SyntaxKind) | Gets the text of a token whose kind fixes it, or an empty string for any other kind. |
| IsAnyToken(SyntaxKind) | |
| IsAtRule(SyntaxKind) | Determines whether kind is an at-rule. |
| IsComment(SyntaxKind) | |
| IsCssWideKeyword(string) | Determines whether name is a keyword every property accepts, such as inherit. |
| IsCustomPropertyName(string) | Determines whether name is a custom property name: two dashes followed by anything. |
| IsDelim(SyntaxKind) | Determines whether kind is a delim token of the tokenizer, with a kind of its own or not. |
| IsFontFeatureValueBlockName(string) | Determines whether name is a feature block, such as swash, which @font-feature-values may hold. |
| IsKnownFunctionalPseudoClass(string) | Determines whether name is a pseudo-class written as a function, such as is or nth-child. |
| IsKnownFunctionalPseudoElement(string) | Determines whether name is a pseudo-element written as a function, such as part. |
| IsKnownPseudoClass(string) | Determines whether name is a pseudo-class written without arguments, such as hover. |
| IsKnownPseudoElement(string) | Determines whether name is a pseudo-element written without arguments, such as before. |
| IsLegacyPseudoElement(string) | Determines whether name is one of the four pseudo-elements CSS 2 wrote with a single colon. |
| IsNumeric(SyntaxKind) | Determines whether kind is a token whose value is a number: a number, a percentage, or a dimension. |
| IsPageMarginRuleName(string) | Determines whether name is a page margin rule, such as top-left, which @page may hold. |
| IsRule(SyntaxKind) | Determines whether kind is a rule, qualified or at-rule. |
| IsTrivia(SyntaxKind) | |
| IsValidIdentifier(string) | Determines whether name is an identifier that needs no escaping in CSS. |
| IsVendorPrefixed(string) | Determines whether name is vendor-prefixed, such as -webkit-scrollbar. |
GetAtRuleKind(string)
SyntaxFacts.csGets the kind of the at-rule named name at the top level of a style sheet or in a block that is not specific to it.
public static SyntaxKind GetAtRuleKind(string name)Parameters
namestring- The name without the
@, compared without regard to ASCII case.
Returns
SyntaxKind The kind of the rule, or SyntaxKind.UnknownAtRule. A page margin rule such as @top-left and a feature block such as @swash are only known inside the rule they belong to, so they are unknown here.
Exceptions
ArgumentNullExceptionnameisnull.
GetClosingKind(SyntaxKind)
SyntaxFacts.csGets the closing token of a block opened by kind, or SyntaxKind.None.
public static SyntaxKind GetClosingKind(SyntaxKind kind)GetDelimKind(char)
SyntaxFacts.csGets the kind of the delimiter c, or SyntaxKind.DelimToken when it has none of its own.
public static SyntaxKind GetDelimKind(char c)GetText(SyntaxKind)
SyntaxFacts.csGets the text of a token whose kind fixes it, or an empty string for any other kind.
public static string GetText(SyntaxKind kind)IsAnyToken(SyntaxKind)
SyntaxFacts.cspublic static bool IsAnyToken(SyntaxKind kind)No documentation is available.
IsAtRule(SyntaxKind)
SyntaxFacts.csDetermines whether kind is an at-rule.
public static bool IsAtRule(SyntaxKind kind)IsComment(SyntaxKind)
SyntaxFacts.cspublic static bool IsComment(SyntaxKind kind)No documentation is available.
IsCssWideKeyword(string)
SyntaxFacts.csDetermines whether name is a keyword every property accepts, such as inherit.
IsCustomPropertyName(string)
SyntaxFacts.csDetermines whether name is a custom property name: two dashes followed by anything.
IsDelim(SyntaxKind)
SyntaxFacts.csDetermines whether kind is a delim token of the tokenizer, with a kind of its own or not.
public static bool IsDelim(SyntaxKind kind)IsFontFeatureValueBlockName(string)
SyntaxFacts.csDetermines whether name is a feature block, such as swash, which @font-feature-values may hold.
IsKnownFunctionalPseudoClass(string)
SyntaxFacts.csDetermines whether name is a pseudo-class written as a function, such as is or nth-child.
IsKnownFunctionalPseudoElement(string)
SyntaxFacts.csDetermines whether name is a pseudo-element written as a function, such as part.
IsKnownPseudoClass(string)
SyntaxFacts.csDetermines whether name is a pseudo-class written without arguments, such as hover.
IsKnownPseudoElement(string)
SyntaxFacts.csDetermines whether name is a pseudo-element written without arguments, such as before.
IsLegacyPseudoElement(string)
SyntaxFacts.csDetermines whether name is one of the four pseudo-elements CSS 2 wrote with a single colon.
IsNumeric(SyntaxKind)
SyntaxFacts.csDetermines whether kind is a token whose value is a number: a number, a percentage, or a dimension.
public static bool IsNumeric(SyntaxKind kind)IsPageMarginRuleName(string)
SyntaxFacts.csDetermines whether name is a page margin rule, such as top-left, which @page may hold.
IsRule(SyntaxKind)
SyntaxFacts.csDetermines whether kind is a rule, qualified or at-rule.
public static bool IsRule(SyntaxKind kind)IsTrivia(SyntaxKind)
SyntaxFacts.cspublic static bool IsTrivia(SyntaxKind kind)No documentation is available.
IsValidIdentifier(string)
SyntaxFacts.csDetermines whether name is an identifier that needs no escaping in CSS.
IsVendorPrefixed(string)
SyntaxFacts.csDetermines whether name is vendor-prefixed, such as -webkit-scrollbar.