ALib C++ Library
Library Version: 2402 R1
Documentation generated by doxygen
Loading...
Searching...
No Matches
ASTLiteral Struct Reference

Description:

Abstract syntax tree node representing identifiers.

Definition at line 89 of file ast.hpp.

#include <ast.hpp>

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

Public Type Index:

enum class  NFHint {
  NONE , Scientific , Hexadecimal , Octal ,
  Binary
}
 
- Public Type Index: inherited from AST
enum class  Types {
  Literal , Identifier , Function , UnaryOp ,
  BinaryOp , TernaryOp
}
 

Public Field Index:

NFHint Format
 The value of the literal.
 
Box Value
 The value of the literal.
 
- Public Field Index: inherited from AST
Types NodeType
 
integer Position
 

Public Method Index:

 ASTLiteral (const String &string, integer position)
 
 ASTLiteral (double value, integer position, NFHint hint=NFHint::NONE)
 
 ASTLiteral (integer value, integer position, NFHint hint=NFHint::NONE)
 
virtual void Assemble (Program &program, MonoAllocator &allocator, AString &normalized) override
 
virtual ASTOptimize (Normalization normalization) override
 
- Public Method Index: inherited from AST
 AST ()=delete
 
 AST (Types type, integer position)
 
virtual ~AST ()
 

Enumeration Details:

◆ NFHint

enum class NFHint
strong

This is a list of flags that store information obbout the format of the literal given in the expression string. This information is used with the generation of a normalized version of the literal.

Enumerator
NONE 

No hint.

Scientific 

Float was given in scientific format.

Hexadecimal 

Integral value was given in hexadecimal format.

Octal 

Integral value was given in octal format.

Binary 

Integral value was given in binary format.

Definition at line 96 of file ast.hpp.

Field Details:

◆ Format

The value of the literal.

Definition at line 106 of file ast.hpp.

◆ Value

Box Value

The value of the literal.

Definition at line 105 of file ast.hpp.

Constructor(s) / Destructor Details::

◆ ASTLiteral() [1/3]

ASTLiteral ( const String & string,
integer position )
inline

Constructs a string literal.

Parameters
stringThe value of the literal.
positionThe index of this AST in the expression string.

Definition at line 113 of file ast.hpp.

◆ ASTLiteral() [2/3]

ASTLiteral ( integer value,
integer position,
NFHint hint = NFHint::NONE )
inline

Constructs an integer literal.

Parameters
valueThe value of the literal.
positionThe index of this AST in the expression string.
hintA hint about the format that expression string used to express the literal.

Definition at line 126 of file ast.hpp.

◆ ASTLiteral() [3/3]

ASTLiteral ( double value,
integer position,
NFHint hint = NFHint::NONE )
inline

Constructs a floating point literal.

Parameters
valueThe value of the literal.
positionThe index of this AST in the expression string.
hintOptional information about the number format that was detected while parsing.

Definition at line 139 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 126 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 63 of file ast.cpp.


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