13#ifndef LLVM_MC_MCPARSER_ASMLEXER_H
14#define LLVM_MC_MCPARSER_ASMLEXER_H
47 const char *CurPtr =
nullptr;
56 bool IsAtStartOfLine =
true;
57 bool JustConsumedEOL =
true;
58 bool IsPeeking =
false;
59 bool EndStatementAtEOF =
true;
61 const char *TokStart =
nullptr;
62 bool SkipSpace =
true;
63 bool AllowAtInIdentifier =
false;
64 bool AllowHashInIdentifier =
false;
65 bool IsAtStartOfStatement =
true;
66 bool LexMasmHexFloats =
false;
67 bool LexMasmIntegers =
false;
68 bool LexMasmStrings =
false;
69 bool LexMotorolaIntegers =
false;
70 bool UseMasmDefaultRadix =
false;
71 unsigned DefaultRadix = 10;
72 bool LexHLASMIntegers =
false;
73 bool LexHLASMStrings =
false;
78 void SetError(
SMLoc errLoc,
const std::string &err) {
103 return CurTok.
front();
125 size_t ReadCount =
peekTokens(Buf, ShouldSkipSpace);
135 bool ShouldSkipSpace =
true);
141 const std::string &
getErr() {
return Err; }
161 this->CommentConsumer = CommentConsumer;
195 bool EndStatementAtEOF =
true);
200 bool isAtStartOfComment(
const char *
Ptr);
201 bool isAtStatementSeparator(
const char *
Ptr);
202 [[nodiscard]]
int getNextChar();
204 AsmToken ReturnError(
const char *Loc,
const std::string &Msg);
213 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...
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)
iterator erase(const_iterator CI)
iterator insert(iterator I, T &&Elt)
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.