Skip to content

Commit 77dc3ad

Browse files
committed
libsyntax: De-mut the macro parser. rs=demuting
1 parent 17dcaee commit 77dc3ad

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

src/libsyntax/ext/tt/macro_parser.rs

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -114,8 +114,8 @@ pub fn is_some(&&mpu: matcher_pos_up) -> bool {
114114
pub struct MatcherPos {
115115
elts: ~[ast::matcher], // maybe should be /&? Need to understand regions.
116116
sep: Option<Token>,
117-
mut idx: uint,
118-
mut up: matcher_pos_up, // mutable for swapping only
117+
idx: uint,
118+
up: matcher_pos_up, // mutable for swapping only
119119
matches: ~[DVec<@named_match>],
120120
match_lo: uint, match_hi: uint,
121121
sp_lo: BytePos,
@@ -155,8 +155,8 @@ pub fn initial_matcher_pos(ms: ~[matcher], sep: Option<Token>, lo: BytePos)
155155
~MatcherPos {
156156
elts: ms,
157157
sep: sep,
158-
mut idx: 0u,
159-
mut up: matcher_pos_up(None),
158+
idx: 0u,
159+
up: matcher_pos_up(None),
160160
matches: copy vec::from_fn(count_names(ms), |_i| dvec::DVec()),
161161
match_lo: 0u,
162162
match_hi: match_idx_hi,
@@ -267,7 +267,7 @@ pub fn parse(sess: @mut ParseSess,
267267
if idx == len {
268268
// pop from the matcher position
269269
270-
let new_pos = copy_up(ei.up);
270+
let mut new_pos = copy_up(ei.up);
271271
272272
// update matches (the MBE "parse tree") by appending
273273
// each tree as a subtree.
@@ -295,13 +295,13 @@ pub fn parse(sess: @mut ParseSess,
295295
match copy ei.sep {
296296
Some(ref t) if idx == len => { // we need a separator
297297
if tok == (*t) { //pass the separator
298-
let ei_t = ei;
298+
let mut ei_t = ei;
299299
ei_t.idx += 1;
300300
next_eis.push(ei_t);
301301
}
302302
}
303303
_ => { // we don't need a separator
304-
let ei_t = ei;
304+
let mut ei_t = ei;
305305
ei_t.idx = 0;
306306
cur_eis.push(ei_t);
307307
}
@@ -315,7 +315,7 @@ pub fn parse(sess: @mut ParseSess,
315315
match_seq(ref matchers, ref sep, zero_ok,
316316
match_idx_lo, match_idx_hi) => {
317317
if zero_ok {
318-
let new_ei = copy ei;
318+
let mut new_ei = copy ei;
319319
new_ei.idx += 1u;
320320
//we specifically matched zero repeats.
321321
for uint::range(match_idx_lo, match_idx_hi) |idx| {
@@ -331,16 +331,16 @@ pub fn parse(sess: @mut ParseSess,
331331
cur_eis.push(~MatcherPos {
332332
elts: (*matchers),
333333
sep: (*sep),
334-
mut idx: 0u,
335-
mut up: matcher_pos_up(Some(ei_t)),
334+
idx: 0u,
335+
up: matcher_pos_up(Some(ei_t)),
336336
matches: matches,
337337
match_lo: match_idx_lo, match_hi: match_idx_hi,
338338
sp_lo: sp.lo
339339
});
340340
}
341341
match_nonterminal(_,_,_) => { bb_eis.push(ei) }
342342
match_tok(ref t) => {
343-
let ei_t = ei;
343+
let mut ei_t = ei;
344344
if (*t) == tok {
345345
ei_t.idx += 1;
346346
next_eis.push(ei_t);
@@ -388,7 +388,7 @@ pub fn parse(sess: @mut ParseSess,
388388
} else /* bb_eis.len() == 1 */ {
389389
let rust_parser = Parser(sess, cfg, rdr.dup());
390390
391-
let ei = bb_eis.pop();
391+
let mut ei = bb_eis.pop();
392392
match ei.elts[ei.idx].node {
393393
match_nonterminal(_, name, idx) => {
394394
ei.matches[idx].push(@matched_nonterminal(

0 commit comments

Comments
 (0)