LLVM  14.0.0git
Public Member Functions | Protected Member Functions | List of all members
llvm::AsmLexer Class Reference

AsmLexer - Lexer class for assembly files. More...

#include "llvm/MC/MCParser/AsmLexer.h"

Inheritance diagram for llvm::AsmLexer:
Inheritance graph
[legend]
Collaboration diagram for llvm::AsmLexer:
Collaboration graph
[legend]

Public Member Functions

 AsmLexer (const MCAsmInfo &MAI)
 
 AsmLexer (const AsmLexer &)=delete
 
AsmLexeroperator= (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. More...
 
const MCAsmInfogetMAI () const
 
- Public Member Functions inherited from llvm::MCAsmLexer
 MCAsmLexer (const MCAsmLexer &)=delete
 
MCAsmLexeroperator= (const MCAsmLexer &)=delete
 
virtual ~MCAsmLexer ()
 
const AsmTokenLex ()
 Consume the next token from the input stream and return it. More...
 
void UnLex (AsmToken const &Token)
 
bool isAtStartOfStatement ()
 
SMLoc getLoc () const
 Get the current source location. More...
 
const AsmTokengetTok () const
 Get the current (last) lexed token. More...
 
const AsmToken peekTok (bool ShouldSkipSpace=true)
 Look ahead at the next token to be lexed. More...
 
SMLoc getErrLoc ()
 Get the current error location. More...
 
const std::string & getErr ()
 Get the current error string. More...
 
AsmToken::TokenKind getKind () const
 Get the kind of current token. More...
 
bool is (AsmToken::TokenKind K) const
 Check if the current token has kind K. More...
 
bool isNot (AsmToken::TokenKind K) const
 Check if the current token has kind K. More...
 
void setSkipSpace (bool val)
 Set whether spaces should be ignored by the lexer. More...
 
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]). More...
 
void useMasmDefaultRadix (bool V)
 Set whether to use masm-style default-radix integer literals. More...
 
unsigned getMasmDefaultRadix () const
 
void setMasmDefaultRadix (unsigned Radix)
 
void setLexMasmHexFloats (bool V)
 Set whether to lex masm-style hex float literals, such as 3f800000r. More...
 
void setLexMasmStrings (bool V)
 Set whether to lex masm-style string literals, such as 'Can''t find file' and "This ""value"" not found". More...
 
void setLexMotorolaIntegers (bool V)
 Set whether to lex Motorola-style integer literals, such as $deadbeef or %01010110. More...
 
void setLexHLASMIntegers (bool V)
 Set whether to lex HLASM-flavour integers. For now this is only [0-9]*. More...
 
void setLexHLASMStrings (bool V)
 Set whether to "lex" HLASM-flavour character and string literals. More...
 

Protected Member Functions

AsmToken LexToken () override
 LexToken - Read the next token and return its code. More...
 
- Protected Member Functions inherited from llvm::MCAsmLexer
 MCAsmLexer ()
 
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
 
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
 
AsmCommentConsumerCommentConsumer = nullptr
 

Detailed Description

AsmLexer - Lexer class for assembly files.

Definition at line 25 of file AsmLexer.h.

Constructor & Destructor Documentation

◆ AsmLexer() [1/2]

AsmLexer::AsmLexer ( const MCAsmInfo MAI)

◆ AsmLexer() [2/2]

llvm::AsmLexer::AsmLexer ( const AsmLexer )
delete

◆ ~AsmLexer()

AsmLexer::~AsmLexer ( )
overridedefault

Member Function Documentation

◆ getMAI()

const MCAsmInfo& llvm::AsmLexer::getMAI ( ) const
inline

Definition at line 53 of file AsmLexer.h.

◆ LexToken()

AsmToken AsmLexer::LexToken ( )
overrideprotectedvirtual

LexToken - Read the next token and return its code.

Implements llvm::MCAsmLexer.

Definition at line 731 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::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, 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::RBrac, llvm::AsmToken::RCurly, llvm::AsmToken::RParen, s, 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 peekTokens().

◆ LexUntilEndOfStatement()

StringRef AsmLexer::LexUntilEndOfStatement ( )
overridevirtual

Implements llvm::MCAsmLexer.

Definition at line 665 of file AsmLexer.cpp.

References llvm::StringRef::end(), and llvm::MCAsmLexer::TokStart.

◆ operator=()

AsmLexer& llvm::AsmLexer::operator= ( const AsmLexer )
delete

◆ peekTokens()

size_t AsmLexer::peekTokens ( MutableArrayRef< AsmToken Buf,
bool  ShouldSkipSpace = true 
)
overridevirtual

◆ setBuffer()

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.


The documentation for this class was generated from the following files: