File tree 1 file changed +12
-4
lines changed 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> {
793
793
}
794
794
}
795
795
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
797
797
/// slightly more convenient version of `CXToken` which owns the spelling
798
- /// string.
798
+ /// string and extent .
799
799
#[ derive( Debug ) ]
800
800
pub struct ClangToken {
801
801
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
803
806
/// `CXToken`.
804
807
pub kind : CXTokenKind ,
805
808
}
@@ -834,7 +837,12 @@ impl<'a> Iterator for ClangTokenIterator<'a> {
834
837
unsafe {
835
838
let kind = clang_getTokenKind ( * raw) ;
836
839
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
+ } )
838
846
}
839
847
}
840
848
}
You can’t perform that action at this time.
0 commit comments