syntax: Make is_path_start
precise and improve some error messages about unexpected tokens
This commit is contained in:
parent
6c44bea644
commit
a97f60ee86
25 changed files with 88 additions and 73 deletions
|
@ -243,6 +243,11 @@ impl Token {
|
|||
self.is_keyword(keywords::Const)
|
||||
}
|
||||
|
||||
pub fn is_path_start(&self) -> bool {
|
||||
self == &ModSep || self == &Lt || self.is_path() ||
|
||||
self.is_path_segment_keyword() || self.is_ident() && !self.is_any_keyword()
|
||||
}
|
||||
|
||||
/// Maps a token to its corresponding binary operator.
|
||||
pub fn to_binop(&self) -> Option<BinOpKind> {
|
||||
match *self {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue