let span = parser.span;
parser.span_err(span, &msg[..]);
- let name = token::get_ident(self.macro_ident);
let msg = format!("caused by the macro expansion here; the usage \
of `{}` is likely invalid in this context",
- name);
+ self.macro_ident);
parser.span_note(self.site_span, &msg[..]);
}
}
-> Box<MacResult+'cx> {
if cx.trace_macros() {
println!("{}! {{ {} }}",
- token::get_ident(name),
+ name,
print::pprust::tts_to_string(arg));
}
TtToken(sp, MatchNt(ref name, ref frag_spec, _, _)) => {
// ii. If T is a simple NT, look ahead to the next token T' in
// M. If T' is in the set FOLLOW(NT), continue. Else; reject.
- if can_be_followed_by_any(frag_spec.as_str()) {
+ if can_be_followed_by_any(&frag_spec.name.as_str()) {
continue
} else {
let next_token = match tokens.peek() {
// possibility that the sequence occurred
// zero times (in which case we need to
// look at the token that follows the
- // sequence, which may itself a sequence,
+ // sequence, which may itself be a sequence,
// and so on).
cx.span_err(sp,
&format!("`${0}:{1}` is followed by a \
sequence repetition, which is not \
allowed for `{1}` fragments",
- name.as_str(), frag_spec.as_str())
+ name, frag_spec)
);
Eof
},
let tok = if let TtToken(_, ref tok) = *token { tok } else { unreachable!() };
// If T' is in the set FOLLOW(NT), continue. Else, reject.
- match (&next_token, is_in_follow(cx, &next_token, frag_spec.as_str())) {
+ match (&next_token, is_in_follow(cx, &next_token, &frag_spec.name.as_str())) {
(_, Err(msg)) => {
cx.span_err(sp, &msg);
continue
(next, Ok(false)) => {
cx.span_err(sp, &format!("`${0}:{1}` is followed by `{2}`, which \
is not allowed for `{1}` fragments",
- name.as_str(), frag_spec.as_str(),
+ name, frag_spec,
token_to_string(next)));
continue
},
"pat" => {
match *tok {
FatArrow | Comma | Eq => Ok(true),
- Ident(i, _) if i.as_str() == "if" || i.as_str() == "in" => Ok(true),
+ Ident(i, _) if i.name == "if" || i.name == "in" => Ok(true),
_ => Ok(false)
}
},
"path" | "ty" => {
match *tok {
Comma | FatArrow | Colon | Eq | Gt | Semi => Ok(true),
- Ident(i, _) if i.as_str() == "as" => Ok(true),
+ Ident(i, _) if i.name == "as" => Ok(true),
_ => Ok(false)
}
},