Token

Represents a single token from the preprocessor.

Tokens are effectively segments of source code. Source code is first parsed into tokens before being converted into the AST and Cursors.

Tokens are obtained from parsed TranslationUnit instances. You currently can't create tokens manually.

To keep the tokens efficient they are pointers into the range of tokens derived from clang. This mean that the lifetime of a token is coupled to the range.

Constructors

this
this(CXTranslationUnit tu, CXToken t)
Undocumented in source.

Members

Properties

cursor
Cursor cursor [@property getter]

The Cursor this Token corresponds to.

extent
SourceRange extent [@property getter]

The SourceRange this Token occupies.

kind
CXTokenKind kind [@property getter]

Obtain the TokenKind of the current token.

location
SourceLocation location [@property getter]

The SourceLocation this Token occurs at.

spelling
string spelling [@property getter]

The spelling of this token.

Meta