Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/mbe/src/syntax_bridge.rs')
| -rw-r--r-- | crates/mbe/src/syntax_bridge.rs | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/crates/mbe/src/syntax_bridge.rs b/crates/mbe/src/syntax_bridge.rs index c934db6b71..3230eeb5bd 100644 --- a/crates/mbe/src/syntax_bridge.rs +++ b/crates/mbe/src/syntax_bridge.rs @@ -3,7 +3,7 @@ use std::fmt; use rustc_hash::{FxHashMap, FxHashSet}; -use span::{SpanAnchor, SpanData, SpanMap}; +use span::{Edition, SpanAnchor, SpanData, SpanMap}; use stdx::{never, non_empty_vec::NonEmptyVec}; use syntax::{ ast::{self, make::tokens::doc_comment}, @@ -119,6 +119,7 @@ where pub fn token_tree_to_syntax_node<Ctx>( tt: &tt::Subtree<SpanData<Ctx>>, entry_point: parser::TopEntryPoint, + edition: parser::Edition, ) -> (Parse<SyntaxNode>, SpanMap<Ctx>) where SpanData<Ctx>: Copy + fmt::Debug, @@ -131,7 +132,7 @@ where _ => TokenBuffer::from_subtree(tt), }; let parser_input = to_parser_input(&buffer); - let parser_output = entry_point.parse(&parser_input); + let parser_output = entry_point.parse(&parser_input, edition); let mut tree_sink = TtTreeSink::new(buffer.begin()); for event in parser_output.iter() { match event { @@ -182,7 +183,12 @@ where } /// Split token tree with separate expr: $($e:expr)SEP* -pub fn parse_exprs_with_sep<S>(tt: &tt::Subtree<S>, sep: char, span: S) -> Vec<tt::Subtree<S>> +pub fn parse_exprs_with_sep<S>( + tt: &tt::Subtree<S>, + sep: char, + span: S, + edition: Edition, +) -> Vec<tt::Subtree<S>> where S: Copy + fmt::Debug, { @@ -194,7 +200,7 @@ where let mut res = Vec::new(); while iter.peek_n(0).is_some() { - let expanded = iter.expect_fragment(parser::PrefixEntryPoint::Expr); + let expanded = iter.expect_fragment(parser::PrefixEntryPoint::Expr, edition); res.push(match expanded.value { None => break, |