GSC Interpreter
A Turing-complete interpreter developed for a compiler course
Loading...
Searching...
No Matches
Grouping Class Reference

Class representing a grouping expression. More...

#include <expr.hpp>

Inheritance diagram for Grouping:
Collaboration diagram for Grouping:

Public Member Functions

 Grouping (std::shared_ptr< Expr > expression)
 
std::any accept (ExprVisitor &visitor) override
 
std::shared_ptr< ExprgetExpression () const
 

Private Attributes

const std::shared_ptr< Exprexpression
 

Detailed Description

Class representing a grouping expression.

This class represents a grouping expression in the AST, which is used to group sub-expressions. It inherits from the Expr class and implements the accept method for visitor pattern.

Definition at line 79 of file expr.hpp.

Constructor & Destructor Documentation

◆ Grouping()

Grouping::Grouping ( std::shared_ptr< Expr expression)
inline

Definition at line 84 of file expr.hpp.

85 : expression(std::move(expression)) {}
const std::shared_ptr< Expr > expression
Definition expr.hpp:81

Member Function Documentation

◆ accept()

std::any Grouping::accept ( ExprVisitor visitor)
inlineoverridevirtual

Implements Expr.

Definition at line 87 of file expr.hpp.

87 {
88 return visitor.visitGroupingExpr(shared_from_this());
89 }
virtual std::any visitGroupingExpr(std::shared_ptr< Grouping > expr)=0

◆ getExpression()

std::shared_ptr< Expr > Grouping::getExpression ( ) const
inline

Definition at line 91 of file expr.hpp.

91{ return expression; }

Member Data Documentation

◆ expression

const std::shared_ptr<Expr> Grouping::expression
private

Definition at line 81 of file expr.hpp.


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