parser: allow any token to be a metaidentifier

This commit is contained in:
John 2025-09-21 02:24:15 -04:00
parent 7b05da1334
commit b1619f6e4e

View File

@ -232,7 +232,7 @@ impl<'t> Parse<'t> for Pat {
"_" => p.consume().then(Pat::Ignore),
_ => Pat::Name(p.take_lexeme().expect("should have Token")),
},
TKind::Grave => Pat::MetId(p.consume().next_if(TKind::Identifier)?.lexeme),
TKind::Grave => Pat::MetId(p.consume().next()?.lexeme),
TKind::DotDot => Pat::Rest(match p.consume().peek_if(TKind::Identifier) {
Some(_) => Some(p.parse(level)?),
None => None,
@ -518,7 +518,7 @@ impl<'t> Parse<'t> for Expr {
Ps::End => Err(ParseError::NotPrefix(tok.kind, span))?,
Ps::Id => Expr::Id(p.take_lexeme().expect("should have ident")),
Ps::Mid => Expr::MetId(p.consume().next_if(TKind::Identifier)?.lexeme),
Ps::Mid => Expr::MetId(p.consume().next()?.lexeme),
Ps::Lit => Expr::Lit(p.parse(())?),
Ps::Let => Expr::Let(
p.consume().parse(PPrec::Alt)?,