@ -16,9 +16,10 @@ namespace clang {
};
class Token {
public:
friend class Tokens;
Token(CXTranslationUnit &cx_tu, CXToken &cx_token, CXCursor &cx_cursor):
cx_tu(cx_tu), cx_token(cx_token), cx_cursor(cx_cursor), offsets(get_source_range().get_offsets()) {};
const TokenKind get_kind();
std::string get_spelling();
SourceLocation get_source_location();
@ -8,7 +8,7 @@ clang::Tokens::Tokens(CXTranslationUnit &cx_tu, const SourceRange &range): cx_tu
cx_cursors.reserve(num_tokens);
clang_annotateTokens(cx_tu, cx_tokens, num_tokens, cx_cursors.data());
for (unsigned i = 0; i < num_tokens; i++) {
emplace_back(cx_tu, cx_tokens[i], cx_cursors[i]);
emplace_back(Token(cx_tu, cx_tokens[i], cx_cursors[i]));
}