-
-
Notifications
You must be signed in to change notification settings - Fork 442
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(css_parser): implement CSS unicode range (#3251)
Co-authored-by: ty <[email protected]>
- Loading branch information
1 parent
c502f6a
commit 6ad7fbf
Showing
35 changed files
with
3,280 additions
and
118 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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), | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 13 additions & 0 deletions
13
crates/biome_css_formatter/src/css/auxiliary/unicode_codepoint.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
16
crates/biome_css_formatter/src/css/auxiliary/unicode_range.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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()]) | ||
} | ||
} |
16 changes: 16 additions & 0 deletions
16
crates/biome_css_formatter/src/css/auxiliary/unicode_range_interval.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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()]) | ||
} | ||
} |
13 changes: 13 additions & 0 deletions
13
crates/biome_css_formatter/src/css/auxiliary/unicode_range_wildcard.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
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(),]) | ||
} | ||
} |
5 changes: 5 additions & 0 deletions
5
crates/biome_css_formatter/src/css/bogus/bogus_unicode_range_value.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.