@@ -26,6 +26,7 @@ extern crate ra_ap_rustc_lexer as rustc_lexer;
26
26
#[ cfg( feature = "in-rust-tree" ) ]
27
27
extern crate rustc_lexer;
28
28
29
+ mod edition;
29
30
mod event;
30
31
mod grammar;
31
32
mod input;
@@ -42,6 +43,7 @@ mod tests;
42
43
pub ( crate ) use token_set:: TokenSet ;
43
44
44
45
pub use crate :: {
46
+ edition:: Edition ,
45
47
input:: Input ,
46
48
lexed_str:: LexedStr ,
47
49
output:: { Output , Step } ,
@@ -86,7 +88,7 @@ pub enum TopEntryPoint {
86
88
}
87
89
88
90
impl TopEntryPoint {
89
- pub fn parse ( & self , input : & Input ) -> Output {
91
+ pub fn parse ( & self , input : & Input , edition : Edition ) -> Output {
90
92
let _p = tracing:: span!( tracing:: Level :: INFO , "TopEntryPoint::parse" , ?self ) . entered ( ) ;
91
93
let entry_point: fn ( & ' _ mut parser:: Parser < ' _ > ) = match self {
92
94
TopEntryPoint :: SourceFile => grammar:: entry:: top:: source_file,
@@ -98,7 +100,7 @@ impl TopEntryPoint {
98
100
TopEntryPoint :: MetaItem => grammar:: entry:: top:: meta_item,
99
101
TopEntryPoint :: MacroEagerInput => grammar:: entry:: top:: eager_macro_input,
100
102
} ;
101
- let mut p = parser:: Parser :: new ( input) ;
103
+ let mut p = parser:: Parser :: new ( input, edition ) ;
102
104
entry_point ( & mut p) ;
103
105
let events = p. finish ( ) ;
104
106
let res = event:: process ( events) ;
@@ -150,7 +152,7 @@ pub enum PrefixEntryPoint {
150
152
}
151
153
152
154
impl PrefixEntryPoint {
153
- pub fn parse ( & self , input : & Input ) -> Output {
155
+ pub fn parse ( & self , input : & Input , edition : Edition ) -> Output {
154
156
let entry_point: fn ( & ' _ mut parser:: Parser < ' _ > ) = match self {
155
157
PrefixEntryPoint :: Vis => grammar:: entry:: prefix:: vis,
156
158
PrefixEntryPoint :: Block => grammar:: entry:: prefix:: block,
@@ -163,7 +165,7 @@ impl PrefixEntryPoint {
163
165
PrefixEntryPoint :: Item => grammar:: entry:: prefix:: item,
164
166
PrefixEntryPoint :: MetaItem => grammar:: entry:: prefix:: meta_item,
165
167
} ;
166
- let mut p = parser:: Parser :: new ( input) ;
168
+ let mut p = parser:: Parser :: new ( input, edition ) ;
167
169
entry_point ( & mut p) ;
168
170
let events = p. finish ( ) ;
169
171
event:: process ( events)
@@ -187,9 +189,9 @@ impl Reparser {
187
189
///
188
190
/// Tokens must start with `{`, end with `}` and form a valid brace
189
191
/// sequence.
190
- pub fn parse ( self , tokens : & Input ) -> Output {
192
+ pub fn parse ( self , tokens : & Input , edition : Edition ) -> Output {
191
193
let Reparser ( r) = self ;
192
- let mut p = parser:: Parser :: new ( tokens) ;
194
+ let mut p = parser:: Parser :: new ( tokens, edition ) ;
193
195
r ( & mut p) ;
194
196
let events = p. finish ( ) ;
195
197
event:: process ( events)
0 commit comments