LLDB mainline
lldb_private::dil::DILParser Class Reference

Pure recursive descent parser for C++ like expressions. More...

#include <DILParser.h>

Public Member Functions

 ~DILParser ()=default
bool UseSynthetic ()
bool UseFragileIvar ()
bool CheckPtrVsMember ()
lldb::DynamicValueType UseDynamic ()

Static Public Member Functions

static llvm::Expected< ASTNodeUPParse (llvm::StringRef dil_input_expr, DILLexer lexer, std::shared_ptr< StackFrame > frame_sp, lldb::DynamicValueType use_dynamic, bool use_synthetic, bool fragile_ivar, bool check_ptr_vs_member)

Private Member Functions

 DILParser (llvm::StringRef dil_input_expr, DILLexer lexer, std::shared_ptr< StackFrame > frame_sp, lldb::DynamicValueType use_dynamic, bool use_synthetic, bool fragile_ivar, bool check_ptr_vs_member, llvm::Error &error)
ASTNodeUP Run ()
ASTNodeUP ParseExpression ()
ASTNodeUP ParseUnaryExpression ()
ASTNodeUP ParsePostfixExpression ()
ASTNodeUP ParsePrimaryExpression ()
std::string ParseNestedNameSpecifier ()
std::string ParseIdExpression ()
std::string ParseUnqualifiedId ()
std::optional< int64_t > ParseIntegerConstant ()
ASTNodeUP ParseNumericLiteral ()
ASTNodeUP ParseIntegerLiteral ()
ASTNodeUP ParseFloatingPointLiteral ()
ASTNodeUP ParseBooleanLiteral ()
void BailOut (const std::string &error, uint32_t loc, uint16_t err_len)
void Expect (Token::Kind kind)
void ExpectOneOf (std::vector< Token::Kind > kinds_vec)
void TentativeParsingRollback (uint32_t saved_idx)
Token CurToken ()

Private Attributes

std::shared_ptr< StackFramem_ctx_scope
llvm::StringRef m_input_expr
DILLexer m_dil_lexer
llvm::Error & m_error
lldb::DynamicValueType m_use_dynamic
bool m_use_synthetic
bool m_fragile_ivar
bool m_check_ptr_vs_member

Detailed Description

Pure recursive descent parser for C++ like expressions.

EBNF grammar for the parser is described in lldb/docs/dil-expr-lang.ebnf

Definition at line 61 of file DILParser.h.

Constructor & Destructor Documentation

◆ ~DILParser()

lldb_private::dil::DILParser::~DILParser ( )
default

◆ DILParser()

lldb_private::dil::DILParser::DILParser ( llvm::StringRef dil_input_expr,
DILLexer lexer,
std::shared_ptr< StackFrame > frame_sp,
lldb::DynamicValueType use_dynamic,
bool use_synthetic,
bool fragile_ivar,
bool check_ptr_vs_member,
llvm::Error & error )
explicitprivate

Member Function Documentation

◆ BailOut()

void lldb_private::dil::DILParser::BailOut ( const std::string & error,
uint32_t loc,
uint16_t err_len )
private

◆ CheckPtrVsMember()

bool lldb_private::dil::DILParser::CheckPtrVsMember ( )
inline

Definition at line 76 of file DILParser.h.

References m_check_ptr_vs_member.

◆ CurToken()

◆ Expect()

void lldb_private::dil::DILParser::Expect ( Token::Kind kind)
private

◆ ExpectOneOf()

void lldb_private::dil::DILParser::ExpectOneOf ( std::vector< Token::Kind > kinds_vec)
private

Definition at line 464 of file DILParser.cpp.

References BailOut(), and CurToken().

Referenced by ParseBooleanLiteral().

◆ Parse()

llvm::Expected< ASTNodeUP > lldb_private::dil::DILParser::Parse ( llvm::StringRef dil_input_expr,
DILLexer lexer,
std::shared_ptr< StackFrame > frame_sp,
lldb::DynamicValueType use_dynamic,
bool use_synthetic,
bool fragile_ivar,
bool check_ptr_vs_member )
static

Definition at line 46 of file DILParser.cpp.

References DILParser(), error(), and Run().

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

◆ ParseBooleanLiteral()

◆ ParseExpression()

ASTNodeUP lldb_private::dil::DILParser::ParseExpression ( )
private

Definition at line 85 of file DILParser.cpp.

References ParseUnaryExpression().

Referenced by ParsePrimaryExpression(), ParseUnaryExpression(), and Run().

◆ ParseFloatingPointLiteral()

ASTNodeUP lldb_private::dil::DILParser::ParseFloatingPointLiteral ( )
private

◆ ParseIdExpression()

◆ ParseIntegerConstant()

std::optional< int64_t > lldb_private::dil::DILParser::ParseIntegerConstant ( )
private

Definition at line 375 of file DILParser.cpp.

References CurToken(), GetKind(), m_dil_lexer, and lldb_private::dil::Token::minus.

Referenced by ParsePostfixExpression().

◆ ParseIntegerLiteral()

◆ ParseNestedNameSpecifier()

◆ ParseNumericLiteral()

ASTNodeUP lldb_private::dil::DILParser::ParseNumericLiteral ( )
private

◆ ParsePostfixExpression()

◆ ParsePrimaryExpression()

◆ ParseUnaryExpression()

◆ ParseUnqualifiedId()

std::string lldb_private::dil::DILParser::ParseUnqualifiedId ( )
private

◆ Run()

ASTNodeUP lldb_private::dil::DILParser::Run ( )
private

Definition at line 72 of file DILParser.cpp.

References lldb_private::dil::Token::eof, Expect(), and ParseExpression().

Referenced by Parse().

◆ TentativeParsingRollback()

void lldb_private::dil::DILParser::TentativeParsingRollback ( uint32_t saved_idx)
inlineprivate

Definition at line 110 of file DILParser.h.

References m_dil_lexer, and m_error.

◆ UseDynamic()

lldb::DynamicValueType lldb_private::dil::DILParser::UseDynamic ( )
inline

Definition at line 78 of file DILParser.h.

References m_use_dynamic.

◆ UseFragileIvar()

bool lldb_private::dil::DILParser::UseFragileIvar ( )
inline

Definition at line 74 of file DILParser.h.

References m_fragile_ivar.

◆ UseSynthetic()

bool lldb_private::dil::DILParser::UseSynthetic ( )
inline

Definition at line 72 of file DILParser.h.

References m_use_synthetic.

Member Data Documentation

◆ m_check_ptr_vs_member

bool lldb_private::dil::DILParser::m_check_ptr_vs_member
private

Definition at line 133 of file DILParser.h.

Referenced by CheckPtrVsMember(), and DILParser().

◆ m_ctx_scope

std::shared_ptr<StackFrame> lldb_private::dil::DILParser::m_ctx_scope
private

Definition at line 121 of file DILParser.h.

Referenced by DILParser().

◆ m_dil_lexer

◆ m_error

llvm::Error& lldb_private::dil::DILParser::m_error
private

Definition at line 128 of file DILParser.h.

Referenced by BailOut(), DILParser(), and TentativeParsingRollback().

◆ m_fragile_ivar

bool lldb_private::dil::DILParser::m_fragile_ivar
private

Definition at line 132 of file DILParser.h.

Referenced by DILParser(), and UseFragileIvar().

◆ m_input_expr

llvm::StringRef lldb_private::dil::DILParser::m_input_expr
private

Definition at line 123 of file DILParser.h.

Referenced by BailOut(), and DILParser().

◆ m_use_dynamic

lldb::DynamicValueType lldb_private::dil::DILParser::m_use_dynamic
private

Definition at line 130 of file DILParser.h.

Referenced by DILParser(), and UseDynamic().

◆ m_use_synthetic

bool lldb_private::dil::DILParser::m_use_synthetic
private

Definition at line 131 of file DILParser.h.

Referenced by DILParser(), and UseSynthetic().


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