Skip to content

Commit

Permalink
feat(css_parser): Implement CSS unicode range
Browse files Browse the repository at this point in the history
  • Loading branch information
denbezrukov committed Jun 21, 2024
1 parent c372484 commit ac925c3
Show file tree
Hide file tree
Showing 31 changed files with 2,899 additions and 70 deletions.
45 changes: 45 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.

98 changes: 98 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.

1 change: 1 addition & 0 deletions crates/biome_css_formatter/src/css/any/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ pub(crate) mod supports_and_combinable_condition;
pub(crate) mod supports_condition;
pub(crate) mod supports_in_parens;
pub(crate) mod supports_or_combinable_condition;
pub(crate) mod unicode_value;
pub(crate) mod url_modifier;
pub(crate) mod url_value;
pub(crate) mod value;
Expand Down
17 changes: 17 additions & 0 deletions crates/biome_css_formatter/src/css/any/unicode_value.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
//! 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::AnyCssUnicodeValue;
#[derive(Debug, Clone, Default)]
pub(crate) struct FormatAnyCssUnicodeValue;
impl FormatRule<AnyCssUnicodeValue> for FormatAnyCssUnicodeValue {
type Context = CssFormatContext;
fn fmt(&self, node: &AnyCssUnicodeValue, f: &mut CssFormatter) -> FormatResult<()> {
match node {
AnyCssUnicodeValue::CssBogusUnicodeRangeValue(node) => node.format().fmt(f),
AnyCssUnicodeValue::CssUnicodeCodepoint(node) => node.format().fmt(f),
AnyCssUnicodeValue::CssUnicodeRangeInterval(node) => node.format().fmt(f),
AnyCssUnicodeValue::CssUnicodeRangeWildcard(node) => node.format().fmt(f),
}
}
}
1 change: 1 addition & 0 deletions crates/biome_css_formatter/src/css/any/value.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ impl FormatRule<AnyCssValue> for FormatAnyCssValue {
AnyCssValue::CssNumber(node) => node.format().fmt(f),
AnyCssValue::CssRatio(node) => node.format().fmt(f),
AnyCssValue::CssString(node) => node.format().fmt(f),
AnyCssValue::CssUnicodeRange(node) => node.format().fmt(f),
}
}
}
4 changes: 4 additions & 0 deletions crates/biome_css_formatter/src/css/auxiliary/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,10 @@ pub(crate) mod supports_condition_in_parens;
pub(crate) mod supports_feature_declaration;
pub(crate) mod supports_not_condition;
pub(crate) mod supports_or_condition;
pub(crate) mod unicode_codepoint;
pub(crate) mod unicode_range;
pub(crate) mod unicode_range_interval;
pub(crate) mod unicode_range_wildcard;
pub(crate) mod universal_namespace_prefix;
pub(crate) mod url_function;
pub(crate) mod value_at_rule_declaration_clause;
Expand Down
13 changes: 13 additions & 0 deletions crates/biome_css_formatter/src/css/auxiliary/unicode_codepoint.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
use crate::prelude::*;
use biome_css_syntax::{CssUnicodeCodepoint, CssUnicodeCodepointFields};
use biome_formatter::write;

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

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

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

write!(f, [prefix_token.format(), value.format()])
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
use crate::prelude::*;
use biome_css_syntax::{CssUnicodeRangeInterval, CssUnicodeRangeIntervalFields};
use biome_formatter::write;

#[derive(Debug, Clone, Default)]
pub(crate) struct FormatCssUnicodeRangeInterval;
impl FormatNodeRule<CssUnicodeRangeInterval> for FormatCssUnicodeRangeInterval {
fn fmt_fields(&self, node: &CssUnicodeRangeInterval, f: &mut CssFormatter) -> FormatResult<()> {
let CssUnicodeRangeIntervalFields {
start,
minus_token,
end,
} = node.as_fields();
write!(f, [start.format(), minus_token.format(), end.format()])
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
use crate::prelude::*;
use biome_css_syntax::{CssUnicodeRangeWildcard, CssUnicodeRangeWildcardFields};
use biome_formatter::write;

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

write!(f, [value_token.format(),])
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
use crate::FormatBogusNodeRule;
use biome_css_syntax::CssBogusUnicodeRangeValue;
#[derive(Debug, Clone, Default)]
pub(crate) struct FormatCssBogusUnicodeRangeValue;
impl FormatBogusNodeRule<CssBogusUnicodeRangeValue> for FormatCssBogusUnicodeRangeValue {}
1 change: 1 addition & 0 deletions crates/biome_css_formatter/src/css/bogus/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ pub(crate) mod bogus_rule;
pub(crate) mod bogus_scope_range;
pub(crate) mod bogus_selector;
pub(crate) mod bogus_sub_selector;
pub(crate) mod bogus_unicode_range_value;
pub(crate) mod bogus_url_modifier;
pub(crate) mod unknown_at_rule_component_list;
pub(crate) mod value_at_rule_generic_value;
Loading

0 comments on commit ac925c3

Please sign in to comment.