LLVM  4.0.0
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 <MCAsmLexer.h>

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

Public Member Functions

virtual ~MCAsmLexer ()
 
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 char * TokStart
 
bool SkipSpace
 
bool AllowAtInIdentifier
 
bool IsAtStartOfStatement
 
AsmCommentConsumerCommentConsumer
 

Detailed Description

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

Definition at line 147 of file MCAsmLexer.h.

Constructor & Destructor Documentation

MCAsmLexer::MCAsmLexer ( )
protected

Definition at line 15 of file MCAsmLexer.cpp.

References llvm::AsmToken::Space.

MCAsmLexer::~MCAsmLexer ( )
virtual

Definition at line 21 of file MCAsmLexer.cpp.

Member Function Documentation

bool llvm::MCAsmLexer::getAllowAtInIdentifier ( )
inline

Definition at line 250 of file MCAsmLexer.h.

References AllowAtInIdentifier.

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

Get the current error string.

Definition at line 234 of file MCAsmLexer.h.

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

SMLoc llvm::MCAsmLexer::getErrLoc ( )
inline

Get the current error location.

Definition at line 229 of file MCAsmLexer.h.

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

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

Get the kind of current token.

Definition at line 239 of file MCAsmLexer.h.

References llvm::AsmToken::getKind(), and getTok().

SMLoc MCAsmLexer::getLoc ( ) const

Get the current source location.

Definition at line 24 of file MCAsmLexer.cpp.

References llvm::SMLoc::getFromPointer(), and TokStart.

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

Get the current (last) lexed token.

Definition at line 207 of file MCAsmLexer.h.

Referenced by getKind(), llvm::MCAsmParser::getTok(), is(), and isNot().

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

Check if the current token has kind K.

Definition at line 242 of file MCAsmLexer.h.

References getTok(), and llvm::AsmToken::is().

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

bool llvm::MCAsmLexer::isAtStartOfStatement ( )
inline

Definition at line 199 of file MCAsmLexer.h.

References IsAtStartOfStatement.

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

Check if the current token has kind K.

Definition at line 245 of file MCAsmLexer.h.

References getTok(), and llvm::AsmToken::isNot().

Referenced by expectAbsExpression().

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 180 of file MCAsmLexer.h.

References assert(), llvm::AsmToken::EndOfStatement, IsAtStartOfStatement, LexToken(), and T.

Referenced by llvm::MCAsmParser::Error(), expectAbsExpression(), and llvm::MCAsmParser::parseEOL().

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

Implemented in llvm::AsmLexer.

Referenced by Lex().

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

Implemented in llvm::AsmLexer.

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

Look ahead at the next token to be lexed.

Definition at line 212 of file MCAsmLexer.h.

References assert(), and 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 peekTok().

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

Definition at line 251 of file MCAsmLexer.h.

References AllowAtInIdentifier.

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

Definition at line 253 of file MCAsmLexer.h.

References CommentConsumer.

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

Definition at line 168 of file MCAsmLexer.h.

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

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

Set whether spaces should be ignored by the lexer.

Definition at line 248 of file MCAsmLexer.h.

References SkipSpace.

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

Definition at line 194 of file MCAsmLexer.h.

References IsAtStartOfStatement, and Token.

Referenced by llvm::AsmLexer::LexToken(), and llvm::MCAsmParser::parseEOL().

Member Data Documentation

bool llvm::MCAsmLexer::AllowAtInIdentifier
protected
AsmCommentConsumer* llvm::MCAsmLexer::CommentConsumer
protected

Definition at line 162 of file MCAsmLexer.h.

Referenced by setCommentConsumer().

bool llvm::MCAsmLexer::IsAtStartOfStatement
protected

Definition at line 161 of file MCAsmLexer.h.

Referenced by isAtStartOfStatement(), Lex(), and UnLex().

bool llvm::MCAsmLexer::SkipSpace
protected
const char* llvm::MCAsmLexer::TokStart
protected

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