LLDB mainline
lldb_private::dil::DILLexer Class Reference

Class for doing the simple lexing required by DIL. More...

#include <DILLexer.h>

Public Member Functions

const TokenGetCurrentToken ()
 Return the current token to be handled by the DIL parser.
void Advance (uint32_t N=1)
 Advance the current token position by N.
const TokenLookAhead (uint32_t N)
 Return the lexed token N positions ahead of the 'current' token being handled by the DIL parser.
uint32_t GetCurrentTokenIdx ()
 Return the index for the 'current' token being handled by the DIL parser.
void ResetTokenIdx (uint32_t new_value)
 Set the index for the 'current' token (to be handled by the parser) to a particular position.
uint32_t NumLexedTokens ()

Static Public Member Functions

static llvm::Expected< DILLexerCreate (llvm::StringRef expr, lldb::DILMode mode=lldb::eDILModeFull)
 Lexes all the tokens in expr and calls the private constructor with the lexed tokens.

Private Member Functions

 DILLexer (llvm::StringRef dil_expr, std::vector< Token > lexed_tokens)

Static Private Member Functions

static llvm::Expected< TokenLex (llvm::StringRef expr, llvm::StringRef &remainder)

Private Attributes

llvm::StringRef m_expr
std::vector< Tokenm_lexed_tokens
uint32_t m_tokens_idx

Detailed Description

Class for doing the simple lexing required by DIL.

Definition at line 104 of file DILLexer.h.

Constructor & Destructor Documentation

◆ DILLexer()

lldb_private::dil::DILLexer::DILLexer ( llvm::StringRef dil_expr,
std::vector< Token > lexed_tokens )
inlineprivate

Definition at line 147 of file DILLexer.h.

References m_expr, m_lexed_tokens, and m_tokens_idx.

Referenced by Create().

Member Function Documentation

◆ Advance()

void lldb_private::dil::DILLexer::Advance ( uint32_t N = 1)
inline

Advance the current token position by N.

Definition at line 115 of file DILLexer.h.

References m_lexed_tokens, and m_tokens_idx.

◆ Create()

llvm::Expected< DILLexer > lldb_private::dil::DILLexer::Create ( llvm::StringRef expr,
lldb::DILMode mode = lldb::eDILModeFull )
static

Lexes all the tokens in expr and calls the private constructor with the lexed tokens.

Definition at line 199 of file DILLexer.cpp.

References DILLexer(), lldb_private::dil::Token::eof, error(), lldb_private::dil::IsNotAllowedByMode(), and Lex().

Referenced by lldb_private::StackFrame::DILGetValueForVariableExpressionPath().

◆ GetCurrentToken()

const Token & lldb_private::dil::DILLexer::GetCurrentToken ( )
inline

Return the current token to be handled by the DIL parser.

Definition at line 112 of file DILLexer.h.

References m_lexed_tokens, and m_tokens_idx.

◆ GetCurrentTokenIdx()

uint32_t lldb_private::dil::DILLexer::GetCurrentTokenIdx ( )
inline

Return the index for the 'current' token being handled by the DIL parser.

Definition at line 134 of file DILLexer.h.

References m_tokens_idx.

◆ Lex()

llvm::Expected< Token > lldb_private::dil::DILLexer::Lex ( llvm::StringRef expr,
llvm::StringRef & remainder )
staticprivate

Definition at line 216 of file DILLexer.cpp.

References lldb_private::dil::Token::amp, lldb_private::dil::Token::ampamp, lldb_private::dil::Token::ampequal, lldb_private::dil::Token::arrow, lldb_private::dil::Token::caret, lldb_private::dil::Token::caretequal, lldb_private::dil::Token::colon, lldb_private::dil::Token::coloncolon, lldb_private::dil::Token::eof, lldb_private::dil::Token::equal, lldb_private::dil::Token::equalequal, lldb_private::dil::Token::exclaim, lldb_private::dil::Token::exclaimequal, lldb_private::dil::Token::float_constant, lldb_private::dil::Token::greater, lldb_private::dil::Token::greaterequal, lldb_private::dil::Token::greatergreater, lldb_private::dil::Token::greatergreaterequal, lldb_private::dil::Token::identifier, lldb_private::dil::Token::integer_constant, lldb_private::dil::IsNumber(), lldb_private::dil::IsWord(), lldb_private::dil::Token::kw_false, lldb_private::dil::Token::kw_true, lldb_private::dil::Token::l_paren, lldb_private::dil::Token::l_square, lldb_private::dil::Token::less, lldb_private::dil::Token::lessequal, lldb_private::dil::Token::lessless, lldb_private::dil::Token::lesslessequal, lldb_private::dil::Token::minus, lldb_private::dil::Token::minusequal, lldb_private::dil::Token::minusminus, lldb_private::dil::Token::percent, lldb_private::dil::Token::percentequal, lldb_private::dil::Token::period, lldb_private::dil::Token::pipe, lldb_private::dil::Token::pipeequal, lldb_private::dil::Token::pipepipe, lldb_private::dil::Token::plus, lldb_private::dil::Token::plusequal, lldb_private::dil::Token::plusplus, lldb_private::dil::Token::question, lldb_private::dil::Token::r_paren, lldb_private::dil::Token::r_square, lldb_private::dil::Token::slash, lldb_private::dil::Token::slashequal, lldb_private::dil::Token::star, lldb_private::dil::Token::starequal, and lldb_private::dil::Token::tilde.

Referenced by Create().

◆ LookAhead()

const Token & lldb_private::dil::DILLexer::LookAhead ( uint32_t N)
inline

Return the lexed token N positions ahead of the 'current' token being handled by the DIL parser.

Definition at line 125 of file DILLexer.h.

References m_lexed_tokens, and m_tokens_idx.

◆ NumLexedTokens()

uint32_t lldb_private::dil::DILLexer::NumLexedTokens ( )
inline

Definition at line 144 of file DILLexer.h.

References m_lexed_tokens.

◆ ResetTokenIdx()

void lldb_private::dil::DILLexer::ResetTokenIdx ( uint32_t new_value)
inline

Set the index for the 'current' token (to be handled by the parser) to a particular position.

Used for either committing 'look ahead' parsing or rolling back tentative parsing.

Definition at line 139 of file DILLexer.h.

References m_lexed_tokens, and m_tokens_idx.

Member Data Documentation

◆ m_expr

llvm::StringRef lldb_private::dil::DILLexer::m_expr
private

Definition at line 155 of file DILLexer.h.

Referenced by DILLexer().

◆ m_lexed_tokens

std::vector<Token> lldb_private::dil::DILLexer::m_lexed_tokens
private

Definition at line 158 of file DILLexer.h.

Referenced by Advance(), DILLexer(), GetCurrentToken(), LookAhead(), NumLexedTokens(), and ResetTokenIdx().

◆ m_tokens_idx

uint32_t lldb_private::dil::DILLexer::m_tokens_idx
private

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