Fix capturing trailing whitespace for switches.

This commit is contained in:
Tom Alexander 2023-10-04 11:34:01 -04:00
parent 317293f0f2
commit 03028889bd
Signed by: talexander
GPG Key ID: D3A179C9A53C0EDE

View File

@ -328,10 +328,13 @@ enum SwitchState {
#[cfg_attr(feature = "tracing", tracing::instrument(ret, level = "debug"))] #[cfg_attr(feature = "tracing", tracing::instrument(ret, level = "debug"))]
fn example_switches<'s>(input: OrgSource<'s>) -> Res<OrgSource<'s>, ExampleSwitches<'s>> { fn example_switches<'s>(input: OrgSource<'s>) -> Res<OrgSource<'s>, ExampleSwitches<'s>> {
let mut number_lines = None; let mut number_lines = None;
let (remaining, (source, words)) = consumed(separated_list1( let (remaining, (source, (words, _))) = consumed(tuple((
space1, separated_list1(
map(is_not(" \t\r\n"), |val| Into::<&str>::into(val)), space1,
))(input)?; map(is_not(" \t\r\n"), |val| Into::<&str>::into(val)),
),
space0,
)))(input)?;
let mut state = SwitchState::Normal; let mut state = SwitchState::Normal;
for word in words { for word in words {