Skip to content

Commit 27381df

Browse files
committed
---
yaml --- r: 44744 b: refs/heads/master c: ff36986 h: refs/heads/master v: v3
1 parent 992e995 commit 27381df

File tree

4 files changed

+40
-40
lines changed

4 files changed

+40
-40
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
refs/heads/master: d346b51997a4a5d9f2e85aa41fc3113338b8a83b
2+
refs/heads/master: ff36986fa490917bcacfb4e5010e304d5e82f3bb
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: a6d9689399d091c3265f00434a69c551a61c28dc
55
refs/heads/try: ef355f6332f83371e4acf04fc4eb940ab41d78d3

trunk/src/libsyntax/parse/comments.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -354,7 +354,7 @@ pub fn gather_comments_and_literals(span_diagnostic: diagnostic::span_handler,
354354
rdr.next_token();
355355
//discard, and look ahead; we're working with internal state
356356
let TokenAndSpan {tok: tok, sp: sp} = rdr.peek();
357-
if token::is_lit(tok) {
357+
if token::is_lit(&tok) {
358358
let s = get_str_from(rdr, bstart);
359359
literals.push(lit {lit: s, pos: sp.lo});
360360
log(debug, ~"tok lit: " + s);

trunk/src/libsyntax/parse/parser.rs

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -656,7 +656,7 @@ pub impl Parser {
656656
} else if self.token_is_closure_keyword(&copy *self.token) {
657657
self.parse_ty_closure(None, None)
658658
} else if *self.token == token::MOD_SEP
659-
|| is_ident_or_path(*self.token) {
659+
|| is_ident_or_path(&*self.token) {
660660
let path = self.parse_path_with_tps(colons_before_params);
661661
ty_path(path, self.get_id())
662662
} else {
@@ -760,10 +760,10 @@ pub impl Parser {
760760
}
761761
} else { 0 };
762762
if offset == 0 {
763-
is_plain_ident(*self.token)
763+
is_plain_ident(&*self.token)
764764
&& self.look_ahead(1) == token::COLON
765765
} else {
766-
is_plain_ident(self.look_ahead(offset))
766+
is_plain_ident(&self.look_ahead(offset))
767767
&& self.look_ahead(offset + 1) == token::COLON
768768
}
769769
}
@@ -1141,7 +1141,7 @@ pub impl Parser {
11411141
return self.mk_expr(blk.span.lo, blk.span.hi,
11421142
expr_block(blk));
11431143
}
1144-
} else if token::is_bar(*self.token) {
1144+
} else if token::is_bar(&*self.token) {
11451145
return self.parse_lambda_expr();
11461146
} else if self.eat_keyword(&~"if") {
11471147
return self.parse_if_expr();
@@ -1215,13 +1215,13 @@ pub impl Parser {
12151215
ex = expr_assert(e);
12161216
hi = e.span.hi;
12171217
} else if self.eat_keyword(&~"return") {
1218-
if can_begin_expr(*self.token) {
1218+
if can_begin_expr(&*self.token) {
12191219
let e = self.parse_expr();
12201220
hi = e.span.hi;
12211221
ex = expr_ret(Some(e));
12221222
} else { ex = expr_ret(None); }
12231223
} else if self.eat_keyword(&~"break") {
1224-
if is_ident(*self.token) {
1224+
if is_ident(&*self.token) {
12251225
ex = expr_break(Some(self.parse_ident()));
12261226
} else {
12271227
ex = expr_break(None);
@@ -1232,7 +1232,7 @@ pub impl Parser {
12321232
ex = expr_copy(e);
12331233
hi = e.span.hi;
12341234
} else if *self.token == token::MOD_SEP ||
1235-
is_ident(*self.token) && !self.is_keyword(&~"true") &&
1235+
is_ident(&*self.token) && !self.is_keyword(&~"true") &&
12361236
!self.is_keyword(&~"false") {
12371237
let pth = self.parse_path_with_tps(true);
12381238

@@ -1914,11 +1914,11 @@ pub impl Parser {
19141914
// loop headers look like 'loop {' or 'loop unsafe {'
19151915
let is_loop_header =
19161916
*self.token == token::LBRACE
1917-
|| (is_ident(*self.token)
1917+
|| (is_ident(&*self.token)
19181918
&& self.look_ahead(1) == token::LBRACE);
19191919
// labeled loop headers look like 'loop foo: {'
19201920
let is_labeled_loop_header =
1921-
is_ident(*self.token)
1921+
is_ident(&*self.token)
19221922
&& !self.is_any_keyword(&copy *self.token)
19231923
&& self.look_ahead(1) == token::COLON;
19241924

@@ -1939,7 +1939,7 @@ pub impl Parser {
19391939
} else {
19401940
// This is a 'continue' expression
19411941
let lo = self.span.lo;
1942-
let ex = if is_ident(*self.token) {
1942+
let ex = if is_ident(&*self.token) {
19431943
expr_again(Some(self.parse_ident()))
19441944
} else {
19451945
expr_again(None)
@@ -1954,7 +1954,7 @@ pub impl Parser {
19541954
let lookahead = self.look_ahead(1);
19551955
*self.token == token::LBRACE &&
19561956
(self.token_is_keyword(&~"mut", &lookahead) ||
1957-
(is_plain_ident(lookahead) &&
1957+
(is_plain_ident(&lookahead) &&
19581958
self.look_ahead(2) == token::COLON))
19591959
}
19601960
@@ -2260,7 +2260,7 @@ pub impl Parser {
22602260
pat = ast::pat_vec(elements, tail);
22612261
}
22622262
copy tok => {
2263-
if !is_ident_or_path(tok)
2263+
if !is_ident_or_path(&tok)
22642264
|| self.is_keyword(&~"true")
22652265
|| self.is_keyword(&~"false")
22662266
{
@@ -2290,7 +2290,7 @@ pub impl Parser {
22902290
cannot_be_enum_or_struct = true
22912291
}
22922292

2293-
if is_plain_ident(*self.token) && cannot_be_enum_or_struct {
2293+
if is_plain_ident(&*self.token) && cannot_be_enum_or_struct {
22942294
let name = self.parse_value_path();
22952295
let sub;
22962296
if self.eat(&token::AT) {
@@ -2359,7 +2359,7 @@ pub impl Parser {
23592359

23602360
fn parse_pat_ident(refutable: bool,
23612361
binding_mode: ast::binding_mode) -> ast::pat_ {
2362-
if !is_plain_ident(*self.token) {
2362+
if !is_plain_ident(&*self.token) {
23632363
self.span_fatal(
23642364
*self.last_span,
23652365
~"expected identifier, found path");
@@ -2425,7 +2425,7 @@ pub impl Parser {
24252425
if self.eat_keyword(&~"mut") {
24262426
is_mutbl = struct_mutable;
24272427
}
2428-
if !is_plain_ident(*self.token) {
2428+
if !is_plain_ident(&*self.token) {
24292429
self.fatal(~"expected ident");
24302430
}
24312431
let name = self.parse_ident();
@@ -2454,7 +2454,7 @@ pub impl Parser {
24542454
self.expect_keyword(&~"let");
24552455
let decl = self.parse_let();
24562456
return @spanned(lo, decl.span.hi, stmt_decl(decl, self.get_id()));
2457-
} else if is_ident(*self.token)
2457+
} else if is_ident(&*self.token)
24582458
&& !self.is_any_keyword(&copy *self.token)
24592459
&& self.look_ahead(1) == token::NOT {
24602460

@@ -2716,7 +2716,7 @@ pub impl Parser {
27162716
~"`&static` is the only permissible \
27172717
region bound here");
27182718
}
2719-
} else if is_ident(*self.token) {
2719+
} else if is_ident(&*self.token) {
27202720
let maybe_bound = match *self.token {
27212721
token::IDENT(copy sid, _) => {
27222722
match *self.id_to_str(sid) {
@@ -2757,7 +2757,7 @@ pub impl Parser {
27572757
loop;
27582758
}
27592759

2760-
if is_ident_or_path(*self.token) {
2760+
if is_ident_or_path(&*self.token) {
27612761
self.obsolete(*self.span,
27622762
ObsoleteTraitBoundSeparator);
27632763
}
@@ -3987,7 +3987,7 @@ pub impl Parser {
39873987
});
39883988
} else if macros_allowed && !self.is_any_keyword(&copy *self.token)
39893989
&& self.look_ahead(1) == token::NOT
3990-
&& (is_plain_ident(self.look_ahead(2))
3990+
&& (is_plain_ident(&self.look_ahead(2))
39913991
|| self.look_ahead(2) == token::LPAREN
39923992
|| self.look_ahead(2) == token::LBRACE) {
39933993
// MACRO INVOCATION ITEM
@@ -4002,7 +4002,7 @@ pub impl Parser {
40024002
// a 'special' identifier (like what `macro_rules!` uses)
40034003
// is optional. We should eventually unify invoc syntax
40044004
// and remove this.
4005-
let id = if is_plain_ident(*self.token) {
4005+
let id = if is_plain_ident(&*self.token) {
40064006
self.parse_ident()
40074007
} else {
40084008
token::special_idents::invalid // no special identifier

trunk/src/libsyntax/parse/token.rs

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -225,8 +225,8 @@ pub fn to_str(in: @ident_interner, t: &Token) -> ~str {
225225
}
226226
}
227227
228-
pub pure fn can_begin_expr(t: Token) -> bool {
229-
match t {
228+
pub pure fn can_begin_expr(t: &Token) -> bool {
229+
match *t {
230230
LPAREN => true,
231231
LBRACE => true,
232232
LBRACKET => true,
@@ -259,20 +259,20 @@ pub pure fn can_begin_expr(t: Token) -> bool {
259259
/// what's the opposite delimiter?
260260
pub fn flip_delimiter(t: &token::Token) -> token::Token {
261261
match *t {
262-
token::LPAREN => token::RPAREN,
263-
token::LBRACE => token::RBRACE,
264-
token::LBRACKET => token::RBRACKET,
265-
token::RPAREN => token::LPAREN,
266-
token::RBRACE => token::LBRACE,
267-
token::RBRACKET => token::LBRACKET,
262+
LPAREN => RPAREN,
263+
LBRACE => RBRACE,
264+
LBRACKET => RBRACKET,
265+
RPAREN => LPAREN,
266+
RBRACE => LBRACE,
267+
RBRACKET => LBRACKET,
268268
_ => fail!()
269269
}
270270
}
271271
272272
273273
274-
pub fn is_lit(t: Token) -> bool {
275-
match t {
274+
pub fn is_lit(t: &Token) -> bool {
275+
match *t {
276276
LIT_INT(_, _) => true,
277277
LIT_UINT(_, _) => true,
278278
LIT_INT_UNSUFFIXED(_) => true,
@@ -283,23 +283,23 @@ pub fn is_lit(t: Token) -> bool {
283283
}
284284
}
285285
286-
pub pure fn is_ident(t: Token) -> bool {
287-
match t { IDENT(_, _) => true, _ => false }
286+
pub pure fn is_ident(t: &Token) -> bool {
287+
match *t { IDENT(_, _) => true, _ => false }
288288
}
289289
290-
pub pure fn is_ident_or_path(t: Token) -> bool {
291-
match t {
290+
pub pure fn is_ident_or_path(t: &Token) -> bool {
291+
match *t {
292292
IDENT(_, _) | INTERPOLATED(nt_path(*)) => true,
293293
_ => false
294294
}
295295
}
296296
297-
pub pure fn is_plain_ident(t: Token) -> bool {
298-
match t { IDENT(_, false) => true, _ => false }
297+
pub pure fn is_plain_ident(t: &Token) -> bool {
298+
match *t { IDENT(_, false) => true, _ => false }
299299
}
300300
301-
pub pure fn is_bar(t: Token) -> bool {
302-
match t { BINOP(OR) | OROR => true, _ => false }
301+
pub pure fn is_bar(t: &Token) -> bool {
302+
match *t { BINOP(OR) | OROR => true, _ => false }
303303
}
304304
305305

0 commit comments

Comments
 (0)