Add expr_2021 nonterminal and feature flag
This commit adds a new nonterminal `expr_2021` in macro patterns, and `expr_fragment_specifier_2024` feature flag. For now, `expr` and `expr_2021` are treated the same, but in future PRs we will update `expr` to match to new grammar. Co-authored-by: Vincezo Palazzo <vincenzopalazzodev@gmail.com>
This commit is contained in:
parent
030a12ce2b
commit
ef6478ba5f
10 changed files with 48 additions and 3 deletions
|
@ -37,7 +37,7 @@ impl<'a> Parser<'a> {
|
|||
}
|
||||
|
||||
match kind {
|
||||
NonterminalKind::Expr => {
|
||||
NonterminalKind::Expr | NonterminalKind::Expr2021 => {
|
||||
token.can_begin_expr()
|
||||
// This exception is here for backwards compatibility.
|
||||
&& !token.is_keyword(kw::Let)
|
||||
|
@ -145,7 +145,9 @@ impl<'a> Parser<'a> {
|
|||
})?)
|
||||
}
|
||||
|
||||
NonterminalKind::Expr => NtExpr(self.parse_expr_force_collect()?),
|
||||
NonterminalKind::Expr | NonterminalKind::Expr2021 => {
|
||||
NtExpr(self.parse_expr_force_collect()?)
|
||||
}
|
||||
NonterminalKind::Literal => {
|
||||
// The `:literal` matcher does not support attributes
|
||||
NtLiteral(self.collect_tokens_no_attrs(|this| this.parse_literal_maybe_minus())?)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue