clang-tools  7.0.0
Public Types | Public Member Functions | Public Attributes | Friends | List of all members
clang::clangd::dex::Token Struct Reference

A Token represents an attribute of a symbol, such as a particular trigram present in the name (used for fuzzy search). More...

#include <Token.h>

Collaboration diagram for clang::clangd::dex::Token:
[legend]

Public Types

enum  Kind { Kind::Trigram, Kind::Scope, Kind::Sentinel }
 Kind specifies Token type which defines semantics for the internal representation. More...
 

Public Member Functions

 Token (Kind TokenKind, llvm::StringRef Data)
 
bool operator== (const Token &Other) const
 

Public Attributes

std::string Data
 Representation which is unique among Token with the same Kind. More...
 
Kind TokenKind
 

Friends

llvm::raw_ostream & operator<< (llvm::raw_ostream &OS, const Token &T)
 
llvm::hash_code hash_value (const Token &Token)
 

Detailed Description

A Token represents an attribute of a symbol, such as a particular trigram present in the name (used for fuzzy search).

Tokens can be used to perform more sophisticated search queries by constructing complex iterator trees.

Definition at line 40 of file Token.h.

Member Enumeration Documentation

◆ Kind

Kind specifies Token type which defines semantics for the internal representation.

Each Kind has different representation stored in Data field.

Enumerator
Trigram 

Represents trigram used for fuzzy search of unqualified symbol names.

Data contains 3 bytes with trigram contents.

Scope 

Scope primitives, e.g.

"symbol belongs to namespace foo::bar".

Data stroes full scope name , e.g. "foo::bar::baz::" or "" (for global scope).

Sentinel 

Internal Token type for invalid/special tokens, e.g.

empty tokens for llvm::DenseMap.

Definition at line 44 of file Token.h.

Constructor & Destructor Documentation

◆ Token()

clang::clangd::dex::Token::Token ( Kind  TokenKind,
llvm::StringRef  Data 
)
inline

Definition at line 63 of file Token.h.

Member Function Documentation

◆ operator==()

bool clang::clangd::dex::Token::operator== ( const Token Other) const
inline

Definition at line 66 of file Token.h.

References Data, and TokenKind.

Friends And Related Function Documentation

◆ hash_value

llvm::hash_code hash_value ( const Token Token)
friend

◆ operator<<

llvm::raw_ostream& operator<< ( llvm::raw_ostream &  OS,
const Token T 
)
friend

Definition at line 74 of file Token.h.

Member Data Documentation

◆ Data

std::string clang::clangd::dex::Token::Data

Representation which is unique among Token with the same Kind.

Definition at line 71 of file Token.h.

Referenced by operator==().

◆ TokenKind

Kind clang::clangd::dex::Token::TokenKind

Definition at line 72 of file Token.h.

Referenced by operator==().


The documentation for this struct was generated from the following file: