9#ifndef LLDB_VALUEOBJECT_DILLEXER_H
10#define LLDB_VALUEOBJECT_DILLEXER_H
12#include "llvm/ADT/StringRef.h"
13#include "llvm/Support/Error.h"
14#include "llvm/Support/FormatVariadic.h"
46 Token(
Kind kind, std::string spelling, uint32_t start)
57 bool IsOneOf(llvm::ArrayRef<Kind> kinds)
const {
58 return llvm::is_contained(kinds,
m_kind);
76 static llvm::Expected<DILLexer>
Create(llvm::StringRef expr);
114 DILLexer(llvm::StringRef dil_expr, std::vector<Token> lexed_tokens)
118 static llvm::Expected<Token>
Lex(llvm::StringRef expr,
119 llvm::StringRef &remainder);
138 llvm::StringRef Options) {
145 llvm::StringRef Options) {
const Token & LookAhead(uint32_t N)
Return the lexed token N positions ahead of the 'current' token being handled by the DIL parser.
void Advance(uint32_t N=1)
Advance the current token position by N.
DILLexer(llvm::StringRef dil_expr, std::vector< Token > lexed_tokens)
uint32_t GetCurrentTokenIdx()
Return the index for the 'current' token being handled by the DIL parser.
static llvm::Expected< DILLexer > Create(llvm::StringRef expr)
Lexes all the tokens in expr and calls the private constructor with the lexed tokens.
const Token & GetCurrentToken()
Return the current token to be handled by the DIL parser.
uint32_t NumLexedTokens()
void ResetTokenIdx(uint32_t new_value)
Set the index for the 'current' token (to be handled by the parser) to a particular position.
static llvm::Expected< Token > Lex(llvm::StringRef expr, llvm::StringRef &remainder)
std::vector< Token > m_lexed_tokens
Class defining the tokens generated by the DIL lexer and used by the DIL parser.
bool IsNot(Kind kind) const
static llvm::StringRef GetTokenName(Kind kind)
Token(Kind kind, std::string spelling, uint32_t start)
uint32_t GetLocation() const
std::string GetSpelling() const
bool IsOneOf(llvm::ArrayRef< Kind > kinds) const
A class that represents a running process on the host machine.