@@ -83,7 +83,7 @@ use syntax::print::pprust;
83
83
use syntax:: sess:: ParseSess ;
84
84
use syntax:: symbol:: { kw, sym, Symbol } ;
85
85
use syntax:: token:: { self , DocComment , Nonterminal , Token } ;
86
- use syntax:: tokenstream:: { DelimSpan , TokenStream } ;
86
+ use syntax:: tokenstream:: TokenStream ;
87
87
88
88
use errors:: { PResult , FatalError } ;
89
89
use smallvec:: { smallvec, SmallVec } ;
@@ -164,11 +164,6 @@ struct MatcherPos<'root, 'tt> {
164
164
/// The position of the "dot" in this matcher
165
165
idx : usize ,
166
166
167
- /// The first span of source that the beginning of this matcher corresponds to. In other
168
- /// words, the token in the source whose span is `sp_open` is matched against the first token of
169
- /// the matcher.
170
- sp_open : Span ,
171
-
172
167
/// For each named metavar in the matcher, we keep track of token trees matched against the
173
168
/// metavar by the black box parser. In particular, there may be more than one match per
174
169
/// metavar if we are in a repetition (each repetition matches each of the variables).
@@ -307,17 +302,15 @@ fn create_matches(len: usize) -> Box<[Lrc<NamedMatchVec>]> {
307
302
}
308
303
309
304
/// Generates the top-level matcher position in which the "dot" is before the first token of the
310
- /// matcher `ms` and we are going to start matching at the span `open` in the source .
311
- fn initial_matcher_pos < ' root , ' tt > ( ms : & ' tt [ TokenTree ] , open : Span ) -> MatcherPos < ' root , ' tt > {
305
+ /// matcher `ms`.
306
+ fn initial_matcher_pos < ' root , ' tt > ( ms : & ' tt [ TokenTree ] ) -> MatcherPos < ' root , ' tt > {
312
307
let match_idx_hi = count_names ( ms) ;
313
308
let matches = create_matches ( match_idx_hi) ;
314
309
MatcherPos {
315
310
// Start with the top level matcher given to us
316
311
top_elts : TtSeq ( ms) , // "elts" is an abbr. for "elements"
317
312
// The "dot" is before the first token of the matcher
318
313
idx : 0 ,
319
- // We start matching at the span `open` in the source code
320
- sp_open : open,
321
314
322
315
// Initialize `matches` to a bunch of empty `Vec`s -- one for each metavar in `top_elts`.
323
316
// `match_lo` for `top_elts` is 0 and `match_hi` is `matches.len()`. `match_cur` is 0 since
@@ -355,7 +348,7 @@ fn initial_matcher_pos<'root, 'tt>(ms: &'tt [TokenTree], open: Span) -> MatcherP
355
348
/// token tree it was derived from.
356
349
#[ derive( Debug , Clone ) ]
357
350
crate enum NamedMatch {
358
- MatchedSeq ( Lrc < NamedMatchVec > , DelimSpan ) ,
351
+ MatchedSeq ( Lrc < NamedMatchVec > ) ,
359
352
MatchedNonterminal ( Lrc < Nonterminal > ) ,
360
353
}
361
354
@@ -497,8 +490,7 @@ fn inner_parse_loop<'root, 'tt>(
497
490
// Add matches from this repetition to the `matches` of `up`
498
491
for idx in item. match_lo ..item. match_hi {
499
492
let sub = item. matches [ idx] . clone ( ) ;
500
- let span = DelimSpan :: from_pair ( item. sp_open , token. span ) ;
501
- new_pos. push_match ( idx, MatchedSeq ( sub, span) ) ;
493
+ new_pos. push_match ( idx, MatchedSeq ( sub) ) ;
502
494
}
503
495
504
496
// Move the "dot" past the repetition in `up`
@@ -552,7 +544,7 @@ fn inner_parse_loop<'root, 'tt>(
552
544
new_item. match_cur += seq. num_captures ;
553
545
new_item. idx += 1 ;
554
546
for idx in item. match_cur ..item. match_cur + seq. num_captures {
555
- new_item. push_match ( idx, MatchedSeq ( Lrc :: new ( smallvec ! [ ] ) , sp ) ) ;
547
+ new_item. push_match ( idx, MatchedSeq ( Lrc :: new ( smallvec ! [ ] ) ) ) ;
556
548
}
557
549
cur_items. push ( new_item) ;
558
550
}
@@ -568,7 +560,6 @@ fn inner_parse_loop<'root, 'tt>(
568
560
match_cur : item. match_cur ,
569
561
match_hi : item. match_cur + seq. num_captures ,
570
562
up : Some ( item) ,
571
- sp_open : sp. open ,
572
563
top_elts : Tt ( TokenTree :: Sequence ( sp, seq) ) ,
573
564
} ) ) ) ;
574
565
}
@@ -663,7 +654,7 @@ pub(super) fn parse(
663
654
//
664
655
// This MatcherPos instance is allocated on the stack. All others -- and
665
656
// there are frequently *no* others! -- are allocated on the heap.
666
- let mut initial = initial_matcher_pos ( ms, parser . token . span ) ;
657
+ let mut initial = initial_matcher_pos ( ms) ;
667
658
let mut cur_items = smallvec ! [ MatcherPosHandle :: Ref ( & mut initial) ] ;
668
659
let mut next_items = Vec :: new ( ) ;
669
660
0 commit comments