pub struct ParserOptions {
pub try_parsing_value_in_custom_property: bool,
pub allow_postcss_simple_vars: bool,
pub template_placeholder: Option<TemplatePlaceholder>,
}Expand description
Parser options for customizing parser behaviors.
Fields§
§try_parsing_value_in_custom_property: boolEnabling this will make parser attempt to parse custom property value as normal declaration value instead of tokens. It will fallback to parse as tokens if there’re syntax errors when parsing as values.
allow_postcss_simple_vars: boolIf enabled, Syntax::Css accepts the $variable syntax handled by the
postcss-simple-vars plugin:
$var: value; declarations, $var references in property values,
and $var references inside @media (and similar) at-rule preludes.
The resulting AST uses dedicated PostcssSimpleVar
and PostcssSimpleVarDeclaration
nodes, separate from SCSS’s SassVariable family.
NOTE: Interpolation ($(var)), selector references (.$prefix),
and comment substitutions (<<$(var)>>) are not yet covered.
Ignored for Syntax::Scss, Syntax::Sass, and Syntax::Less
(those dialects already accept $variable natively).
template_placeholder: Option<TemplatePlaceholder>If set, a backtick-delimited token of the shape `<prefix><decimal index>`
(see TemplatePlaceholder) is tokenized as an atomic
Token::Placeholder carrying the parsed index.
The token terminates at the closing backtick, so an immediately following
identifier (e.g. `PLACEHOLDER-0`px) is lexed as a separate suffix.
This is designed for downstream formatters that substitute template
interpolations (e.g. CSS-in-JS ${expr}) with such placeholders
before parsing, then re-substitute them in the output.
Backtick is not valid CSS/SCSS/Sass syntax, so this MUST be used with
Syntax::Scss (the parser builder asserts this); in Less, backtick is
the inline-JS delimiter and would conflict.
Not serialized: the affix is a &'static str supplied programmatically,
not loadable from a config file.
Trait Implementations§
Source§impl Clone for ParserOptions
impl Clone for ParserOptions
Source§fn clone(&self) -> ParserOptions
fn clone(&self) -> ParserOptions
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for ParserOptions
Source§impl Debug for ParserOptions
impl Debug for ParserOptions
Source§impl Default for ParserOptions
impl Default for ParserOptions
Source§fn default() -> ParserOptions
fn default() -> ParserOptions
impl Eq for ParserOptions
Source§impl PartialEq for ParserOptions
impl PartialEq for ParserOptions
Source§fn eq(&self, other: &ParserOptions) -> bool
fn eq(&self, other: &ParserOptions) -> bool
self and other values to be equal, and is used by ==.