Rollup merge of #34385 - cgswords:tstream, r=nrc
syntax-[breaking-change] cc #31645 (Only breaking because ast::TokenTree is now tokenstream::TokenTree.) This pull request refactors TokenTrees into their own file as src/libsyntax/tokenstream.rs, moving them out of src/libsyntax/ast.rs, in order to prepare for an accompanying TokenStream implementation (per RFC 1566).
This commit is contained in:
commit
82a15a6a0a
34 changed files with 342 additions and 287 deletions
|
@ -33,7 +33,7 @@ use ast::{Stmt, StmtKind};
|
|||
use ast::{VariantData, StructField};
|
||||
use ast::StrStyle;
|
||||
use ast::SelfKind;
|
||||
use ast::{Delimited, SequenceRepetition, TokenTree, TraitItem, TraitRef};
|
||||
use ast::{TraitItem, TraitRef};
|
||||
use ast::{Ty, TyKind, TypeBinding, TyParam, TyParamBounds};
|
||||
use ast::{ViewPath, ViewPathGlob, ViewPathList, ViewPathSimple};
|
||||
use ast::{Visibility, WhereClause};
|
||||
|
@ -56,6 +56,7 @@ use util::parser::{AssocOp, Fixity};
|
|||
use print::pprust;
|
||||
use ptr::P;
|
||||
use parse::PResult;
|
||||
use tokenstream::{self, Delimited, SequenceRepetition, TokenTree};
|
||||
|
||||
use std::collections::HashSet;
|
||||
use std::mem;
|
||||
|
@ -2746,16 +2747,17 @@ impl<'a> Parser<'a> {
|
|||
/// Parse an optional separator followed by a Kleene-style
|
||||
/// repetition token (+ or *).
|
||||
pub fn parse_sep_and_kleene_op(&mut self)
|
||||
-> PResult<'a, (Option<token::Token>, ast::KleeneOp)> {
|
||||
fn parse_kleene_op<'a>(parser: &mut Parser<'a>) -> PResult<'a, Option<ast::KleeneOp>> {
|
||||
-> PResult<'a, (Option<token::Token>, tokenstream::KleeneOp)> {
|
||||
fn parse_kleene_op<'a>(parser: &mut Parser<'a>) ->
|
||||
PResult<'a, Option<tokenstream::KleeneOp>> {
|
||||
match parser.token {
|
||||
token::BinOp(token::Star) => {
|
||||
parser.bump();
|
||||
Ok(Some(ast::KleeneOp::ZeroOrMore))
|
||||
Ok(Some(tokenstream::KleeneOp::ZeroOrMore))
|
||||
},
|
||||
token::BinOp(token::Plus) => {
|
||||
parser.bump();
|
||||
Ok(Some(ast::KleeneOp::OneOrMore))
|
||||
Ok(Some(tokenstream::KleeneOp::OneOrMore))
|
||||
},
|
||||
_ => Ok(None)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue