Remove Token::get_close_delimiter
We can simplify these usages due to the new delimiter representation. `Parser::expect_open_delim` has been added for convenience.
This commit is contained in:
parent
936d999b52
commit
1ab50f3600
2 changed files with 33 additions and 58 deletions
|
@ -230,17 +230,6 @@ impl Token {
|
|||
}
|
||||
}
|
||||
|
||||
/// Returns the matching close delimiter if this is an open delimiter,
|
||||
/// otherwise `None`.
|
||||
pub fn get_close_delimiter(&self) -> Option<Token> {
|
||||
match *self {
|
||||
OpenDelim(Paren) => Some(CloseDelim(Paren)),
|
||||
OpenDelim(Brace) => Some(CloseDelim(Brace)),
|
||||
OpenDelim(Bracket) => Some(CloseDelim(Bracket)),
|
||||
_ => None,
|
||||
}
|
||||
}
|
||||
|
||||
/// Returns `true` if the token is any literal
|
||||
pub fn is_lit(&self) -> bool {
|
||||
match *self {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue