-
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
88 additions
and
28 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
#[cfg(feature = "serde")] | ||
use serde::Serialize; | ||
|
||
use crate::Atom; | ||
|
||
#[derive(Debug, PartialEq, Hash)] | ||
#[cfg_attr(feature = "serde", derive(Serialize), serde(tag = "type"))] | ||
// TODO: maybe make this an enum? Can use: | ||
// https://www.iana.org/assignments/character-sets/character-sets.xhtml | ||
pub struct Charset { | ||
// Common charsets | ||
// atom!("UTF-8") | ||
// atom!("utf-8") | ||
pub encoding: Atom, | ||
} |
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 |
---|---|---|
@@ -1,3 +1,5 @@ | ||
pub mod charset; | ||
pub mod page; | ||
|
||
pub use charset::*; | ||
pub use page::*; |
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
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,14 @@ | ||
use hdx_ast::css::rules::charset::Charset; | ||
use oxc_allocator::Vec; | ||
|
||
use crate::{atom, diagnostics, Atom, Atomizable, Kind, Parse, Parser, Result, Spanned}; | ||
|
||
impl<'a> Parse<'a> for Charset { | ||
fn parse(parser: &mut Parser<'a>) -> Result<Spanned<Self>> { | ||
let span = parser.cur().span; | ||
parser.expect_at_keyword_of(atom!("charset"))?; | ||
let encoding = parser.expect_string()?; | ||
parser.expect(Kind::Semicolon)?; | ||
Ok(Self { encoding }.spanned(span.up_to(&parser.cur().span))) | ||
} | ||
} |
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 |
---|---|---|
@@ -1,3 +1,4 @@ | ||
pub mod charset; | ||
pub mod page; | ||
|
||
use crate::{Kind, Parse, Parser, Result, Spanned}; | ||
|
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
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