File tree Expand file tree Collapse file tree 1 file changed +12
-4
lines changed Expand file tree Collapse file tree 1 file changed +12
-4
lines changed Original file line number Diff line number Diff line change @@ -793,13 +793,16 @@ impl<'a> Drop for RawTokens<'a> {
793793 }
794794}
795795
796- /// A raw clang token, that exposes only the kind and spelling . This is a
796+ /// A raw clang token, that exposes only kind, spelling, and extent . This is a
797797/// slightly more convenient version of `CXToken` which owns the spelling
798- /// string.
798+ /// string and extent .
799799#[ derive( Debug ) ]
800800pub struct ClangToken {
801801 spelling : CXString ,
802- /// The kind of token, this is the same as the relevant member from
802+ /// The extent of the token. This is the same as the relevant member from
803+ /// `CXToken`.
804+ pub extent : CXSourceRange ,
805+ /// The kind of the token. This is the same as the relevant member from
803806 /// `CXToken`.
804807 pub kind : CXTokenKind ,
805808}
@@ -834,7 +837,12 @@ impl<'a> Iterator for ClangTokenIterator<'a> {
834837 unsafe {
835838 let kind = clang_getTokenKind ( * raw) ;
836839 let spelling = clang_getTokenSpelling ( self . tu , * raw) ;
837- Some ( ClangToken { kind, spelling } )
840+ let extent = clang_getTokenExtent ( self . tu , * raw) ;
841+ Some ( ClangToken {
842+ kind,
843+ extent,
844+ spelling,
845+ } )
838846 }
839847 }
840848}
You can’t perform that action at this time.
0 commit comments