@@ -78,7 +78,7 @@ use crate::ast::Ident;
7878use crate :: ext:: tt:: quoted:: { self , TokenTree } ;
7979use crate :: parse:: { Directory , ParseSess } ;
8080use crate :: parse:: parser:: { Parser , PathStyle } ;
81- use crate :: parse:: token:: { self , DocComment , Nonterminal , Token } ;
81+ use crate :: parse:: token:: { self , DocComment , Nonterminal , TokenKind } ;
8282use crate :: print:: pprust;
8383use crate :: symbol:: { kw, sym, Symbol } ;
8484use crate :: tokenstream:: { DelimSpan , TokenStream } ;
@@ -199,7 +199,7 @@ struct MatcherPos<'root, 'tt: 'root> {
199199 seq_op : Option < quoted:: KleeneOp > ,
200200
201201 /// The separator if we are in a repetition.
202- sep : Option < Token > ,
202+ sep : Option < TokenKind > ,
203203
204204 /// The "parent" matcher position if we are in a repetition. That is, the matcher position just
205205 /// before we enter the sequence.
@@ -273,7 +273,7 @@ pub enum ParseResult<T> {
273273 Success ( T ) ,
274274 /// Arm failed to match. If the second parameter is `token::Eof`, it indicates an unexpected
275275 /// end of macro invocation. Otherwise, it indicates that no rules expected the given token.
276- Failure ( syntax_pos:: Span , Token , & ' static str ) ,
276+ Failure ( syntax_pos:: Span , TokenKind , & ' static str ) ,
277277 /// Fatal error (malformed macro?). Abort compilation.
278278 Error ( syntax_pos:: Span , String ) ,
279279}
@@ -417,7 +417,7 @@ fn nameize<I: Iterator<Item = NamedMatch>>(
417417
418418/// Generates an appropriate parsing failure message. For EOF, this is "unexpected end...". For
419419/// other tokens, this is "unexpected token...".
420- pub fn parse_failure_msg ( tok : Token ) -> String {
420+ pub fn parse_failure_msg ( tok : TokenKind ) -> String {
421421 match tok {
422422 token:: Eof => "unexpected end of macro invocation" . to_string ( ) ,
423423 _ => format ! (
@@ -428,7 +428,7 @@ pub fn parse_failure_msg(tok: Token) -> String {
428428}
429429
430430/// Performs a token equality check, ignoring syntax context (that is, an unhygienic comparison)
431- fn token_name_eq ( t1 : & Token , t2 : & Token ) -> bool {
431+ fn token_name_eq ( t1 : & TokenKind , t2 : & TokenKind ) -> bool {
432432 if let ( Some ( ( id1, is_raw1) ) , Some ( ( id2, is_raw2) ) ) = ( t1. ident ( ) , t2. ident ( ) ) {
433433 id1. name == id2. name && is_raw1 == is_raw2
434434 } else if let ( Some ( id1) , Some ( id2) ) = ( t1. lifetime ( ) , t2. lifetime ( ) ) {
@@ -466,7 +466,7 @@ fn inner_parse_loop<'root, 'tt>(
466466 next_items : & mut Vec < MatcherPosHandle < ' root , ' tt > > ,
467467 eof_items : & mut SmallVec < [ MatcherPosHandle < ' root , ' tt > ; 1 ] > ,
468468 bb_items : & mut SmallVec < [ MatcherPosHandle < ' root , ' tt > ; 1 ] > ,
469- token : & Token ,
469+ token : & TokenKind ,
470470 span : syntax_pos:: Span ,
471471) -> ParseResult < ( ) > {
472472 // Pop items from `cur_items` until it is empty.
@@ -807,7 +807,7 @@ pub fn parse(
807807
808808/// The token is an identifier, but not `_`.
809809/// We prohibit passing `_` to macros expecting `ident` for now.
810- fn get_macro_ident ( token : & Token ) -> Option < ( Ident , bool ) > {
810+ fn get_macro_ident ( token : & TokenKind ) -> Option < ( Ident , bool ) > {
811811 match * token {
812812 token:: Ident ( ident, is_raw) if ident. name != kw:: Underscore =>
813813 Some ( ( ident, is_raw) ) ,
@@ -819,7 +819,7 @@ fn get_macro_ident(token: &Token) -> Option<(Ident, bool)> {
819819///
820820/// Returning `false` is a *stability guarantee* that such a matcher will *never* begin with that
821821/// token. Be conservative (return true) if not sure.
822- fn may_begin_with ( name : Symbol , token : & Token ) -> bool {
822+ fn may_begin_with ( name : Symbol , token : & TokenKind ) -> bool {
823823 /// Checks whether the non-terminal may contain a single (non-keyword) identifier.
824824 fn may_be_ident ( nt : & token:: Nonterminal ) -> bool {
825825 match * nt {
0 commit comments