MLIR
20.0.0git
|
#include "Tools/PDLL/Parser/Lexer.h"
Public Types | |
enum | Kind { eof , error , code_complete , code_complete_string , KW_BEGIN , KW_DEPENDENT_BEGIN , kw_attr , kw_op , kw_type , KW_DEPENDENT_END , kw_Attr , kw_erase , kw_let , kw_Constraint , kw_not , kw_Op , kw_OpName , kw_Pattern , kw_replace , kw_return , kw_rewrite , kw_Rewrite , kw_Type , kw_TypeRange , kw_Value , kw_ValueRange , kw_with , KW_END , arrow , colon , comma , dot , equal , equal_arrow , semicolon , less , greater , l_brace , r_brace , l_paren , r_paren , l_square , r_square , underscore , directive , identifier , integer , string_block , string } |
Public Member Functions | |
Token (Kind kind, StringRef spelling) | |
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... | |
bool | isString () const |
Returns true if the current token is a string literal. More... | |
bool | isKeyword () const |
Returns true if the current token is a keyword. More... | |
bool | isDependentKeyword () const |
Returns true if the current token is a keyword in a dependent context, and in any other situation (e.g. More... | |
StringRef | getSpelling () const |
Return the bytes that make up this token. More... | |
Kind | getKind () const |
Return the kind of this token. More... | |
bool | isAny (Kind k1, Kind k2) const |
Return true if this token is one of the specified kinds. More... | |
template<typename... T> | |
bool | isAny (Kind k1, Kind k2, Kind k3, T... others) const |
bool | isNot (Kind k) const |
Return if the token does not have the given kind. More... | |
template<typename... T> | |
bool | isNot (Kind k1, Kind k2, T... others) const |
bool | is (Kind k) const |
Return if the token has the given kind. More... | |
SMLoc | getStartLoc () const |
Return a location for the start of this token. More... | |
SMLoc | getEndLoc () const |
Return a location at the end of this token. More... | |
SMRange | getLoc () const |
Return a location for the range of this token. More... | |
Enumerator | |
---|---|
eof | Markers. |
error | |
code_complete | Token signifying a code completion location. |
code_complete_string | Token signifying a code completion location within a string. |
KW_BEGIN | Keywords. |
KW_DEPENDENT_BEGIN | Dependent keywords, i.e. those that are treated as keywords depending on the current parser context. |
kw_attr | |
kw_op | |
kw_type | |
KW_DEPENDENT_END | |
kw_Attr | General keywords. |
kw_erase | |
kw_let | |
kw_Constraint | |
kw_not | |
kw_Op | |
kw_OpName | |
kw_Pattern | |
kw_replace | |
kw_return | |
kw_rewrite | |
kw_Rewrite | |
kw_Type | |
kw_TypeRange | |
kw_Value | |
kw_ValueRange | |
kw_with | |
KW_END | |
arrow | Punctuation. |
colon | |
comma | |
dot | |
equal | |
equal_arrow | |
semicolon | |
less | Paired punctuation. |
greater | |
l_brace | |
r_brace | |
l_paren | |
r_paren | |
l_square | |
r_square | |
underscore | |
directive | Tokens. |
identifier | |
integer | |
string_block | |
string |
|
inline |
|
inline |
|
inline |
|
inline |
Return a location for the range of this token.
Definition at line 150 of file Lexer.h.
References getEndLoc(), and getStartLoc().
|
inline |
|
inline |
std::string mlir::pdll::Token::getStringValue | ( | ) | const |
Given a token containing a string literal, return its value, including removing the quote characters and unescaping the contents of the string.
|
inline |
|
inline |
Returns true if the current token is a keyword in a dependent context, and in any other situation (e.g.
variable names) may be treated as an identifier.
Definition at line 116 of file Lexer.h.
References KW_DEPENDENT_BEGIN, and KW_DEPENDENT_END.
|
inline |
|
inline |
|
inline |
Returns true if the current token is a string literal.
Definition at line 106 of file Lexer.h.
References isAny(), string, and string_block.