Skip to main content

css_ast/
lib.rs

1#![deny(warnings)]
2
3mod constraints;
4mod css_atom_set;
5mod diagnostics;
6mod functions;
7mod metadata;
8mod properties;
9mod property_atoms;
10mod rules;
11mod selector;
12pub mod specificity;
13mod stylerule;
14mod stylesheet;
15#[cfg(test)]
16mod test_helpers;
17mod traits;
18mod types;
19mod units;
20mod values;
21#[cfg(feature = "visitable")]
22pub mod visit;
23
24pub use constraints::*;
25pub use css_atom_set::*;
26pub use css_parse::{Declaration, DeclarationValue, Diagnostic};
27pub use functions::*;
28pub use metadata::*;
29pub use properties::*;
30pub use rules::*;
31pub use selector::*;
32pub use stylerule::*;
33pub use stylesheet::*;
34pub use traits::*;
35pub use types::*;
36pub use units::*;
37pub use values::*;
38#[cfg(feature = "visitable")]
39pub use visit::*;
40
41use crate::diagnostics::CssDiagnostic;
42
43use css_parse::{
44	Cursor, CursorSink, KindSet, NodeMetadata, NodeWithMetadata, Parse, Parser, Peek, Result as ParserResult,
45	SemanticEq, Span, ToCursors, ToSpan,
46};
47
48// TODO! - delete this when we're done ;)
49#[derive(Default, Debug, Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
50#[cfg_attr(feature = "serde", derive(serde::Serialize), serde(untagged))]
51#[cfg_attr(feature = "visitable", derive(csskit_derives::Visitable), visit(skip))]
52pub enum Todo {
53	#[default]
54	Todo,
55}
56
57impl<'a> Peek<'a> for Todo {
58	const PEEK_KINDSET: KindSet = KindSet::NONE;
59}
60
61impl<'a> Parse<'a> for Todo {
62	fn parse<I>(p: &mut Parser<'a, I>) -> ParserResult<Self>
63	where
64		I: Iterator<Item = Cursor> + Clone,
65	{
66		Err(Diagnostic::new(p.next(), Diagnostic::unimplemented))?
67	}
68}
69
70impl ToCursors for Todo {
71	fn to_cursors(&self, _: &mut impl CursorSink) {}
72}
73
74impl ToSpan for Todo {
75	fn to_span(&self) -> Span {
76		Span::DUMMY
77	}
78}
79
80impl SemanticEq for Todo {
81	fn semantic_eq(&self, _: &Self) -> bool {
82		false
83	}
84}
85
86impl<M: NodeMetadata> NodeWithMetadata<M> for Todo {
87	fn metadata(&self) -> M {
88		M::default()
89	}
90}