Rename Token::is_op
as Token::is_punct
.
For consistency with `proc_macro::Punct`.
This commit is contained in:
parent
475c71da07
commit
becf4942a2
3 changed files with 7 additions and 4 deletions
|
@ -404,7 +404,7 @@ impl Token {
|
||||||
[DotDot, DotDotDot, DotDotEq].contains(&self.kind)
|
[DotDot, DotDotDot, DotDotEq].contains(&self.kind)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn is_op(&self) -> bool {
|
pub fn is_punct(&self) -> bool {
|
||||||
match self.kind {
|
match self.kind {
|
||||||
Eq | Lt | Le | EqEq | Ne | Ge | Gt | AndAnd | OrOr | Not | Tilde | BinOp(_)
|
Eq | Lt | Le | EqEq | Ne | Ge | Gt | AndAnd | OrOr | Not | Tilde | BinOp(_)
|
||||||
| BinOpEq(_) | At | Dot | DotDot | DotDotDot | DotDotEq | Comma | Semi | Colon
|
| BinOpEq(_) | At | Dot | DotDot | DotDotDot | DotDotEq | Comma | Semi | Colon
|
||||||
|
|
|
@ -59,8 +59,11 @@ impl<'a> TokenTreesReader<'a> {
|
||||||
if let Some(glued) = self.token.glue(&next_tok) {
|
if let Some(glued) = self.token.glue(&next_tok) {
|
||||||
self.token = glued;
|
self.token = glued;
|
||||||
} else {
|
} else {
|
||||||
let this_spacing =
|
let this_spacing = if next_tok.is_punct() {
|
||||||
if next_tok.is_op() { Spacing::Joint } else { Spacing::Alone };
|
Spacing::Joint
|
||||||
|
} else {
|
||||||
|
Spacing::Alone
|
||||||
|
};
|
||||||
break (this_spacing, next_tok);
|
break (this_spacing, next_tok);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -1592,7 +1592,7 @@ impl<'a> Parser<'a> {
|
||||||
} else if !ate_colon
|
} else if !ate_colon
|
||||||
&& self.may_recover()
|
&& self.may_recover()
|
||||||
&& (matches!(self.token.kind, token::CloseDelim(_) | token::Comma)
|
&& (matches!(self.token.kind, token::CloseDelim(_) | token::Comma)
|
||||||
|| self.token.is_op())
|
|| self.token.is_punct())
|
||||||
{
|
{
|
||||||
let (lit, _) =
|
let (lit, _) =
|
||||||
self.recover_unclosed_char(label_.ident, Parser::mk_token_lit_char, |self_| {
|
self.recover_unclosed_char(label_.ident, Parser::mk_token_lit_char, |self_| {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue