LLVM  6.0.0svn
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
llvm::MCAsmLexer Class Referenceabstract

Generic assembler lexer interface, for use by target specific assembly lexers. More...

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

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

Public Member Functions

 MCAsmLexer (const MCAsmLexer &)=delete
 
MCAsmLexeroperator= (const MCAsmLexer &)=delete
 
virtual ~MCAsmLexer ()
 
bool IsaAltMacroMode ()
 
void SetAltMacroMode (bool AltMacroSet)
 
const AsmTokenLex ()
 Consume the next token from the input stream and return it. More...
 
void UnLex (AsmToken const &Token)
 
bool isAtStartOfStatement ()
 
virtual StringRef LexUntilEndOfStatement ()=0
 
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...
 
virtual size_t peekTokens (MutableArrayRef< AsmToken > Buf, bool ShouldSkipSpace=true)=0
 Look ahead an arbitrary number of tokens. 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 setCommentConsumer (AsmCommentConsumer *CommentConsumer)
 

Protected Member Functions

 MCAsmLexer ()
 
virtual AsmToken LexToken ()=0
 
void SetError (SMLoc errLoc, const std::string &err)
 

Protected Attributes

const charTokStart = nullptr
 
bool SkipSpace = true
 
bool AllowAtInIdentifier
 
bool IsAtStartOfStatement = true
 
AsmCommentConsumerCommentConsumer = nullptr
 
bool AltMacroMode
 

Detailed Description

Generic assembler lexer interface, for use by target specific assembly lexers.

Definition at line 149 of file MCAsmLexer.h.

Constructor & Destructor Documentation

◆ MCAsmLexer() [1/2]

MCAsmLexer::MCAsmLexer ( )
protected

Definition at line 16 of file MCAsmLexer.cpp.

References llvm::AsmToken::Space, and ~MCAsmLexer().

◆ MCAsmLexer() [2/2]

llvm::MCAsmLexer::MCAsmLexer ( const MCAsmLexer )
delete

◆ ~MCAsmLexer()

MCAsmLexer::~MCAsmLexer ( )
virtualdefault

Referenced by MCAsmLexer().

Member Function Documentation

◆ getAllowAtInIdentifier()

bool llvm::MCAsmLexer::getAllowAtInIdentifier ( )
inline

Definition at line 261 of file MCAsmLexer.h.

Referenced by parseSectionFlags().

◆ getErr()

const std::string& llvm::MCAsmLexer::getErr ( )
inline

Get the current error string.

Definition at line 245 of file MCAsmLexer.h.

Referenced by isOperator(), and llvm::AsmLexer::peekTokens().

◆ getErrLoc()

SMLoc llvm::MCAsmLexer::getErrLoc ( )
inline

Get the current error location.

Definition at line 240 of file MCAsmLexer.h.

Referenced by llvm::AsmLexer::peekTokens().

◆ getKind()

AsmToken::TokenKind llvm::MCAsmLexer::getKind ( ) const
inline

Get the kind of current token.

Definition at line 250 of file MCAsmLexer.h.

Referenced by getGNUBinOpPrecedence(), isOperator(), and llvm::AVROperand::print().

◆ getLoc()

SMLoc MCAsmLexer::getLoc ( ) const

◆ getTok()

const AsmToken& llvm::MCAsmLexer::getTok ( ) const
inline

Get the current (last) lexed token.

Definition at line 218 of file MCAsmLexer.h.

Referenced by llvm::MCAsmParser::getTok(), isOperator(), and previousIsLoop().

◆ is()

bool llvm::MCAsmLexer::is ( AsmToken::TokenKind  K) const
inline

Check if the current token has kind K.

Definition at line 253 of file MCAsmLexer.h.

Referenced by getGNUBinOpPrecedence(), isOperator(), isValidEncoding(), llvm::AsmLexer::LexToken(), parseSectionFlags(), previousIsLoop(), and RefineErrorLoc().

◆ IsaAltMacroMode()

bool llvm::MCAsmLexer::IsaAltMacroMode ( )
inline

Definition at line 179 of file MCAsmLexer.h.

Referenced by isIdentifierChar(), and isOperator().

◆ isAtStartOfStatement()

bool llvm::MCAsmLexer::isAtStartOfStatement ( )
inline

Definition at line 210 of file MCAsmLexer.h.

References llvm::AsmToken::getLoc().

◆ isNot()

bool llvm::MCAsmLexer::isNot ( AsmToken::TokenKind  K) const
inline

Check if the current token has kind K.

Definition at line 256 of file MCAsmLexer.h.

Referenced by expectAbsExpression(), getGNUBinOpPrecedence(), hasPrefix(), isOperator(), isValidEncoding(), parseSectionFlags(), and RefineErrorLoc().

◆ Lex()

const AsmToken& llvm::MCAsmLexer::Lex ( )
inline

Consume the next token from the input stream and return it.

The lexer will continuosly return the end-of-file token once the end of the main input file has been reached.

Definition at line 191 of file MCAsmLexer.h.

References assert(), llvm::SmallVectorTemplateCommon< T >::begin(), llvm::SmallVectorBase::empty(), llvm::AsmToken::EndOfStatement, llvm::SmallVectorImpl< T >::erase(), llvm::SmallVectorTemplateCommon< T >::front(), llvm::SmallVectorImpl< T >::insert(), and T.

Referenced by llvm::MCAsmParser::Error(), expectAbsExpression(), getGNUBinOpPrecedence(), isOperator(), isValidEncoding(), and previousIsLoop().

◆ LexToken()

virtual AsmToken llvm::MCAsmLexer::LexToken ( )
protectedpure virtual

Implemented in llvm::AsmLexer.

◆ LexUntilEndOfStatement()

virtual StringRef llvm::MCAsmLexer::LexUntilEndOfStatement ( )
pure virtual

Implemented in llvm::AsmLexer.

◆ operator=()

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

◆ peekTok()

const AsmToken llvm::MCAsmLexer::peekTok ( bool  ShouldSkipSpace = true)
inline

Look ahead at the next token to be lexed.

Definition at line 223 of file MCAsmLexer.h.

References assert().

Referenced by getNextRegister(), isOperator(), previousIsLoop(), llvm::AVROperand::print(), RefineErrorLoc(), and setRequiredFeatureString().

◆ peekTokens()

virtual size_t llvm::MCAsmLexer::peekTokens ( MutableArrayRef< AsmToken Buf,
bool  ShouldSkipSpace = true 
)
pure virtual

Look ahead an arbitrary number of tokens.

Implemented in llvm::AsmLexer.

Referenced by llvm::AVROperand::print().

◆ setAllowAtInIdentifier()

void llvm::MCAsmLexer::setAllowAtInIdentifier ( bool  v)
inline

Definition at line 262 of file MCAsmLexer.h.

◆ SetAltMacroMode()

void llvm::MCAsmLexer::SetAltMacroMode ( bool  AltMacroSet)
inline

Definition at line 183 of file MCAsmLexer.h.

◆ setCommentConsumer()

void llvm::MCAsmLexer::setCommentConsumer ( AsmCommentConsumer CommentConsumer)
inline

Definition at line 264 of file MCAsmLexer.h.

◆ SetError()

void llvm::MCAsmLexer::SetError ( SMLoc  errLoc,
const std::string &  err 
)
inlineprotected

Definition at line 169 of file MCAsmLexer.h.

Referenced by llvm::AsmLexer::peekTokens(), and llvm::AsmLexer::setBuffer().

◆ setSkipSpace()

void llvm::MCAsmLexer::setSkipSpace ( bool  val)
inline

Set whether spaces should be ignored by the lexer.

Definition at line 259 of file MCAsmLexer.h.

Referenced by isOperator().

◆ UnLex()

void llvm::MCAsmLexer::UnLex ( AsmToken const Token)
inline

Member Data Documentation

◆ AllowAtInIdentifier

bool llvm::MCAsmLexer::AllowAtInIdentifier
protected

Definition at line 160 of file MCAsmLexer.h.

Referenced by llvm::AsmLexer::AsmLexer(), and IsIdentifierChar().

◆ AltMacroMode

bool llvm::MCAsmLexer::AltMacroMode
protected

Definition at line 164 of file MCAsmLexer.h.

◆ CommentConsumer

AsmCommentConsumer* llvm::MCAsmLexer::CommentConsumer = nullptr
protected

Definition at line 162 of file MCAsmLexer.h.

Referenced by IsIdentifierChar().

◆ IsAtStartOfStatement

bool llvm::MCAsmLexer::IsAtStartOfStatement = true
protected

Definition at line 161 of file MCAsmLexer.h.

◆ SkipSpace

bool llvm::MCAsmLexer::SkipSpace = true
protected

Definition at line 159 of file MCAsmLexer.h.

Referenced by llvm::AsmLexer::LexToken(), and llvm::AsmLexer::peekTokens().

◆ TokStart

const char* llvm::MCAsmLexer::TokStart = nullptr
protected

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