LLVM 22.0.0git
|
#include "llvm/MC/MCParser/AsmLexer.h"
Public Member Functions | |
LLVM_ABI | AsmLexer (const MCAsmInfo &MAI) |
AsmLexer (const AsmLexer &)=delete | |
AsmLexer & | operator= (const AsmLexer &)=delete |
const AsmToken & | Lex () |
Consume the next token from the input stream and return it. | |
void | UnLex (AsmToken const &Token) |
bool | justConsumedEOL () |
LLVM_ABI StringRef | LexUntilEndOfStatement () |
SMLoc | getLoc () const |
Get the current source location. | |
const AsmToken & | getTok () const |
Get the current (last) lexed token. | |
const AsmToken | peekTok (bool ShouldSkipSpace=true) |
Look ahead at the next token to be lexed. | |
LLVM_ABI size_t | peekTokens (MutableArrayRef< AsmToken > Buf, bool ShouldSkipSpace=true) |
Look ahead an arbitrary number of tokens. | |
SMLoc | getErrLoc () |
Get the current error location. | |
const std::string & | getErr () |
Get the current error string. | |
AsmToken::TokenKind | getKind () const |
Get the kind of current token. | |
bool | is (AsmToken::TokenKind K) const |
Check if the current token has kind K . | |
bool | isNot (AsmToken::TokenKind K) const |
Check if the current token has kind K . | |
void | setSkipSpace (bool val) |
Set whether spaces should be ignored by the lexer. | |
bool | getAllowAtInIdentifier () |
void | setAllowAtInIdentifier (bool v) |
void | setAllowHashInIdentifier (bool V) |
void | setCommentConsumer (AsmCommentConsumer *CommentConsumer) |
void | setLexMasmIntegers (bool V) |
Set whether to lex masm-style binary (e.g., 0b1101) and radix-specified literals (e.g., 0ABCh [hex], 576t [decimal], 77o [octal], 1101y [binary]). | |
void | useMasmDefaultRadix (bool V) |
Set whether to use masm-style default-radix integer literals. | |
unsigned | getMasmDefaultRadix () const |
void | setMasmDefaultRadix (unsigned Radix) |
void | setLexMasmHexFloats (bool V) |
Set whether to lex masm-style hex float literals, such as 3f800000r. | |
void | setLexMasmStrings (bool V) |
Set whether to lex masm-style string literals, such as 'Can''t find file' and "This ""value"" not found". | |
void | setLexMotorolaIntegers (bool V) |
Set whether to lex Motorola-style integer literals, such as $deadbeef or %01010110. | |
void | setLexHLASMIntegers (bool V) |
Set whether to lex HLASM-flavour integers. For now this is only [0-9]*. | |
void | setLexHLASMStrings (bool V) |
Set whether to "lex" HLASM-flavour character and string literals. | |
LLVM_ABI void | setBuffer (StringRef Buf, const char *ptr=nullptr, bool EndStatementAtEOF=true) |
const MCAsmInfo & | getMAI () const |
Definition at line 43 of file AsmLexer.h.
Definition at line 111 of file AsmLexer.cpp.
References llvm::AsmToken::Space, and llvm::StringRef::starts_with().
Referenced by AsmLexer(), and operator=().
References AsmLexer().
|
inline |
Definition at line 155 of file AsmLexer.h.
|
inline |
Get the current error string.
Definition at line 141 of file AsmLexer.h.
Referenced by peekTokens().
|
inline |
Get the current error location.
Definition at line 138 of file AsmLexer.h.
Referenced by peekTokens().
|
inline |
Get the kind of current token.
Definition at line 144 of file AsmLexer.h.
References llvm::AsmToken::getKind(), and getTok().
|
inline |
Get the current source location.
Definition at line 115 of file AsmLexer.h.
References llvm::SMLoc::getFromPointer().
Referenced by llvm::MCAsmParserExtension::parseDirectiveCGProfile().
Definition at line 197 of file AsmLexer.h.
|
inline |
Definition at line 172 of file AsmLexer.h.
Get the current (last) lexed token.
Definition at line 118 of file AsmLexer.h.
Referenced by getKind(), llvm::MCAsmParser::getTok(), is(), and isNot().
|
inline |
Check if the current token has kind K
.
Definition at line 147 of file AsmLexer.h.
References getTok(), and llvm::AsmToken::is().
|
inline |
Check if the current token has kind K
.
Definition at line 150 of file AsmLexer.h.
References getTok(), and llvm::AsmToken::isNot().
Referenced by expectAbsExpression(), and parseExpr().
|
inline |
Definition at line 110 of file AsmLexer.h.
Consume the next token from the input stream and return it.
The lexer will continuously return the end-of-file token once the end of the main input file has been reached.
Definition at line 92 of file AsmLexer.h.
References assert(), llvm::AsmToken::EndOfStatement, and T.
Referenced by llvm::MCAsmParser::Error(), expectAbsExpression(), and parseExpr().
StringRef AsmLexer::LexUntilEndOfStatement | ( | ) |
Definition at line 744 of file AsmLexer.cpp.
References AsmLexer().
Look ahead at the next token to be lexed.
Definition at line 121 of file AsmLexer.h.
References assert(), and peekTokens().
size_t AsmLexer::peekTokens | ( | MutableArrayRef< AsmToken > | Buf, |
bool | ShouldSkipSpace = true ) |
Look ahead an arbitrary number of tokens.
Definition at line 764 of file AsmLexer.cpp.
References llvm::AsmToken::Eof, getErr(), getErrLoc(), llvm::AsmToken::is(), and llvm::ArrayRef< T >::size().
Referenced by peekTok().
|
inline |
Definition at line 156 of file AsmLexer.h.
|
inline |
Definition at line 158 of file AsmLexer.h.
void AsmLexer::setBuffer | ( | StringRef | Buf, |
const char * | ptr = nullptr, | ||
bool | EndStatementAtEOF = true ) |
Definition at line 121 of file AsmLexer.cpp.
|
inline |
Definition at line 160 of file AsmLexer.h.
|
inline |
Set whether to lex HLASM-flavour integers. For now this is only [0-9]*.
Definition at line 187 of file AsmLexer.h.
|
inline |
Set whether to "lex" HLASM-flavour character and string literals.
For now, setting this option to true, will disable lexing for character and string literals.
Definition at line 192 of file AsmLexer.h.
|
inline |
Set whether to lex masm-style hex float literals, such as 3f800000r.
Definition at line 176 of file AsmLexer.h.
|
inline |
Set whether to lex masm-style binary (e.g., 0b1101) and radix-specified literals (e.g., 0ABCh [hex], 576t [decimal], 77o [octal], 1101y [binary]).
Definition at line 166 of file AsmLexer.h.
|
inline |
Set whether to lex masm-style string literals, such as 'Can''t find file' and "This ""value"" not found".
Definition at line 180 of file AsmLexer.h.
|
inline |
Set whether to lex Motorola-style integer literals, such as $deadbeef or %01010110.
Definition at line 184 of file AsmLexer.h.
|
inline |
Definition at line 173 of file AsmLexer.h.
|
inline |
Set whether spaces should be ignored by the lexer.
Definition at line 153 of file AsmLexer.h.
Definition at line 106 of file AsmLexer.h.
|
inline |
Set whether to use masm-style default-radix integer literals.
If disabled, assume decimal unless prefixed (e.g., 0x2c [hex], 077 [octal]).
Definition at line 170 of file AsmLexer.h.