CIRCT
20.0.0git
|
This represents a specific token for .fir files. More...
#include <FIRLexer.h>
Public Types | |
enum | Kind |
Public Member Functions | |
FIRToken (Kind kind, StringRef spelling) | |
StringRef | getSpelling () const |
Kind | getKind () const |
bool | is (Kind K) const |
bool | isAny (Kind k1, Kind k2) const |
template<typename... T> | |
bool | isAny (Kind k1, Kind k2, Kind k3, T... others) const |
Return true if this token is one of the specified kinds. More... | |
bool | isNot (Kind k) const |
template<typename... T> | |
bool | isNot (Kind k1, Kind k2, T... others) const |
Return true if this token isn't one of the specified kinds. More... | |
bool | isKeyword () const |
Return true if this is one of the keyword token kinds (e.g. kw_wire). More... | |
std::string | getStringValue () const |
Given a token containing a string literal, return its value, including removing the quote characters and unescaping the contents of the string. More... | |
std::string | getVerbatimStringValue () const |
Given a token containing a verbatim string, return its value, including removing the quote characters and unescaping the quotes of the string. More... | |
llvm::SMLoc | getLoc () const |
llvm::SMLoc | getEndLoc () const |
llvm::SMRange | getLocRange () const |
Static Public Member Functions | |
static std::string | getStringValue (StringRef spelling) |
static std::string | getVerbatimStringValue (StringRef spelling) |
Private Attributes | |
Kind | kind |
Discriminator that indicates the sort of token this is. More... | |
StringRef | spelling |
A reference to the entire token contents; this is always a pointer into a memory buffer owned by the source manager. More... | |
This represents a specific token for .fir files.
Definition at line 29 of file FIRLexer.h.
Definition at line 31 of file FIRLexer.h.
|
inline |
Definition at line 41 of file FIRLexer.h.
SMLoc FIRToken::getEndLoc | ( | ) | const |
|
inline |
Definition at line 47 of file FIRLexer.h.
References kind.
Referenced by getStringValue(), and getVerbatimStringValue().
SMLoc FIRToken::getLoc | ( | ) | const |
SMRange FIRToken::getLocRange | ( | ) | const |
Definition at line 41 of file FIRLexer.cpp.
References getEndLoc(), and getLoc().
|
inline |
Definition at line 44 of file FIRLexer.h.
References spelling.
Referenced by circt::firrtl::FIRLexer::getIndentation(), getStringValue(), and getVerbatimStringValue().
std::string FIRToken::getStringValue | ( | ) | const |
Given a token containing a string literal, return its value, including removing the quote characters and unescaping the contents of the string.
The lexer has already verified that this token is valid.
Definition at line 58 of file FIRLexer.cpp.
References assert(), getKind(), and getSpelling().
|
static |
Definition at line 63 of file FIRLexer.cpp.
std::string FIRToken::getVerbatimStringValue | ( | ) | const |
Given a token containing a verbatim string, return its value, including removing the quote characters and unescaping the quotes of the string.
The lexer has already verified that this token is valid.
Definition at line 117 of file FIRLexer.cpp.
References assert(), getKind(), and getSpelling().
|
static |
Definition at line 122 of file FIRLexer.cpp.
|
inline |
|
inline |
Return true if this token is one of the specified kinds.
Definition at line 54 of file FIRLexer.h.
bool FIRToken::isKeyword | ( | ) | const |
Return true if this is one of the keyword token kinds (e.g. kw_wire).
Definition at line 44 of file FIRLexer.cpp.
References kind.
|
inline |
Definition at line 60 of file FIRLexer.h.
References kind.
|
inline |
Return true if this token isn't one of the specified kinds.
Definition at line 64 of file FIRLexer.h.
References isAny().
|
private |
Discriminator that indicates the sort of token this is.
Definition at line 90 of file FIRLexer.h.
Referenced by getKind(), is(), isKeyword(), and isNot().
|
private |
A reference to the entire token contents; this is always a pointer into a memory buffer owned by the source manager.
Definition at line 94 of file FIRLexer.h.
Referenced by getEndLoc(), getLoc(), getSpelling(), getStringValue(), and getVerbatimStringValue().