Skip to content

Commit

Permalink
feat(css_parser,css_formatter): start parsing exact properties and va…
Browse files Browse the repository at this point in the history
…lues (#1419)
  • Loading branch information
faultyserver authored Jan 5, 2024
1 parent bd88d8f commit 86688e4
Show file tree
Hide file tree
Showing 47 changed files with 4,234 additions and 45 deletions.
60 changes: 60 additions & 0 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.

129 changes: 129 additions & 0 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.

16 changes: 16 additions & 0 deletions crates/biome_css_formatter/src/css/any/all_property_value.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
//! This is a generated file. Don't modify it by hand! Run 'cargo codegen formatter' to re-generate the file.
use crate::prelude::*;
use biome_css_syntax::AnyCssAllPropertyValue;
#[derive(Debug, Clone, Default)]
pub(crate) struct FormatAnyCssAllPropertyValue;
impl FormatRule<AnyCssAllPropertyValue> for FormatAnyCssAllPropertyValue {
type Context = CssFormatContext;
fn fmt(&self, node: &AnyCssAllPropertyValue, f: &mut CssFormatter) -> FormatResult<()> {
match node {
AnyCssAllPropertyValue::CssWideKeyword(node) => node.format().fmt(f),
AnyCssAllPropertyValue::CssUnknownPropertyValue(node) => node.format().fmt(f),
AnyCssAllPropertyValue::CssBogusPropertyValue(node) => node.format().fmt(f),
}
}
}
2 changes: 2 additions & 0 deletions crates/biome_css_formatter/src/css/any/mod.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
//! This is a generated file. Don't modify it by hand! Run 'cargo codegen formatter' to re-generate the file.
pub(crate) mod all_property_value;
pub(crate) mod at_rule;
pub(crate) mod attribute_matcher_value;
pub(crate) mod compound_selector;
Expand Down Expand Up @@ -59,3 +60,4 @@ pub(crate) mod supports_in_parens;
pub(crate) mod supports_or_combinable_condition;
pub(crate) mod url_value;
pub(crate) mod value;
pub(crate) mod z_index_property_value;
2 changes: 2 additions & 0 deletions crates/biome_css_formatter/src/css/any/property.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ impl FormatRule<AnyCssProperty> for FormatAnyCssProperty {
match node {
AnyCssProperty::CssGenericProperty(node) => node.format().fmt(f),
AnyCssProperty::CssBogusProperty(node) => node.format().fmt(f),
AnyCssProperty::CssAllProperty(node) => node.format().fmt(f),
AnyCssProperty::CssZIndexProperty(node) => node.format().fmt(f),
}
}
}
18 changes: 18 additions & 0 deletions crates/biome_css_formatter/src/css/any/z_index_property_value.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
//! This is a generated file. Don't modify it by hand! Run 'cargo codegen formatter' to re-generate the file.
use crate::prelude::*;
use biome_css_syntax::AnyCssZIndexPropertyValue;
#[derive(Debug, Clone, Default)]
pub(crate) struct FormatAnyCssZIndexPropertyValue;
impl FormatRule<AnyCssZIndexPropertyValue> for FormatAnyCssZIndexPropertyValue {
type Context = CssFormatContext;
fn fmt(&self, node: &AnyCssZIndexPropertyValue, f: &mut CssFormatter) -> FormatResult<()> {
match node {
AnyCssZIndexPropertyValue::CssAuto(node) => node.format().fmt(f),
AnyCssZIndexPropertyValue::CssNumber(node) => node.format().fmt(f),
AnyCssZIndexPropertyValue::CssWideKeyword(node) => node.format().fmt(f),
AnyCssZIndexPropertyValue::CssUnknownPropertyValue(node) => node.format().fmt(f),
AnyCssZIndexPropertyValue::CssBogusPropertyValue(node) => node.format().fmt(f),
}
}
}
13 changes: 13 additions & 0 deletions crates/biome_css_formatter/src/css/auxiliary/auto.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
use crate::prelude::*;
use biome_css_syntax::{CssAuto, CssAutoFields};
use biome_formatter::write;

#[derive(Debug, Clone, Default)]
pub(crate) struct FormatCssAuto;
impl FormatNodeRule<CssAuto> for FormatCssAuto {
fn fmt_fields(&self, node: &CssAuto, f: &mut CssFormatter) -> FormatResult<()> {
let CssAutoFields { value_token } = node.as_fields();

write!(f, [value_token.format()])
}
}
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
use crate::prelude::*;
use biome_css_syntax::CssGenericDelimiter;
use biome_rowan::AstNode;
use biome_css_syntax::{CssGenericDelimiter, CssGenericDelimiterFields};
use biome_formatter::write;

#[derive(Debug, Clone, Default)]
pub(crate) struct FormatCssGenericDelimiter;
impl FormatNodeRule<CssGenericDelimiter> for FormatCssGenericDelimiter {
fn fmt_fields(&self, node: &CssGenericDelimiter, f: &mut CssFormatter) -> FormatResult<()> {
format_verbatim_node(node.syntax()).fmt(f)
let CssGenericDelimiterFields { value } = node.as_fields();

write!(f, [value.format()])
}
}
3 changes: 3 additions & 0 deletions crates/biome_css_formatter/src/css/auxiliary/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
pub(crate) mod attribute_matcher;
pub(crate) mod attribute_matcher_value;
pub(crate) mod attribute_name;
pub(crate) mod auto;
pub(crate) mod binary_expression;
pub(crate) mod container_and_query;
pub(crate) mod container_not_query;
Expand Down Expand Up @@ -63,4 +64,6 @@ pub(crate) mod supports_feature_declaration;
pub(crate) mod supports_not_condition;
pub(crate) mod supports_or_condition;
pub(crate) mod universal_namespace_prefix;
pub(crate) mod unknown_property_value;
pub(crate) mod url_function;
pub(crate) mod wide_keyword;
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
use crate::prelude::*;
use biome_css_syntax::{CssUnknownPropertyValue, CssUnknownPropertyValueFields};
use biome_formatter::write;

#[derive(Debug, Clone, Default)]
pub(crate) struct FormatCssUnknownPropertyValue;
impl FormatNodeRule<CssUnknownPropertyValue> for FormatCssUnknownPropertyValue {
fn fmt_fields(&self, node: &CssUnknownPropertyValue, f: &mut CssFormatter) -> FormatResult<()> {
let CssUnknownPropertyValueFields {
css_generic_component_value_list,
} = node.as_fields();

write!(f, [css_generic_component_value_list.format()])
}
}
13 changes: 13 additions & 0 deletions crates/biome_css_formatter/src/css/auxiliary/wide_keyword.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
use crate::prelude::*;
use biome_css_syntax::{CssWideKeyword, CssWideKeywordFields};
use biome_formatter::write;

#[derive(Debug, Clone, Default)]
pub(crate) struct FormatCssWideKeyword;
impl FormatNodeRule<CssWideKeyword> for FormatCssWideKeyword {
fn fmt_fields(&self, node: &CssWideKeyword, f: &mut CssFormatter) -> FormatResult<()> {
let CssWideKeywordFields { value } = node.as_fields();

write!(f, [value.format()])
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
use crate::FormatBogusNodeRule;
use biome_css_syntax::CssBogusPropertyValue;
#[derive(Debug, Clone, Default)]
pub(crate) struct FormatCssBogusPropertyValue;
impl FormatBogusNodeRule<CssBogusPropertyValue> for FormatCssBogusPropertyValue {}
Loading

0 comments on commit 86688e4

Please sign in to comment.