//! Implementation of `syn::parse::Parse` for styles, and associated helper data/functions. // TODO make all parsers use HyphenWord where appropriate. // TODO make all error messages nice // TODO 100% test coverage // TODO see if I can get https://github.com/rust-lang/rust/issues/67544 accepted. then change "em" to // em and "ex" to ex. // TODO Split out extra "Dynamic" layer for each type for use in proc macro (so we can have `{ }`) use crate::*; use proc_macro2::Span; use std::{ cell::RefCell, collections::BTreeSet, fmt::{self, Write}, ops::RangeBounds, str, }; use syn::{ ext::IdentExt, parse::{discouraged::Speculative, Parse, ParseStream}, punctuated::Punctuated, spanned::Spanned, Ident, Token, }; use super::{DynamicStyle, DynamicStyles, Styles}; impl Parse for DynamicStyles { fn parse(s: ParseStream) -> syn::Result { let punc = s.parse_terminated::<_, Token![;]>(::parse)?; Ok(DynamicStyles::from(punc.into_iter().collect::>())) } } impl Parse for Styles { fn parse(s: ParseStream) -> syn::Result { let punc = s.parse_terminated::<_, Token![;]>(