Fix leading colon

This commit is contained in:
Aleksey Kladov 2020-07-31 18:49:42 +02:00
parent ddf08daddf
commit c1c97b2896
2 changed files with 3 additions and 2 deletions

View file

@ -19,10 +19,10 @@ pub struct PathSegment {
pub(crate) syntax: SyntaxNode, pub(crate) syntax: SyntaxNode,
} }
impl PathSegment { impl PathSegment {
pub fn coloncolon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![::]) }
pub fn crate_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![crate]) } pub fn crate_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![crate]) }
pub fn self_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![self]) } pub fn self_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![self]) }
pub fn super_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![super]) } pub fn super_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![super]) }
pub fn coloncolon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![::]) }
pub fn name_ref(&self) -> Option<NameRef> { support::child(&self.syntax) } pub fn name_ref(&self) -> Option<NameRef> { support::child(&self.syntax) }
pub fn generic_arg_list(&self) -> Option<GenericArgList> { support::child(&self.syntax) } pub fn generic_arg_list(&self) -> Option<GenericArgList> { support::child(&self.syntax) }
pub fn param_list(&self) -> Option<ParamList> { support::child(&self.syntax) } pub fn param_list(&self) -> Option<ParamList> { support::child(&self.syntax) }

View file

@ -2,7 +2,8 @@ Path =
(qualifier:Path '::')? segment:PathSegment (qualifier:Path '::')? segment:PathSegment
PathSegment = PathSegment =
'::' | 'crate' | 'self' | 'super' 'crate' | 'self' | 'super'
| '::' NameRef
| NameRef GenericArgList? | NameRef GenericArgList?
| NameRef ParamList RetType? | NameRef ParamList RetType?
| '<' PathType ('as' PathType)? '>' | '<' PathType ('as' PathType)? '>'