Skip to content

Commit

Permalink
feat(css_parser): CSS: implement unknown at rule
Browse files Browse the repository at this point in the history
  • Loading branch information
denbezrukov committed Jun 9, 2024
1 parent 6dea8d4 commit 545a510
Show file tree
Hide file tree
Showing 16 changed files with 73 additions and 73 deletions.
14 changes: 7 additions & 7 deletions crates/biome_css_factory/src/generated/node_factory.rs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions crates/biome_css_factory/src/generated/syntax_factory.rs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion crates/biome_css_formatter/src/css/bogus/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,5 @@ pub(crate) mod bogus_scope_range;
pub(crate) mod bogus_selector;
pub(crate) mod bogus_sub_selector;
pub(crate) mod bogus_url_modifier;
pub(crate) mod unknown_at_rule_parameter_list;
pub(crate) mod unknown_at_rule_component_list;
pub(crate) mod value_at_rule_generic_value;
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
use crate::FormatBogusNodeRule;
use biome_css_syntax::CssUnknownAtRuleComponentList;
#[derive(Debug, Clone, Default)]
pub(crate) struct FormatCssUnknownAtRuleComponentList;
impl FormatBogusNodeRule<CssUnknownAtRuleComponentList> for FormatCssUnknownAtRuleComponentList {}

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@ impl FormatNodeRule<CssUnknownBlockAtRule> for FormatCssUnknownBlockAtRule {
fn fmt_fields(&self, node: &CssUnknownBlockAtRule, f: &mut CssFormatter) -> FormatResult<()> {
let CssUnknownBlockAtRuleFields {
name,
parameters,
components,
block,
} = node.as_fields();

write!(f, [name.format(), space(), parameters.format()])?;
write!(f, [name.format(), space(), components.format()])?;

if parameters.map_or(false, |parameters| parameters.items().next().is_some()) {
if components.map_or(false, |components| components.items().next().is_some()) {
write!(f, [space()])?;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,17 @@ impl FormatNodeRule<CssUnknownValueAtRule> for FormatCssUnknownValueAtRule {
fn fmt_fields(&self, node: &CssUnknownValueAtRule, f: &mut CssFormatter) -> FormatResult<()> {
let CssUnknownValueAtRuleFields {
name,
parameters,
components,
semicolon_token,
} = node.as_fields();

write!(f, [name.format()])?;

if let Ok(parameters) = parameters {
if parameters.items().next().is_some() {
if let Ok(components) = components {
if components.items().next().is_some() {
write!(f, [space()])?;
}
write!(f, [parameters.format()])?;
write!(f, [components.format()])?;
}

write!(f, [semicolon_token.format()])
Expand Down
24 changes: 12 additions & 12 deletions crates/biome_css_formatter/src/generated.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7025,38 +7025,38 @@ impl IntoFormat<CssFormatContext> for biome_css_syntax::CssBogusUrlModifier {
)
}
}
impl FormatRule<biome_css_syntax::CssUnknownAtRuleParameterList>
for crate::css::bogus::unknown_at_rule_parameter_list::FormatCssUnknownAtRuleParameterList
impl FormatRule<biome_css_syntax::CssUnknownAtRuleComponentList>
for crate::css::bogus::unknown_at_rule_component_list::FormatCssUnknownAtRuleComponentList
{
type Context = CssFormatContext;
#[inline(always)]
fn fmt(
&self,
node: &biome_css_syntax::CssUnknownAtRuleParameterList,
node: &biome_css_syntax::CssUnknownAtRuleComponentList,
f: &mut CssFormatter,
) -> FormatResult<()> {
FormatBogusNodeRule::<biome_css_syntax::CssUnknownAtRuleParameterList>::fmt(self, node, f)
FormatBogusNodeRule::<biome_css_syntax::CssUnknownAtRuleComponentList>::fmt(self, node, f)
}
}
impl AsFormat<CssFormatContext> for biome_css_syntax::CssUnknownAtRuleParameterList {
impl AsFormat<CssFormatContext> for biome_css_syntax::CssUnknownAtRuleComponentList {
type Format<'a> = FormatRefWithRule<
'a,
biome_css_syntax::CssUnknownAtRuleParameterList,
crate::css::bogus::unknown_at_rule_parameter_list::FormatCssUnknownAtRuleParameterList,
biome_css_syntax::CssUnknownAtRuleComponentList,
crate::css::bogus::unknown_at_rule_component_list::FormatCssUnknownAtRuleComponentList,
>;
fn format(&self) -> Self::Format<'_> {
#![allow(clippy::default_constructed_unit_structs)]
FormatRefWithRule :: new (self , crate :: css :: bogus :: unknown_at_rule_parameter_list :: FormatCssUnknownAtRuleParameterList :: default ())
FormatRefWithRule :: new (self , crate :: css :: bogus :: unknown_at_rule_component_list :: FormatCssUnknownAtRuleComponentList :: default ())
}
}
impl IntoFormat<CssFormatContext> for biome_css_syntax::CssUnknownAtRuleParameterList {
impl IntoFormat<CssFormatContext> for biome_css_syntax::CssUnknownAtRuleComponentList {
type Format = FormatOwnedWithRule<
biome_css_syntax::CssUnknownAtRuleParameterList,
crate::css::bogus::unknown_at_rule_parameter_list::FormatCssUnknownAtRuleParameterList,
biome_css_syntax::CssUnknownAtRuleComponentList,
crate::css::bogus::unknown_at_rule_component_list::FormatCssUnknownAtRuleComponentList,
>;
fn into_format(self) -> Self::Format {
#![allow(clippy::default_constructed_unit_structs)]
FormatOwnedWithRule :: new (self , crate :: css :: bogus :: unknown_at_rule_parameter_list :: FormatCssUnknownAtRuleParameterList :: default ())
FormatOwnedWithRule :: new (self , crate :: css :: bogus :: unknown_at_rule_component_list :: FormatCssUnknownAtRuleComponentList :: default ())
}
}
impl FormatRule<biome_css_syntax::CssValueAtRuleGenericValue>
Expand Down
2 changes: 1 addition & 1 deletion crates/biome_css_parser/src/syntax/at_rule/unknown.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ pub(crate) fn parse_unknown_at_rule(p: &mut CssParser) -> ParsedSyntax {
p.bump_any();
}

m.complete(p, CSS_UNKNOWN_AT_RULE_PARAMETER_LIST);
m.complete(p, CSS_UNKNOWN_AT_RULE_COMPONENT_LIST);
}

let kind = if p.at(T!['{']) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ CssRoot {
name: CssIdentifier {
value_token: IDENT@15..21 "apply" [] [Whitespace(" ")],
},
parameter: CssUnknownAtRuleParameter {
components: CssUnknownAtRuleComponentList {
items: [
IDENT@21..26 "flex" [] [Whitespace(" ")],
IDENT@26..35 "flex-col" [] [Whitespace(" ")],
Expand Down Expand Up @@ -75,7 +75,7 @@ CssRoot {
name: CssIdentifier {
value_token: IDENT@60..69 "tailwind" [] [Whitespace(" ")],
},
parameter: CssUnknownAtRuleParameter {
components: CssUnknownAtRuleComponentList {
items: [
IDENT@69..73 "base" [] [],
],
Expand All @@ -89,7 +89,7 @@ CssRoot {
name: CssIdentifier {
value_token: IDENT@76..85 "tailwind" [] [Whitespace(" ")],
},
parameter: CssUnknownAtRuleParameter {
components: CssUnknownAtRuleComponentList {
items: [
IDENT@85..95 "components" [] [],
],
Expand All @@ -103,7 +103,7 @@ CssRoot {
name: CssIdentifier {
value_token: IDENT@98..107 "tailwind" [] [Whitespace(" ")],
},
parameter: CssUnknownAtRuleParameter {
components: CssUnknownAtRuleComponentList {
items: [
IDENT@107..116 "utilities" [] [],
],
Expand Down Expand Up @@ -140,7 +140,7 @@ CssRoot {
1: CSS_UNKNOWN_VALUE_AT_RULE@15..55
0: CSS_IDENTIFIER@15..21
0: IDENT@15..21 "apply" [] [Whitespace(" ")]
1: CSS_UNKNOWN_AT_RULE_PARAMETER@21..54
1: CSS_UNKNOWN_AT_RULE_COMPONENT_LIST@21..54
0: IDENT@21..26 "flex" [] [Whitespace(" ")]
1: IDENT@26..35 "flex-col" [] [Whitespace(" ")]
2: IDENT@35..37 "h-" [] []
Expand All @@ -160,23 +160,23 @@ CssRoot {
1: CSS_UNKNOWN_VALUE_AT_RULE@60..74
0: CSS_IDENTIFIER@60..69
0: IDENT@60..69 "tailwind" [] [Whitespace(" ")]
1: CSS_UNKNOWN_AT_RULE_PARAMETER@69..73
1: CSS_UNKNOWN_AT_RULE_COMPONENT_LIST@69..73
0: IDENT@69..73 "base" [] []
2: SEMICOLON@73..74 ";" [] []
2: CSS_AT_RULE@74..96
0: AT@74..76 "@" [Newline("\n")] []
1: CSS_UNKNOWN_VALUE_AT_RULE@76..96
0: CSS_IDENTIFIER@76..85
0: IDENT@76..85 "tailwind" [] [Whitespace(" ")]
1: CSS_UNKNOWN_AT_RULE_PARAMETER@85..95
1: CSS_UNKNOWN_AT_RULE_COMPONENT_LIST@85..95
0: IDENT@85..95 "components" [] []
2: SEMICOLON@95..96 ";" [] []
3: CSS_AT_RULE@96..117
0: AT@96..98 "@" [Newline("\n")] []
1: CSS_UNKNOWN_VALUE_AT_RULE@98..117
0: CSS_IDENTIFIER@98..107
0: IDENT@98..107 "tailwind" [] [Whitespace(" ")]
1: CSS_UNKNOWN_AT_RULE_PARAMETER@107..116
1: CSS_UNKNOWN_AT_RULE_COMPONENT_LIST@107..116
0: IDENT@107..116 "utilities" [] []
2: SEMICOLON@116..117 ";" [] []
2: EOF@117..118 "" [Newline("\n")] []
Expand Down
4 changes: 2 additions & 2 deletions crates/biome_css_syntax/src/generated/kind.rs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions crates/biome_css_syntax/src/generated/macros.rs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 545a510

Please sign in to comment.