edit: change 'Length' to 'Len'

This commit is contained in:
randomicon00 2024-06-11 08:49:30 -04:00
parent f6fc109fcb
commit df63300092
3 changed files with 5 additions and 5 deletions

View file

@ -566,7 +566,7 @@ fn match_loop_inner<'t>(
error_items.push(item);
}
OpDelimited::Op(
Op::Ignore { .. } | Op::Index { .. } | Op::Count { .. } | Op::Length { .. },
Op::Ignore { .. } | Op::Index { .. } | Op::Count { .. } | Op::Len { .. },
) => {
stdx::never!("metavariable expression in lhs found");
}
@ -832,7 +832,7 @@ fn collect_vars(collector_fun: &mut impl FnMut(SmolStr), pattern: &MetaTemplate)
Op::Subtree { tokens, .. } => collect_vars(collector_fun, tokens),
Op::Repeat { tokens, .. } => collect_vars(collector_fun, tokens),
Op::Literal(_) | Op::Ident(_) | Op::Punct(_) => {}
Op::Ignore { .. } | Op::Index { .. } | Op::Count { .. } | Op::Length { .. } => {
Op::Ignore { .. } | Op::Index { .. } | Op::Count { .. } | Op::Len { .. } => {
stdx::never!("metavariable expression in lhs found");
}
}

View file

@ -242,7 +242,7 @@ fn expand_subtree(
.into(),
);
}
Op::Length { depth } => {
Op::Len { depth } => {
let length = ctx.nesting.get(ctx.nesting.len() - 1 - depth).map_or(0, |_nest| {
// FIXME: to be implemented
0

View file

@ -75,7 +75,7 @@ pub(crate) enum Op {
Index {
depth: usize,
},
Length {
Len {
depth: usize,
},
Count {
@ -345,7 +345,7 @@ fn parse_metavar_expr(new_meta_vars: bool, src: &mut TtIter<'_, Span>) -> Result
Op::Ignore { name: ident.text.clone(), id: ident.span }
}
"index" => Op::Index { depth: parse_depth(&mut args)? },
"length" => Op::Length { depth: parse_depth(&mut args)? },
"len" => Op::Len { depth: parse_depth(&mut args)? },
"count" => {
if new_meta_vars {
args.expect_dollar()?;