ALib C++ Library
Library Version: 2412 R0
Documentation generated by doxygen
Loading...
Searching...
No Matches
ASTConditional Struct Reference

Description:

Abstract syntax tree node representing ternary operator Q ? T : F.

Definition at line 266 of file ast.hpp.

#include <ast.hpp>

Inheritance diagram for ASTConditional:
[legend]
Collaboration diagram for ASTConditional:
[legend]

Public Field Index:

integer ColonPosition
 The index of the colon in the expression string.
 
ASTF
 The false-result.
 
ASTQ
 The question.
 
ASTT
 The true-result.
 
- Public Field Index: inherited from AST
Types NodeType
 Type of derived this AST node.
 
integer Position
 Position in original expression string.
 

Public Method Index:

 ASTConditional (AST *q, AST *t, AST *f, integer position, integer colonPosition)
 
virtual ~ASTConditional () override
 Virtual destructor.
 
virtual void Assemble (Program &program, MonoAllocator &allocator, AString &normalized) override
 
virtual ASTOptimize (Normalization normalization) override
 
- Public Method Index: inherited from AST
 AST ()=delete
 Deleted default constructor.
 
 AST (Types type, integer position)
 
virtual ~AST ()
 Virtual destructor.
 

Additional Inherited Members

- Public Type Index: inherited from AST
enum class  Types {
  Literal , Identifier , Function , UnaryOp ,
  BinaryOp , TernaryOp
}
 The type of node. More...
 

Field Details:

◆ ColonPosition

integer ColonPosition

The index of the colon in the expression string.

Definition at line 271 of file ast.hpp.

◆ F

AST* F

The false-result.

Definition at line 270 of file ast.hpp.

◆ Q

AST* Q

The question.

Definition at line 268 of file ast.hpp.

◆ T

AST* T

The true-result.

Definition at line 269 of file ast.hpp.

Constructor(s) / Destructor Details:

◆ ASTConditional()

ASTConditional ( AST * q,
AST * t,
AST * f,
integer position,
integer colonPosition )
inlineexplicit

Constructor providing all fields.

Parameters
qThe question.
tThe true-result.
fThe false-result.
positionThe index of the question mark in the expression string.
colonPositionThe index of the colon in the expression string.

Definition at line 280 of file ast.hpp.

◆ ~ASTConditional()

virtual ~ASTConditional ( )
inlineoverridevirtual

Virtual destructor.

Definition at line 287 of file ast.hpp.

Method Details:

◆ Assemble()

void Assemble ( Program & program,
MonoAllocator & allocator,
AString & normalized )
overridevirtual

Implements abstract method.

Parameters
programThe program to be compiled.
allocatorAn allocator usable for temporary objects.
[out]normalizedThe normalized string, built during recursive compilation of the AST.

Implements AST.

Definition at line 534 of file ast.cpp.

Here is the call graph for this function:

◆ Optimize()

AST * Optimize ( Normalization normalization)
overridevirtual

Implements abstract method.

Parameters
normalizationThe compiler flags denoting the normalization settings.
Returns
A potentially replaced AST or itself.

Implements AST.

Definition at line 67 of file ast.cpp.

Here is the call graph for this function:

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