[breaking-change] don't glob export ast::KleeneOp variants
This commit is contained in:
parent
019614f03d
commit
798974cae5
|
@ -10,7 +10,6 @@
|
|||
|
||||
// The Rust abstract syntax tree.
|
||||
|
||||
pub use self::KleeneOp::*;
|
||||
pub use self::MacStmtStyle::*;
|
||||
pub use self::MetaItem_::*;
|
||||
pub use self::Mutability::*;
|
||||
|
|
|
@ -542,11 +542,6 @@ fn mk_tt_path(cx: &ExtCtxt, sp: Span, name: &str) -> P<ast::Expr> {
|
|||
cx.expr_path(cx.path_global(sp, idents))
|
||||
}
|
||||
|
||||
fn mk_ast_path(cx: &ExtCtxt, sp: Span, name: &str) -> P<ast::Expr> {
|
||||
let idents = vec!(id_ext("syntax"), id_ext("ast"), id_ext(name));
|
||||
cx.expr_path(cx.path_global(sp, idents))
|
||||
}
|
||||
|
||||
fn mk_token_path(cx: &ExtCtxt, sp: Span, name: &str) -> P<ast::Expr> {
|
||||
let idents = vec!(id_ext("syntax"), id_ext("parse"), id_ext("token"), id_ext(name));
|
||||
cx.expr_path(cx.path_global(sp, idents))
|
||||
|
@ -779,9 +774,16 @@ fn statements_mk_tt(cx: &ExtCtxt, tt: &TokenTree, matcher: bool) -> Vec<P<ast::S
|
|||
None => cx.expr_none(sp),
|
||||
};
|
||||
let e_op = match seq.op {
|
||||
ast::ZeroOrMore => mk_ast_path(cx, sp, "ZeroOrMore"),
|
||||
ast::OneOrMore => mk_ast_path(cx, sp, "OneOrMore"),
|
||||
ast::KleeneOp::ZeroOrMore => "ZeroOrMore",
|
||||
ast::KleeneOp::OneOrMore => "OneOrMore",
|
||||
};
|
||||
let e_op_idents = vec![
|
||||
id_ext("syntax"),
|
||||
id_ext("ast"),
|
||||
id_ext("KleeneOp"),
|
||||
id_ext(e_op),
|
||||
];
|
||||
let e_op = cx.expr_path(cx.path_global(sp, e_op_idents));
|
||||
let fields = vec![cx.field_imm(sp, id_ext("tts"), e_tts),
|
||||
cx.field_imm(sp, id_ext("separator"), e_separator),
|
||||
cx.field_imm(sp, id_ext("op"), e_op),
|
||||
|
|
|
@ -374,7 +374,7 @@ pub fn parse(sess: &ParseSess,
|
|||
match ei.top_elts.get_tt(idx) {
|
||||
/* need to descend into sequence */
|
||||
TokenTree::Sequence(sp, seq) => {
|
||||
if seq.op == ast::ZeroOrMore {
|
||||
if seq.op == ast::KleeneOp::ZeroOrMore {
|
||||
let mut new_ei = ei.clone();
|
||||
new_ei.match_cur += seq.num_captures;
|
||||
new_ei.idx += 1;
|
||||
|
|
|
@ -248,7 +248,7 @@ pub fn compile<'cx>(cx: &'cx mut ExtCtxt,
|
|||
TokenTree::Token(DUMMY_SP, token::FatArrow),
|
||||
TokenTree::Token(DUMMY_SP, match_rhs_tok)],
|
||||
separator: Some(token::Semi),
|
||||
op: ast::OneOrMore,
|
||||
op: ast::KleeneOp::OneOrMore,
|
||||
num_captures: 2
|
||||
})),
|
||||
//to phase into semicolon-termination instead of
|
||||
|
@ -257,7 +257,7 @@ pub fn compile<'cx>(cx: &'cx mut ExtCtxt,
|
|||
Rc::new(ast::SequenceRepetition {
|
||||
tts: vec![TokenTree::Token(DUMMY_SP, token::Semi)],
|
||||
separator: None,
|
||||
op: ast::ZeroOrMore,
|
||||
op: ast::KleeneOp::ZeroOrMore,
|
||||
num_captures: 0
|
||||
})));
|
||||
|
||||
|
|
|
@ -81,7 +81,7 @@ pub fn new_tt_reader_with_doc_flag<'a>(sp_diag: &'a Handler,
|
|||
forest: TokenTree::Sequence(DUMMY_SP, Rc::new(ast::SequenceRepetition {
|
||||
tts: src,
|
||||
// doesn't matter. This merely holds the root unzipping.
|
||||
separator: None, op: ast::ZeroOrMore, num_captures: 0
|
||||
separator: None, op: ast::KleeneOp::ZeroOrMore, num_captures: 0
|
||||
})),
|
||||
idx: 0,
|
||||
dotdotdoted: false,
|
||||
|
@ -257,7 +257,7 @@ pub fn tt_next_token(r: &mut TtReader) -> TokenAndSpan {
|
|||
}
|
||||
LisConstraint(len, _) => {
|
||||
if len == 0 {
|
||||
if seq.op == ast::OneOrMore {
|
||||
if seq.op == ast::KleeneOp::OneOrMore {
|
||||
// FIXME #2887 blame invoker
|
||||
panic!(r.sp_diag.span_fatal(sp.clone(),
|
||||
"this must repeat at least once"));
|
||||
|
|
|
@ -2599,11 +2599,11 @@ impl<'a> Parser<'a> {
|
|||
match parser.token {
|
||||
token::BinOp(token::Star) => {
|
||||
parser.bump();
|
||||
Ok(Some(ast::ZeroOrMore))
|
||||
Ok(Some(ast::KleeneOp::ZeroOrMore))
|
||||
},
|
||||
token::BinOp(token::Plus) => {
|
||||
parser.bump();
|
||||
Ok(Some(ast::OneOrMore))
|
||||
Ok(Some(ast::KleeneOp::OneOrMore))
|
||||
},
|
||||
_ => Ok(None)
|
||||
}
|
||||
|
|
|
@ -1489,8 +1489,8 @@ impl<'a> State<'a> {
|
|||
None => {},
|
||||
}
|
||||
match seq.op {
|
||||
ast::ZeroOrMore => word(&mut self.s, "*"),
|
||||
ast::OneOrMore => word(&mut self.s, "+"),
|
||||
ast::KleeneOp::ZeroOrMore => word(&mut self.s, "*"),
|
||||
ast::KleeneOp::OneOrMore => word(&mut self.s, "+"),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue