ccls/libclangmm/Token.h

41 lines
989 B
C
Raw Normal View History

2017-02-18 19:37:24 +00:00
#if false
2017-02-16 09:35:30 +00:00
#ifndef TOKEN_H_
#define TOKEN_H_
#include <clang-c/Index.h>
#include "SourceLocation.h"
#include "SourceRange.h"
#include "Cursor.h"
#include <string>
namespace clang {
class Token {
friend class Tokens;
public:
enum Kind {
Punctuation,
Keyword,
Identifier,
Literal,
Comment
};
private:
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()) {};
public:
Kind get_kind() const;
std::string get_spelling() const;
SourceLocation get_source_location() const;
SourceRange get_source_range() const;
clang::Cursor get_cursor() const {return clang::Cursor(cx_cursor);}
bool is_identifier() const;
CXTranslationUnit &cx_tu;
CXToken& cx_token;
CXCursor& cx_cursor;
std::pair<clang::Offset, clang::Offset> offsets;
};
} // namespace clang
#endif // TOKEN_H_
2017-02-18 19:37:24 +00:00
#endif