13#ifndef LLVM_MC_MCPARSER_ASMLEXER_H
14#define LLVM_MC_MCPARSER_ASMLEXER_H
46 const char *CurPtr =
nullptr;
55 bool IsAtStartOfLine =
true;
56 bool JustConsumedEOL =
true;
57 bool IsPeeking =
false;
58 bool EndStatementAtEOF =
true;
60 const char *TokStart =
nullptr;
61 bool SkipSpace =
true;
62 bool AllowAtInIdentifier =
false;
63 bool AllowHashInIdentifier =
false;
64 bool IsAtStartOfStatement =
true;
65 bool LexMasmHexFloats =
false;
66 bool LexMasmIntegers =
false;
67 bool LexMasmStrings =
false;
68 bool LexMotorolaIntegers =
false;
69 bool UseMasmDefaultRadix =
false;
70 unsigned DefaultRadix = 10;
71 bool LexHLASMIntegers =
false;
72 bool LexHLASMStrings =
false;
77 void SetError(
SMLoc errLoc,
const std::string &err) {
95 CurTok.erase(CurTok.begin());
100 CurTok.insert(CurTok.begin(),
T);
102 return CurTok.front();
106 CurTok.insert(CurTok.begin(), Token);
124 size_t ReadCount =
peekTokens(Buf, ShouldSkipSpace);
134 bool ShouldSkipSpace =
true);
140 const std::string &
getErr() {
return Err; }
160 this->CommentConsumer = CommentConsumer;
194 bool EndStatementAtEOF =
true);
199 bool isAtStartOfComment(
const char *
Ptr);
200 bool isAtStatementSeparator(
const char *
Ptr);
201 [[nodiscard]]
int getNextChar();
203 AsmToken ReturnError(
const char *
Loc,
const std::string &Msg);
212 AsmToken LexHexFloatLiteral(
bool NoIntDigits);
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
This file defines the SmallVector class.
void setLexHLASMStrings(bool V)
Set whether to "lex" HLASM-flavour character and string literals.
void setLexMasmIntegers(bool V)
Set whether to lex masm-style binary (e.g., 0b1101) and radix-specified literals (e....
SMLoc getLoc() const
Get the current source location.
void setLexMasmStrings(bool V)
Set whether to lex masm-style string literals, such as 'Can''t find file' and "This ""value"" not fou...
LLVM_ABI AsmLexer(const MCAsmInfo &MAI)
const AsmToken peekTok(bool ShouldSkipSpace=true)
Look ahead at the next token to be lexed.
bool getAllowAtInIdentifier()
void UnLex(AsmToken const &Token)
void setMasmDefaultRadix(unsigned Radix)
AsmToken::TokenKind getKind() const
Get the kind of current token.
void setLexMasmHexFloats(bool V)
Set whether to lex masm-style hex float literals, such as 3f800000r.
const MCAsmInfo & getMAI() const
const AsmToken & getTok() const
Get the current (last) lexed token.
bool is(AsmToken::TokenKind K) const
Check if the current token has kind K.
void setLexMotorolaIntegers(bool V)
Set whether to lex Motorola-style integer literals, such as $deadbeef or %01010110.
SMLoc getErrLoc()
Get the current error location.
AsmLexer(const AsmLexer &)=delete
const std::string & getErr()
Get the current error string.
const AsmToken & Lex()
Consume the next token from the input stream and return it.
void setSkipSpace(bool val)
Set whether spaces should be ignored by the lexer.
void setAllowAtInIdentifier(bool v)
LLVM_ABI StringRef LexUntilEndOfStatement()
AsmLexer & operator=(const AsmLexer &)=delete
LLVM_ABI void setBuffer(StringRef Buf, const char *ptr=nullptr, bool EndStatementAtEOF=true)
unsigned getMasmDefaultRadix() const
void useMasmDefaultRadix(bool V)
Set whether to use masm-style default-radix integer literals.
void setLexHLASMIntegers(bool V)
Set whether to lex HLASM-flavour integers. For now this is only [0-9]*.
bool isNot(AsmToken::TokenKind K) const
Check if the current token has kind K.
LLVM_ABI size_t peekTokens(MutableArrayRef< AsmToken > Buf, bool ShouldSkipSpace=true)
Look ahead an arbitrary number of tokens.
void setCommentConsumer(AsmCommentConsumer *CommentConsumer)
void setAllowHashInIdentifier(bool V)
Target independent representation for an assembler token.
bool isNot(TokenKind K) const
bool is(TokenKind K) const
TokenKind getKind() const
This class is intended to be used as a base class for asm properties and features specific to the tar...
MutableArrayRef - Represent a mutable reference to an array (0 or more elements consecutively in memo...
Represents a location in source code.
static SMLoc getFromPointer(const char *Ptr)
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
StringRef - Represent a constant reference to a string, i.e.
This is an optimization pass for GlobalISel generic memory operations.