LLVM 20.0.0git
|
AsmLexer - Lexer class for assembly files. More...
#include "llvm/MC/MCParser/AsmLexer.h"
Public Member Functions | |
AsmLexer (const MCAsmInfo &MAI) | |
AsmLexer (const AsmLexer &)=delete | |
AsmLexer & | operator= (const AsmLexer &)=delete |
~AsmLexer () override | |
void | setBuffer (StringRef Buf, const char *ptr=nullptr, bool EndStatementAtEOF=true) |
StringRef | LexUntilEndOfStatement () override |
size_t | peekTokens (MutableArrayRef< AsmToken > Buf, bool ShouldSkipSpace=true) override |
Look ahead an arbitrary number of tokens. | |
const MCAsmInfo & | getMAI () const |
Public Member Functions inherited from llvm::MCAsmLexer | |
MCAsmLexer (const MCAsmLexer &)=delete | |
MCAsmLexer & | operator= (const MCAsmLexer &)=delete |
virtual | ~MCAsmLexer () |
const AsmToken & | Lex () |
Consume the next token from the input stream and return it. | |
void | UnLex (AsmToken const &Token) |
bool | isAtStartOfStatement () |
virtual StringRef | LexUntilEndOfStatement ()=0 |
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. | |
virtual size_t | peekTokens (MutableArrayRef< AsmToken > Buf, bool ShouldSkipSpace=true)=0 |
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. | |
Protected Member Functions | |
AsmToken | LexToken () override |
LexToken - Read the next token and return its code. | |
Protected Member Functions inherited from llvm::MCAsmLexer | |
MCAsmLexer () | |
virtual AsmToken | LexToken ()=0 |
void | SetError (SMLoc errLoc, const std::string &err) |
Additional Inherited Members | |
Protected Attributes inherited from llvm::MCAsmLexer | |
const char * | TokStart = nullptr |
bool | SkipSpace = true |
bool | AllowAtInIdentifier = false |
bool | AllowHashInIdentifier = false |
bool | IsAtStartOfStatement = true |
bool | LexMasmHexFloats = false |
bool | LexMasmIntegers = false |
bool | LexMasmStrings = false |
bool | LexMotorolaIntegers = false |
bool | UseMasmDefaultRadix = false |
unsigned | DefaultRadix = 10 |
bool | LexHLASMIntegers = false |
bool | LexHLASMStrings = false |
AsmCommentConsumer * | CommentConsumer = nullptr |
AsmLexer - Lexer class for assembly files.
Definition at line 25 of file AsmLexer.h.
Definition at line 34 of file AsmLexer.cpp.
References llvm::MCAsmLexer::AllowAtInIdentifier, llvm::MCAsmInfo::getCommentString(), llvm::MCAsmLexer::LexMotorolaIntegers, llvm::MCAsmInfo::shouldUseMotorolaIntegers(), and llvm::StringRef::starts_with().
|
overridedefault |
Definition at line 53 of file AsmLexer.h.
|
overrideprotectedvirtual |
LexToken - Read the next token and return its code.
Implements llvm::MCAsmLexer.
Definition at line 730 of file AsmLexer.cpp.
References llvm::AsmToken::Amp, llvm::AsmToken::AmpAmp, llvm::AsmToken::At, llvm::AsmToken::BackSlash, llvm::AsmToken::Caret, llvm::AsmToken::Colon, llvm::AsmToken::Comma, llvm::Default, llvm::MCAsmInfo::doesAllowAtAtStartOfIdentifier(), llvm::MCAsmInfo::doesAllowDollarAtStartOfIdentifier(), llvm::MCAsmInfo::doesAllowHashAtStartOfIdentifier(), llvm::MCAsmInfo::doesAllowQuestionAtStartOfIdentifier(), llvm::AsmToken::Dollar, llvm::StringRef::end(), llvm::AsmToken::EndOfStatement, llvm::AsmToken::Eof, llvm::AsmToken::Equal, llvm::AsmToken::EqualEqual, llvm::AsmToken::Exclaim, llvm::AsmToken::ExclaimEqual, llvm::MCAsmInfo::getSeparatorString(), llvm::AsmToken::Greater, llvm::AsmToken::GreaterEqual, llvm::AsmToken::GreaterGreater, llvm::AsmToken::Hash, llvm::AsmToken::HashDirective, llvm::MCAsmInfo::hasMipsExpressions(), llvm::AsmToken::Integer, llvm::MCAsmLexer::is(), isHexDigit(), llvm::AsmToken::LBrac, llvm::AsmToken::LCurly, llvm::AsmToken::Less, llvm::AsmToken::LessEqual, llvm::AsmToken::LessGreater, llvm::AsmToken::LessLess, llvm::MCAsmLexer::LexMotorolaIntegers, LexToken(), llvm::AsmToken::LParen, llvm::AsmToken::Minus, llvm::AsmToken::MinusGreater, peekTokens(), llvm::AsmToken::Percent, llvm::AsmToken::PercentCall16, llvm::AsmToken::PercentCall_Hi, llvm::AsmToken::PercentCall_Lo, llvm::AsmToken::PercentDtprel_Hi, llvm::AsmToken::PercentDtprel_Lo, llvm::AsmToken::PercentGot, llvm::AsmToken::PercentGot_Disp, llvm::AsmToken::PercentGot_Hi, llvm::AsmToken::PercentGot_Lo, llvm::AsmToken::PercentGot_Ofst, llvm::AsmToken::PercentGot_Page, llvm::AsmToken::PercentGottprel, llvm::AsmToken::PercentGp_Rel, llvm::AsmToken::PercentHi, llvm::AsmToken::PercentHigher, llvm::AsmToken::PercentHighest, llvm::AsmToken::PercentLo, llvm::AsmToken::PercentNeg, llvm::AsmToken::PercentPcrel_Hi, llvm::AsmToken::PercentPcrel_Lo, llvm::AsmToken::PercentTlsgd, llvm::AsmToken::PercentTlsldm, llvm::AsmToken::PercentTprel_Hi, llvm::AsmToken::PercentTprel_Lo, llvm::AsmToken::Pipe, llvm::AsmToken::PipePipe, llvm::AsmToken::Plus, llvm::AsmToken::Question, llvm::AsmToken::RBrac, llvm::AsmToken::RCurly, llvm::AsmToken::RParen, llvm::MCAsmInfo::shouldAllowAdditionalComments(), llvm::MCAsmLexer::SkipSpace, llvm::AsmToken::Space, llvm::AsmToken::Star, llvm::AsmToken::String, llvm::AsmToken::Tilde, llvm::MCAsmLexer::TokStart, and llvm::MCAsmLexer::UnLex().
Referenced by LexToken(), and peekTokens().
|
overridevirtual |
Implements llvm::MCAsmLexer.
Definition at line 664 of file AsmLexer.cpp.
References llvm::StringRef::end(), and llvm::MCAsmLexer::TokStart.
|
overridevirtual |
Look ahead an arbitrary number of tokens.
Implements llvm::MCAsmLexer.
Definition at line 684 of file AsmLexer.cpp.
References llvm::AsmToken::Eof, llvm::MCAsmLexer::getErr(), llvm::MCAsmLexer::getErrLoc(), llvm::AsmToken::is(), LexToken(), llvm::MCAsmLexer::SetError(), llvm::ArrayRef< T >::size(), llvm::MCAsmLexer::SkipSpace, and llvm::MCAsmLexer::TokStart.
Referenced by LexToken().
void AsmLexer::setBuffer | ( | StringRef | Buf, |
const char * | ptr = nullptr , |
||
bool | EndStatementAtEOF = true |
||
) |
Definition at line 41 of file AsmLexer.cpp.
References llvm::StringRef::begin(), and llvm::MCAsmLexer::TokStart.