Parse raw elements, attributes, and web components in rsx (#2655)
* parse raw elements and attributes in rsx --------- Co-authored-by: Jonathan Kelley <jkelleyrtp@gmail.com>
This commit is contained in:
1 parent
fa4e5dbf62
commit
3bb9a535d8
6 files changed
+42
-9
No files matched your search
@@ -358,7 +358,8 @@ impl ToTokens for ElementName {
|
||||
|
||||
impl Parse for ElementName {
|
||||
fn parse(stream: ParseStream) -> Result<Self> {
|
||||
let raw = Punctuated::<Ident, Token![-]>::parse_separated_nonempty(stream)?;
|
||||
let raw =
|
||||
Punctuated::<Ident, Token![-]>::parse_separated_nonempty_with(stream, parse_raw_ident)?;
|
||||
if raw.len() == 1 {
|
||||
Ok(ElementName::Ident(raw.into_iter().next().unwrap()))
|
||||
} else {
|
||||
@@ -607,3 +608,14 @@ fn diagnositcs() {
|
||||
|
||||
let _parsed: Element = syn::parse2(input).unwrap();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn parses_raw_elements() {
|
||||
let input = quote::quote! {
|
||||
use {
|
||||
"hello"
|
||||
}
|
||||
};
|
||||
|
||||
let _parsed: Element = syn::parse2(input).unwrap();
|
||||
}
|
||||
Reference in new issue
Block a user