class MCAsmLexer
Declaration
class MCAsmLexer { /* full declaration omitted */ };
Description
Generic assembler lexer interface, for use by target specific assembly lexers.
Declared at: llvm/include/llvm/MC/MCParser/MCAsmLexer.h:37
Member Variables
- private SmallVector<llvm::AsmToken, 1> CurTok
- The current token, stored in the base class for faster access.
- private llvm::SMLoc ErrLoc
- The location and description of the current error
- private std::string Err
- protected const char* TokStart = nullptr
- protected bool SkipSpace = true
- protected bool AllowAtInIdentifier
- protected bool AllowHashInIdentifier = false
- protected bool IsAtStartOfStatement = true
- protected bool LexMasmHexFloats = false
- protected bool LexMasmIntegers = false
- protected bool LexMasmStrings = false
- protected bool LexMotorolaIntegers = false
- protected bool UseMasmDefaultRadix = false
- protected unsigned int DefaultRadix = 10
- protected bool LexHLASMIntegers = false
- protected bool LexHLASMStrings = false
- protected llvm::AsmCommentConsumer* CommentConsumer = nullptr
Method Overview
- public const llvm::AsmToken & Lex()
- protected virtual llvm::AsmToken LexToken()
- public virtual llvm::StringRef LexUntilEndOfStatement()
- public MCAsmLexer(const llvm::MCAsmLexer &)
- protected MCAsmLexer()
- protected void SetError(llvm::SMLoc errLoc, const std::string & err)
- public void UnLex(const llvm::AsmToken & Token)
- public bool getAllowAtInIdentifier()
- public const std::string & getErr()
- public llvm::SMLoc getErrLoc()
- public AsmToken::TokenKind getKind() const
- public llvm::SMLoc getLoc() const
- public unsigned int getMasmDefaultRadix() const
- public const llvm::AsmToken & getTok() const
- public bool is(AsmToken::TokenKind K) const
- public bool isAtStartOfStatement()
- public bool isNot(AsmToken::TokenKind K) const
- public const llvm::AsmToken peekTok(bool ShouldSkipSpace = true)
- public virtual size_t peekTokens(MutableArrayRef<llvm::AsmToken> Buf, bool ShouldSkipSpace = true)
- public void setAllowAtInIdentifier(bool v)
- public void setAllowHashInIdentifier(bool V)
- public void setCommentConsumer(llvm::AsmCommentConsumer * CommentConsumer)
- public void setLexHLASMIntegers(bool V)
- public void setLexHLASMStrings(bool V)
- public void setLexMasmHexFloats(bool V)
- public void setLexMasmIntegers(bool V)
- public void setLexMasmStrings(bool V)
- public void setLexMotorolaIntegers(bool V)
- public void setMasmDefaultRadix(unsigned int Radix)
- public void setSkipSpace(bool val)
- public void useMasmDefaultRadix(bool V)
- public virtual ~MCAsmLexer()
Methods
¶const llvm::AsmToken& Lex()
const llvm::AsmToken& Lex()
Description
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.
Declared at: llvm/include/llvm/MC/MCParser/MCAsmLexer.h:79
¶virtual llvm::AsmToken LexToken()
virtual llvm::AsmToken LexToken()
Declared at: llvm/include/llvm/MC/MCParser/MCAsmLexer.h:63
¶virtual llvm::StringRef LexUntilEndOfStatement()
virtual llvm::StringRef LexUntilEndOfStatement()
Declared at: llvm/include/llvm/MC/MCParser/MCAsmLexer.h:100
¶MCAsmLexer(const llvm::MCAsmLexer&)
MCAsmLexer(const llvm::MCAsmLexer&)
Declared at: llvm/include/llvm/MC/MCParser/MCAsmLexer.h:71
Parameters
- const llvm::MCAsmLexer&
¶MCAsmLexer()
MCAsmLexer()
Declared at: llvm/include/llvm/MC/MCParser/MCAsmLexer.h:61
¶void SetError(llvm::SMLoc errLoc,
const std::string& err)
void SetError(llvm::SMLoc errLoc,
const std::string& err)
Declared at: llvm/include/llvm/MC/MCParser/MCAsmLexer.h:65
Parameters
- llvm::SMLoc errLoc
- const std::string& err
¶void UnLex(const llvm::AsmToken& Token)
void UnLex(const llvm::AsmToken& Token)
Declared at: llvm/include/llvm/MC/MCParser/MCAsmLexer.h:93
Parameters
- const llvm::AsmToken& Token
¶bool getAllowAtInIdentifier()
bool getAllowAtInIdentifier()
Declared at: llvm/include/llvm/MC/MCParser/MCAsmLexer.h:149
¶const std::string& getErr()
const std::string& getErr()
Description
Get the current error string
Declared at: llvm/include/llvm/MC/MCParser/MCAsmLexer.h:133
¶llvm::SMLoc getErrLoc()
llvm::SMLoc getErrLoc()
Description
Get the current error location
Declared at: llvm/include/llvm/MC/MCParser/MCAsmLexer.h:128
¶AsmToken::TokenKind getKind() const
AsmToken::TokenKind getKind() const
Description
Get the kind of current token.
Declared at: llvm/include/llvm/MC/MCParser/MCAsmLexer.h:138
¶llvm::SMLoc getLoc() const
llvm::SMLoc getLoc() const
Description
Get the current source location.
Declared at: llvm/include/llvm/MC/MCParser/MCAsmLexer.h:103
¶unsigned int getMasmDefaultRadix() const
unsigned int getMasmDefaultRadix() const
Declared at: llvm/include/llvm/MC/MCParser/MCAsmLexer.h:166
¶const llvm::AsmToken& getTok() const
const llvm::AsmToken& getTok() const
Description
Get the current (last) lexed token.
Declared at: llvm/include/llvm/MC/MCParser/MCAsmLexer.h:106
¶bool is(AsmToken::TokenKind K) const
bool is(AsmToken::TokenKind K) const
Description
Check if the current token has kind \p K.
Declared at: llvm/include/llvm/MC/MCParser/MCAsmLexer.h:141
Parameters
- AsmToken::TokenKind K
¶bool isAtStartOfStatement()
bool isAtStartOfStatement()
Declared at: llvm/include/llvm/MC/MCParser/MCAsmLexer.h:98
¶bool isNot(AsmToken::TokenKind K) const
bool isNot(AsmToken::TokenKind K) const
Description
Check if the current token has kind \p K.
Declared at: llvm/include/llvm/MC/MCParser/MCAsmLexer.h:144
Parameters
- AsmToken::TokenKind K
¶const llvm::AsmToken peekTok(
bool ShouldSkipSpace = true)
const llvm::AsmToken peekTok(
bool ShouldSkipSpace = true)
Description
Look ahead at the next token to be lexed.
Declared at: llvm/include/llvm/MC/MCParser/MCAsmLexer.h:111
Parameters
- bool ShouldSkipSpace = true
¶virtual size_t peekTokens(
MutableArrayRef<llvm::AsmToken> Buf,
bool ShouldSkipSpace = true)
virtual size_t peekTokens(
MutableArrayRef<llvm::AsmToken> Buf,
bool ShouldSkipSpace = true)
Description
Look ahead an arbitrary number of tokens.
Declared at: llvm/include/llvm/MC/MCParser/MCAsmLexer.h:124
Parameters
- MutableArrayRef<llvm::AsmToken> Buf
- bool ShouldSkipSpace = true
¶void setAllowAtInIdentifier(bool v)
void setAllowAtInIdentifier(bool v)
Declared at: llvm/include/llvm/MC/MCParser/MCAsmLexer.h:150
Parameters
- bool v
¶void setAllowHashInIdentifier(bool V)
void setAllowHashInIdentifier(bool V)
Declared at: llvm/include/llvm/MC/MCParser/MCAsmLexer.h:152
Parameters
- bool V
¶void setCommentConsumer(
llvm::AsmCommentConsumer* CommentConsumer)
void setCommentConsumer(
llvm::AsmCommentConsumer* CommentConsumer)
Declared at: llvm/include/llvm/MC/MCParser/MCAsmLexer.h:154
Parameters
- llvm::AsmCommentConsumer* CommentConsumer
¶void setLexHLASMIntegers(bool V)
void setLexHLASMIntegers(bool V)
Description
Set whether to lex HLASM-flavour integers. For now this is only [0-9]*
Declared at: llvm/include/llvm/MC/MCParser/MCAsmLexer.h:181
Parameters
- bool V
¶void setLexHLASMStrings(bool V)
void setLexHLASMStrings(bool V)
Description
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.
Declared at: llvm/include/llvm/MC/MCParser/MCAsmLexer.h:186
Parameters
- bool V
¶void setLexMasmHexFloats(bool V)
void setLexMasmHexFloats(bool V)
Description
Set whether to lex masm-style hex float literals, such as 3f800000r.
Declared at: llvm/include/llvm/MC/MCParser/MCAsmLexer.h:170
Parameters
- bool V
¶void setLexMasmIntegers(bool V)
void setLexMasmIntegers(bool V)
Description
Set whether to lex masm-style binary (e.g., 0b1101) and radix-specified literals (e.g., 0ABCh [hex], 576t [decimal], 77o [octal], 1101y [binary]).
Declared at: llvm/include/llvm/MC/MCParser/MCAsmLexer.h:160
Parameters
- bool V
¶void setLexMasmStrings(bool V)
void setLexMasmStrings(bool V)
Description
Set whether to lex masm-style string literals, such as 'Can''t find file' and "This ""value"" not found".
Declared at: llvm/include/llvm/MC/MCParser/MCAsmLexer.h:174
Parameters
- bool V
¶void setLexMotorolaIntegers(bool V)
void setLexMotorolaIntegers(bool V)
Description
Set whether to lex Motorola-style integer literals, such as $deadbeef or %01010110.
Declared at: llvm/include/llvm/MC/MCParser/MCAsmLexer.h:178
Parameters
- bool V
¶void setMasmDefaultRadix(unsigned int Radix)
void setMasmDefaultRadix(unsigned int Radix)
Declared at: llvm/include/llvm/MC/MCParser/MCAsmLexer.h:167
Parameters
- unsigned int Radix
¶void setSkipSpace(bool val)
void setSkipSpace(bool val)
Description
Set whether spaces should be ignored by the lexer
Declared at: llvm/include/llvm/MC/MCParser/MCAsmLexer.h:147
Parameters
- bool val
¶void useMasmDefaultRadix(bool V)
void useMasmDefaultRadix(bool V)
Description
Set whether to use masm-style default-radix integer literals. If disabled, assume decimal unless prefixed (e.g., 0x2c [hex], 077 [octal]).
Declared at: llvm/include/llvm/MC/MCParser/MCAsmLexer.h:164
Parameters
- bool V
¶virtual ~MCAsmLexer()
virtual ~MCAsmLexer()
Declared at: llvm/include/llvm/MC/MCParser/MCAsmLexer.h:73