ALib C++ Library
Library Version: 2510 R0
Documentation generated by doxygen
Loading...
Searching...
No Matches
alib::expressions::detail::ASTLiteral Struct Reference

Description:

Abstract syntax tree node representing identifiers.

Definition at line 52 of file ast_impl.inl.

Inheritance diagram for alib::expressions::detail::ASTLiteral:
[legend]
Collaboration diagram for alib::expressions::detail::ASTLiteral:
[legend]

Public Type Index:

enum class  NFHint {
  NONE , Scientific , Hexadecimal , Octal ,
  Binary
}
 
- Public Type Index: inherited from alib::expressions::detail::ASTBase
enum class  Types {
  Literal , Identifier , Function , UnaryOp ,
  BinaryOp , TernaryOp
}
 The type of node. More...
 

Public Field Index:

NFHint Format
 Format hints.
 
Box Value
 The value of the literal.
 
- Public Field Index: inherited from alib::expressions::detail::AST
integer Position
 Position in the original expression string.
 
- Public Field Index: inherited from alib::expressions::detail::ASTBase
Types NodeType
 Type of derived this AST node.
 

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 alib::expressions::detail::AST
 AST ()=delete
 Deleted default constructor.
 
 AST (Types type, integer position)
 
virtual ~AST ()
 Virtual destructor.
 
- Public Method Index: inherited from alib::expressions::detail::ASTBase
 ASTBase (Types type)
 

Enumeration Details:

◆ NFHint

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 57 of file ast_impl.inl.

Field Details:

◆ Format

NFHint alib::expressions::detail::ASTLiteral::Format

Format hints.

Definition at line 67 of file ast_impl.inl.

◆ Value

Box alib::expressions::detail::ASTLiteral::Value

The value of the literal.

Definition at line 66 of file ast_impl.inl.

Constructor(s) / Destructor Details:

◆ ASTLiteral() [1/3]

alib::expressions::detail::ASTLiteral::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 72 of file ast_impl.inl.

Here is the call graph for this function:

◆ ASTLiteral() [2/3]

alib::expressions::detail::ASTLiteral::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 83 of file ast_impl.inl.

Here is the call graph for this function:

◆ ASTLiteral() [3/3]

alib::expressions::detail::ASTLiteral::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 94 of file ast_impl.inl.

Here is the call graph for this function:

Method Details:

◆ Assemble()

void alib::expressions::detail::ASTLiteral::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 alib::expressions::detail::AST.

Definition at line 123 of file ast.cpp.

Here is the call graph for this function:

◆ Optimize()

AST * alib::expressions::detail::ASTLiteral::Optimize ( Normalization normalization)
overridevirtual

Implements abstract method.

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

Implements alib::expressions::detail::AST.

Definition at line 60 of file ast.cpp.

Here is the call graph for this function:

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