From 4a8a7dd5f4c71dca9ec15e5309abddd79de2d167 Mon Sep 17 00:00:00 2001 From: Demonthos <66571940+Demonthos@users.noreply.github.com> Date: Wed, 27 Jul 2022 15:52:09 -0500 Subject: [PATCH] allow the last attribute in a component to contain formatting (#504) --- packages/rsx/src/component.rs | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/packages/rsx/src/component.rs b/packages/rsx/src/component.rs index f4f1a9bc6..b4a6a4a93 100644 --- a/packages/rsx/src/component.rs +++ b/packages/rsx/src/component.rs @@ -234,13 +234,15 @@ impl Parse for ComponentField { let content = ContentField::ManExpr(input.parse()?); return Ok(Self { name, content }); } - - if input.peek(LitStr) && input.peek2(Token![,]) { - let t: LitStr = input.fork().parse()?; - - if is_literal_foramtted(&t) { - let content = ContentField::Formatted(input.parse()?); - return Ok(Self { name, content }); + if input.peek(LitStr) { + let forked = input.fork(); + let t: LitStr = forked.parse()?; + // the string literal must either be the end of the input or a followed by a comma + if forked.is_empty() || forked.peek(Token![,]) { + if is_literal_foramtted(&t) { + let content = ContentField::Formatted(input.parse()?); + return Ok(Self { name, content }); + } } }