|
@@ -15,6 +15,7 @@ use syn::{
|
|
Error, Ident, Result, Token,
|
|
Error, Ident, Result, Token,
|
|
};
|
|
};
|
|
|
|
|
|
|
|
+#[allow(clippy::large_enum_variant)]
|
|
pub enum AmbiguousElement<const AS: HtmlOrRsx> {
|
|
pub enum AmbiguousElement<const AS: HtmlOrRsx> {
|
|
Element(Element<AS>),
|
|
Element(Element<AS>),
|
|
Component(Component<AS>),
|
|
Component(Component<AS>),
|
|
@@ -30,7 +31,6 @@ impl Parse for AmbiguousElement<AS_RSX> {
|
|
}
|
|
}
|
|
|
|
|
|
// If not an absolute path, then parse the ident and check if it's a valid tag
|
|
// If not an absolute path, then parse the ident and check if it's a valid tag
|
|
-
|
|
|
|
if let Ok(pat) = input.fork().parse::<syn::Path>() {
|
|
if let Ok(pat) = input.fork().parse::<syn::Path>() {
|
|
if pat.segments.len() > 1 {
|
|
if pat.segments.len() > 1 {
|
|
return input
|
|
return input
|
|
@@ -80,57 +80,6 @@ impl Parse for AmbiguousElement<AS_HTML> {
|
|
} else {
|
|
} else {
|
|
Err(Error::new(input.span(), "Not a valid Html tag"))
|
|
Err(Error::new(input.span(), "Not a valid Html tag"))
|
|
}
|
|
}
|
|
-
|
|
|
|
- // input.parse::<Token![>]>()?;
|
|
|
|
-
|
|
|
|
- // let mut children = Vec::new();
|
|
|
|
- // while !input.peek(Token![<]) {
|
|
|
|
- // children.push(input.parse::<BodyNode<AS_HTML>>()?);
|
|
|
|
- // }
|
|
|
|
-
|
|
|
|
- // Ok(AmbiguousElement::Element(Element {
|
|
|
|
- // name,
|
|
|
|
- // key: todo!(),
|
|
|
|
- // attributes: todo!(),
|
|
|
|
- // listeners: todo!(),
|
|
|
|
- // children,
|
|
|
|
- // _is_static: todo!(),
|
|
|
|
- // }))
|
|
|
|
-
|
|
|
|
- // // Try to parse as an absolute path and immediately defer to the componetn
|
|
|
|
- // if input.peek(Token![::]) {
|
|
|
|
- // return input
|
|
|
|
- // .parse::<Component<AS_HTML>>()
|
|
|
|
- // .map(AmbiguousElement::Component);
|
|
|
|
- // }
|
|
|
|
-
|
|
|
|
- // // If not an absolute path, then parse the ident and check if it's a valid tag
|
|
|
|
-
|
|
|
|
- // if let Ok(pat) = input.fork().parse::<syn::Path>() {
|
|
|
|
- // if pat.segments.len() > 1 {
|
|
|
|
- // return input
|
|
|
|
- // .parse::<Component<AS_HTML>>()
|
|
|
|
- // .map(AmbiguousElement::Component);
|
|
|
|
- // }
|
|
|
|
- // }
|
|
|
|
-
|
|
|
|
- // use syn::ext::IdentExt;
|
|
|
|
- // if let Ok(name) = input.fork().call(Ident::parse_any) {
|
|
|
|
- // let name_str = name.to_string();
|
|
|
|
-
|
|
|
|
- // let first_char = name_str.chars().next().unwrap();
|
|
|
|
- // if first_char.is_ascii_uppercase() {
|
|
|
|
- // input
|
|
|
|
- // .parse::<Component<AS_HTML>>()
|
|
|
|
- // .map(AmbiguousElement::Component)
|
|
|
|
- // } else {
|
|
|
|
- // input
|
|
|
|
- // .parse::<Element<AS_HTML>>()
|
|
|
|
- // .map(AmbiguousElement::Element)
|
|
|
|
- // }
|
|
|
|
- // } else {
|
|
|
|
- // Err(Error::new(input.span(), "Not a valid Html tag"))
|
|
|
|
- // }
|
|
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|