ALib C++ Library
Library Version: 2312 R0
Documentation generated by doxygen
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
Public Fields | Public Methods | List of all members
ASTConditional Struct Reference

#include <ast.hpp>

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

Class Description

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

Definition at line 332 of file ast.hpp.

Public Fields

integer ColonPosition
 The index of the colon in the expression string.
 
ASTF
 The false-result.
 
ASTQ
 The question.
 
ASTT
 The true-result.
 
- Public Fields inherited from AST
Types NodeType
 
integer Position
 

Public Methods

 ASTConditional (AST *q, AST *t, AST *f, integer position, integer colonPosition)
 
virtual ~ASTConditional () override
 
virtual void Assemble (Program &program, MonoAllocator &allocator, AString &normalized) override
 
virtual ASTOptimize (Normalization normalization) override
 
- Public Methods inherited from AST
 AST ()=delete
 
 AST (Types type, integer position)
 
virtual ~AST ()
 

Additional Inherited Members

- Public Types inherited from AST
enum  Types {
  Literal, Identifier, Function, UnaryOp,
  BinaryOp, TernaryOp
}
 

Constructor & Destructor Documentation

◆ 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 348 of file ast.hpp.

◆ ~ASTConditional()

virtual ~ASTConditional ( )
inlineoverridevirtual

Virtual destructor.

Definition at line 357 of file ast.hpp.

Member Function Documentation

◆ 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 546 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 79 of file ast.cpp.

Here is the call graph for this function:

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