ALib C++ Library
Library Version: 2510 R0
Documentation generated by doxygen
Loading...
Searching...
No Matches
ast.cpp
1// #################################################################################################
2// ALib C++ Library
3//
4// Copyright 2013-2025 A-Worx GmbH, Germany
5// Published under 'Boost Software License' (a free software license, see LICENSE.txt)
6// #################################################################################################
7#include "alib_precompile.hpp"
8#if !defined(ALIB_C20_MODULES) || ((ALIB_C20_MODULES != 0) && (ALIB_C20_MODULES != 1))
9# error "Symbol ALIB_C20_MODULES has to be given to the compiler as either 0 or 1"
10#endif
11#if ALIB_C20_MODULES
12 module;
13#endif
14// ====================================== Global Fragment ======================================
17
18// =========================================== Module ==========================================
19#if ALIB_C20_MODULES
22 import ALib.Strings;
23#else
25#endif
26// ====================================== Implementation =======================================
27namespace alib { namespace expressions { namespace detail {
28
29
30
31// #################################################################################################
32// Anonymous helpers
33// #################################################################################################
34//! @cond NO_DOX
35namespace {
36
37const String normSpace(A_CHAR(" "));
38const String normBracketOpen [4] {A_CHAR("("), A_CHAR("( "), A_CHAR(" ("), A_CHAR(" ( ")};
39const String normBracketClose[4] {A_CHAR(")"), A_CHAR(" )"), A_CHAR(") "), A_CHAR(" ) ")};
40
41#define SPACE(flag) ( HasBits(format, Normalization::flag ) ? normSpace : EMPTY_STRING )
42#define COND_SPACE(flag, force) if( HasBits(format, Normalization::flag ) || force ) normalized << ' '
43
44void checkForbiddenStrings( Compiler& compiler, AString& normalized, integer positionToCheck, integer spaceInsertionPos )
45{
46 for( auto& it : compiler.CfgNormalizationDisallowed )
47 if( it.Length() > spaceInsertionPos
48 && normalized.ContainsAt( it, positionToCheck ) )
49 {
50 normalized.InsertAt( A_CHAR(" "), positionToCheck + spaceInsertionPos );
51 return;
52 }
53}
54} // anonymous namespace
55//! @endcond
56
57// #################################################################################################
58// Optimize implementations
59// #################################################################################################
60AST* ASTLiteral ::Optimize( Normalization ) { return this; }
62AST* ASTFunction ::Optimize( Normalization normalization )
63{
64 for( auto& arg : Arguments )
65 arg= arg->Optimize( normalization );
66 return this;
67}
68
70{
71 Lhs= Lhs->Optimize( normalization );
72 Rhs= Rhs->Optimize( normalization );
73 return this;
74}
75
77{
78 Q= Q->Optimize( normalization );
79 T= T->Optimize( normalization );
80 F= F->Optimize( normalization );
81 return this;
82}
83
84
85
87{
88 Argument= Argument->Optimize( normalization );
89
90 if( HasBits( normalization, Normalization::RemoveRedundantUnaryOpsOnNumberLiterals ) )
91 {
92 if( Argument->NodeType == Types::Literal && (Operator == A_CHAR("+") || Operator == A_CHAR("-")) )
93 {
94 ASTLiteral* astLiteral= dynamic_cast<ASTLiteral*>( Argument );
95
96 if( astLiteral->Value.IsType<integer>() )
97 {
98 if( Operator.CharAtStart<NC>() == '-' )
99 astLiteral->Value= - astLiteral->Value.Unbox<integer>();
100 Argument= nullptr;
101 return astLiteral;
102 }
103
104 if( astLiteral->Value.IsType<double>() )
105 {
106 if( Operator.CharAtStart<NC>() == '-' )
107 astLiteral->Value= - astLiteral->Value.Unbox<double>();
108 Argument= nullptr;
109 return astLiteral;
110 }
111 }
112 }
113
114 return this;
115}
116
117
118
119// #################################################################################################
120// Assemble implementations
121// #################################################################################################
122
123void ASTLiteral::Assemble( Program& program, MonoAllocator&, AString & normalized )
124{
125 integer idxInNormalized= normalized.Length();
126
127 auto* func= Value.GetFunction<FToLiteral>( lang::Reach::Local );
128 if( func )
129 {
130 Value.CallDirect <FToLiteral>( func, normalized );
131 }
132 else if( Value.IsType<String>() )
133 {
134 normalized << '"';
135 integer startExternalization= normalized.Length();
136 normalized << Value;
137 normalized << Escape( lang::Switch::On, startExternalization );
138 normalized << '"';
139 }
140 else if( Value.IsType<double>() )
141 {
143 auto oldFlags= nf->Flags;
146 nf->Flags+= NumberFormatFlags::ForceScientific;
147
148 normalized << alib::Dec( Value.Unbox<double>(), &program.compiler.CfgFormatter->DefaultNumberFormat);
149 nf->Flags= oldFlags;
150 }
151 else if( Value.IsType<integer>() )
152 {
156 else if( HasBits(program.compiler.CfgNormalization, Normalization::ForceOctal ) )
158 else if( HasBits(program.compiler.CfgNormalization, Normalization::ForceBinary ) )
160
162 integer value= Value.Unbox<integer>();
163 if( format == NFHint::Hexadecimal ) normalized << nf->HexLiteralPrefix << Hex(uint64_t(value), 0, nf );
164 else if( format == NFHint::Octal ) normalized << nf->OctLiteralPrefix << Oct(uint64_t(value), 0, nf );
165 else if( format == NFHint::Binary ) normalized << nf->BinLiteralPrefix << Bin(uint64_t(value), 0, nf );
166 else normalized << Dec(value, 0, nf);
167 }
168 else
169 normalized << Value;
170
171 program.AssembleConstant( Value, Position, idxInNormalized );
172}
173
174void ASTIdentifier::Assemble( Program& program, MonoAllocator&, AString & normalized )
175{
176 auto format= program.compiler.CfgNormalization;
177
178 String64 identifier;
180 identifier << Name;
181
182 program.AssembleFunction( identifier, true, 0, Position, normalized.Length() );
183
184 normalized << (HasBits( format, Normalization::ReplaceFunctionNames ) ? identifier : Name);
185}
186
187
188void ASTFunction::Assemble( Program& program, MonoAllocator& allocator, AString& normalized )
189{
190 auto format= program.compiler.CfgNormalization;
191 String64 functionName;
193
194 bool completeIdentifierNames= HasBits( format, Normalization::ReplaceFunctionNames );
195 functionName << Name;
196
197 integer namePos= normalized.Length();
198 normalized << functionName;
199 integer nameLen= normalized.Length() - namePos;
200 normalized << SPACE(FunctionSpaceBeforeOpeningBracket);
201
202 int qtyArgs= int(Arguments.size());
203
204 // the function used for nested expressions?
205 bool replacedNestedExpressionIdentifierByLiteral= false;
206 bool thirdArgumentIsThrowIdentifier= false;
208 {
209 if( qtyArgs < 1 || qtyArgs > 3 )
210 {
213 }
214
215 // if an identifier is given for the first argument, we optionally convert the identifier
216 // to a string value.
218 && (*Arguments.begin())->NodeType == Types::Identifier )
219 {
220 ASTIdentifier* astIdentifier= dynamic_cast<ASTIdentifier*>( *Arguments.begin() );
221 ASTLiteral* astLiteral = allocator().New<ASTLiteral>( astIdentifier->Name, astIdentifier->Position );
222 *Arguments.begin()= astLiteral;
223 replacedNestedExpressionIdentifierByLiteral= true;
224 }
225
226 // if third parameter given it must be an identifier and equal to "throw"
227 if( qtyArgs == 3 )
228 {
229 auto argIt= Arguments.begin();
230 ++argIt;
231 ++argIt;
232 if( (*argIt)->NodeType != Types::Identifier
233 || !dynamic_cast<ASTIdentifier*>( (*argIt) )->Name.Equals<NC, lang::Case::Ignore>(
235 {
238 }
239 thirdArgumentIsThrowIdentifier= true;
240 }
241 }
242
243
244 if( qtyArgs > 0 )
245 {
246 normalized << '(' << SPACE(FunctionInnerBracketSpace);
247 int no= -1;
248 for( auto* argAst : Arguments )
249 {
250 ++no;
251 if( no==0 )
252 {
253 // optionally remove quotes if we previously converted an identifier to string-type
254 if( replacedNestedExpressionIdentifierByLiteral
256 {
257 {
258 ALIB_STRING_RESETTER(normalized);
259 argAst->Assemble( program, allocator, normalized );
260 }
261 normalized << dynamic_cast<ASTLiteral*>(argAst)->Value.Unbox<String>();
262 continue;
263 }
264 }
265 else
266 normalized << SPACE(FunctionSpaceBeforeComma) << ',' << SPACE(FunctionSpaceAfterComma);
267
268 if( no != 2 || !thirdArgumentIsThrowIdentifier )
269 argAst->Assemble( program, allocator, normalized );
270 else
271 normalized << program.compiler.CfgNestedExpressionThrowIdentifier;
272 }
273 normalized << SPACE(FunctionInnerBracketSpace) << ')';
274 }
275 else
277 ? A_CHAR("()") : A_CHAR("( )") );
278
279
280 program.AssembleFunction( functionName, false, qtyArgs, Position, namePos );
281 if( completeIdentifierNames )
282 normalized.ReplaceSubstring<NC>( functionName, namePos, nameLen );
283}
284
285
286void ASTUnaryOp::Assemble( Program& program, MonoAllocator& allocator, AString & normalized )
287{
288 auto format= program.compiler.CfgNormalization;
289 String op= Operator;
290
291 bool isVerbalOp= isalpha(op.CharAtStart());
292
293
294 // if a) this is the unary operator used for nested expressions
295 // and b) an identifier terminal follows, we optionally convert the identifier to a string
296 // value.
297 bool replacedNestedExpressionIdentifierByLiteral= false;
299 {
300 String nonVerbalOp;
301 if( !isVerbalOp )
302 nonVerbalOp= op;
303 else
304 {
305 auto it= program.compiler.AlphabeticUnaryOperatorAliases.Find(op);
306 if( it != program.compiler.AlphabeticUnaryOperatorAliases.end() )
307 nonVerbalOp= it.Mapped();
308 else
309 nonVerbalOp= EMPTY_STRING;
310 }
311
312 if( program.compiler.CfgNestedExpressionOperator == nonVerbalOp
313 && Argument->NodeType == Types::Identifier )
314 {
315 ASTIdentifier* astIdentifier= dynamic_cast<ASTIdentifier*>( Argument );
316 ASTLiteral* astLiteral = allocator().New<ASTLiteral>(astIdentifier->Name, astIdentifier->Position );
317 Argument= astLiteral;
318 replacedNestedExpressionIdentifierByLiteral= true;
319 }
320 }
321
322 //--------- normal unary operators -------
323 auto opIdx= normalized.Length();
324 normalized << op;
325 auto opLen= normalized.Length() - opIdx;
326
327 // args in brackets if its a binary or ternary expression (-> if it has lower precedence)
328 bool brackets= HasBits(format, Normalization::RedundantUnaryOpBrackets)
329 || ( Argument->NodeType == Types::UnaryOp
331 || Argument->NodeType == Types::BinaryOp
332 || Argument->NodeType == Types::TernaryOp;
333
334 bool opSpaceIfNotVerbal= !brackets
336 : HasBits(format, Normalization::UnaryOpSpace ) );
337 normalized << ( brackets
338 ? normBracketOpen[ HasBits(format, Normalization::UnaryOpInnerBracketSpace )
340 : String( (opSpaceIfNotVerbal || isVerbalOp ) ? A_CHAR(" ") : A_CHAR("") )
341 );
342
343 // recursion
344 integer lenBeforeArgument= normalized.Length();
345 Argument->Assemble( program, allocator, normalized );
346
347 // optionally remove quotes if we previously converted an identifier to string-type
348 if( replacedNestedExpressionIdentifierByLiteral
350 {
351 normalized.ShortenTo( lenBeforeArgument );
352 normalized << dynamic_cast<ASTLiteral*>( Argument )->Value.Unbox<String>();
353 }
354
355 if( brackets )
356 normalized << normBracketClose[HasBits(format, Normalization::UnaryOpInnerBracketSpace )];
357
358 // check plugins
359 program.AssembleUnaryOp( op, Position, opIdx );
360
361 // did the compiler plug-in replace the operator (was given an alias operator)?
362 if( op != Operator || isVerbalOp )
363 {
364 if( isVerbalOp )
365 {
366 // replace in any case: class program would have changed the op only if the corresponding
367 // flags had been set:
368 normalized.ReplaceSubstring<NC>( op, opIdx, opLen );
369 opLen= op.Length();
370
371 // we have to check only two of four format flags here, the rest was is (was) done in program
375 for( integer i= opIdx ; i < opIdx + opLen ; ++i )
377 ? characters::ToLower( normalized[i] )
378 : characters::ToUpper( normalized[i] );
379
380 // remove space that was inserted for non-verbal op, if op is now symbolic
381 if( !opSpaceIfNotVerbal && !isalpha(op.CharAtStart() ) )
382 normalized.Delete( opIdx + opLen, 1 );
383
384 }
385
386 else if( HasBits(format, Normalization::ReplaceAliasOperators ) )
387 {
388 normalized.ReplaceSubstring<NC>( op, opIdx, opLen );
389 opLen= op.Length();
390 }
391 }
392
393
394 // check if a forbidden string occurred due to writing operator with no spaces/brackets and
395 // the subsequent writing of probably nested unary operators, negative literals, etc.
396 checkForbiddenStrings( program.compiler, normalized, opIdx, opLen );
397}
398
399
400void ASTBinaryOp::Assemble( Program& program, MonoAllocator& allocator, AString & normalized )
401{
402 auto format= program.compiler.CfgNormalization;
403 String op= Operator;
404
405 //----------- Special treatment for subscript operator (needs different normalization) ---------
406 if( op == A_CHAR("[]") )
407 {
408 // LHS recursion
409 Lhs->Assemble( program, allocator, normalized );
410
411 COND_SPACE(SubscriptSpaceBeforeBrackets, false);
412 normalized << '[';
413
414
415 // RHS recursion
416 COND_SPACE(SubscriptInnerBracketSpace, false );
417 auto opIdx= normalized.Length();
418 Rhs->Assemble( program, allocator, normalized );
419 COND_SPACE(SubscriptInnerBracketSpace, false );
420 normalized << ']';
421
422 // check plugins
423 program.AssembleBinaryOp( op, Position, opIdx );
424
425 return;
426 }
427
428 // Add brackets for LHS, if one of the two is true for it:
429 // - it is a ternary op (always has lower precedence)
430 // - it is a binary op with lower precedence
431 // In the case that operators precedences are equal, we do not need brackets, as the
432 // left-hand side is parsed first.
433 int precedence= program.compiler.GetBinaryOperatorPrecedence( Operator );
434 int lhsBinaryPrecedence= Lhs->NodeType == Types::BinaryOp
435 ? program.compiler.GetBinaryOperatorPrecedence(dynamic_cast<ASTBinaryOp*>( Lhs )->Operator)
436 : 0;
437 int rhsBinaryPrecedence= Rhs->NodeType == Types::BinaryOp
438 ? program.compiler.GetBinaryOperatorPrecedence(dynamic_cast<ASTBinaryOp*>( Rhs )->Operator)
439 : 0;
440
441
442 bool lhsBrackets= Lhs->NodeType == Types::TernaryOp
443 || ( lhsBinaryPrecedence
445 || precedence > lhsBinaryPrecedence
447 && rhsBinaryPrecedence )
448 )
449 );
450
451 int bracketStringIdx= (HasBits(format, Normalization::InnerBracketSpace ) +
453
454 // LHS recursion
455 if( lhsBrackets ) normalized << normBracketOpen[bracketStringIdx];
456 Lhs->Assemble( program, allocator, normalized );
457 if( lhsBrackets ) normalized << normBracketClose[bracketStringIdx];
458
459 bool isVerbalOp= isalpha(op.CharAtStart());
460
461 COND_SPACE( BinaryOpSpaces, isVerbalOp );
462 auto opIdx= normalized.Length();
463 normalized << op;
464 auto opLen= normalized.Length() - opIdx;
465 COND_SPACE( BinaryOpSpaces, isVerbalOp );
466
467 // Add brackets for RHS, if one of the two is true for it:
468 // - it is a ternary op (always has lower precedence)
469 // - it is a binary op with lower or equal precedence
470 // In fact, there are more situations where brackets can be removed, for example in:
471 // 1 + (2 + 3)
472 // but this is kept. The reason, why we don't remove, if operators are equal is:
473 // 1 - (2 - 3)
474 // Here, we must not remove the brackets. This generally means, we do not have enough
475 // information about the algebraic rules of our operators to remove the brackets in all
476 // cases!
477
478 bool rhsBrackets= Rhs->NodeType == Types::TernaryOp
479 || ( rhsBinaryPrecedence
481 || ( precedence >= rhsBinaryPrecedence )
483 && precedence < rhsBinaryPrecedence )
485 && lhsBinaryPrecedence )
486 )
487 );
488
489
490 // RHS recursion
491 if( rhsBrackets ) normalized << normBracketOpen[bracketStringIdx];
492 Rhs->Assemble( program, allocator, normalized );
493 if( rhsBrackets ) normalized << normBracketClose[bracketStringIdx];
494
495 // check plugins
496 program.AssembleBinaryOp( op, Position, opIdx );
497
498 // did the compiler plug-in replace the operator (was given an alias operator)?
499 if( op != Operator || isVerbalOp )
500 {
501 if( isVerbalOp )
502 {
503 // replace in any case: class program would have changed the op only if the corresponding
504 // flags had been set:
505 normalized.ReplaceSubstring<NC>( op, opIdx, opLen );
506 opLen= op.Length();
507
508 // we have to check only two of four format flags here, the rest was is (was) done in program
512 for( integer i= opIdx ; i < opIdx + opLen ; ++i )
514 ? characters::ToLower( normalized[i] )
515 : characters::ToUpper( normalized[i] );
516
517 // remove operator spaces if they were inserted for non-verbal op, if op is now symbolic
518 if( !HasBits(format, Normalization::BinaryOpSpaces) && !isalpha(op.CharAtStart() ) )
519 {
520 normalized.Delete( opIdx + opLen, 1 );
521 normalized.Delete( opIdx - 1 , 1 );
522 }
523
524 }
525
526 else if( HasBits(format, Normalization::ReplaceAliasOperators ) )
527 {
528 normalized.ReplaceSubstring<NC>( op, opIdx, opLen );
529 opLen= op.Length();
530 }
531 }
532
533 // check if a forbidden string occurred due to writing operator with no spaces/brackets and
534 // the subsequent writing of probably nested unary operators, negative literals, etc.
535 checkForbiddenStrings( program.compiler, normalized, opIdx, opLen );
536}
537
538
539void ASTConditional::Assemble( Program& program, MonoAllocator& allocator, AString & normalized )
540{
541 auto format= program.compiler.CfgNormalization;
542
543 int bracketStringIdx= (HasBits(format, Normalization::InnerBracketSpace ) +
545
546
547 // Q
548 Q->Assemble( program, allocator, normalized );
549 normalized << SPACE(ConditionalOpSpaceBeforeQM);
550 program.AssembleCondFinalize_Q( Position, normalized.Length() );
551 normalized << A_CHAR("?") << SPACE(ConditionalOpSpaceAfterQM);
552
553 // T
554 integer idxInNormalized= normalized.Length();
555
556 bool brackets= T->NodeType == Types::TernaryOp
558
559 if( brackets ) normalized << normBracketOpen[bracketStringIdx];
560 T->Assemble( program, allocator, normalized );
561 if( brackets ) normalized << normBracketClose[bracketStringIdx];
562
563 // :
564 normalized << SPACE(ConditionalOpSpaceBeforeColon);
565
566 program.AssembleCondFinalize_T( ColonPosition, normalized.Length() );
567
568 normalized << ":" << SPACE(ConditionalOpSpaceAfterColon);
569
570
571 // F
572 brackets= F->NodeType == Types::TernaryOp
574
575 if( brackets ) normalized << normBracketOpen[bracketStringIdx];
576 F->Assemble( program, allocator, normalized );
577 if( brackets ) normalized << normBracketClose[bracketStringIdx];
578
579 program.AssembleCondFinalize_F( Position, idxInNormalized );
580}
581
582}}} // namespace [alib::expressions::detail]
bool IsType() const
TValue Unbox() const
Definition box.inl:635
Normalization CfgNormalization
Definition compiler.inl:265
Compilation CfgCompilation
Compilation flags.
Definition compiler.inl:261
strings::util::Token CfgNestedExpressionFunction
Definition compiler.inl:252
HashMap< MonoAllocator, String, String, alib::hash_string_ignore_case< character >, alib::equal_to_string_ignore_case< character > > AlphabeticUnaryOperatorAliases
Definition compiler.inl:119
int GetBinaryOperatorPrecedence(const String &symbol)
Definition compiler.inl:178
ALIB_DLL void AssembleUnaryOp(String &op, integer idxInOriginal, integer idxInNormalized)
Definition program.cpp:441
ALIB_DLL void AssembleFunction(AString &functionName, bool isIdentifier, int qtyArgs, integer idxInOriginal, integer idxInNormalized)
Definition program.cpp:249
ALIB_DLL void AssembleBinaryOp(String &op, integer idxInOriginal, integer idxInNormalized)
Definition program.cpp:625
ALIB_DLL void AssembleCondFinalize_Q(integer idxInOriginal, integer idxInNormalized)
Definition program.cpp:832
ALIB_DLL void AssembleConstant(Box &value, integer idxInOriginal, integer idxInNormalized)
Definition program.cpp:234
Compiler & compiler
The compiler that created this object.
Definition program.inl:30
ALIB_DLL void AssembleCondFinalize_F(integer idxInOriginal, integer idxInNormalized)
Definition program.cpp:885
ALIB_DLL void AssembleCondFinalize_T(integer idxInOriginal, integer idxInNormalized)
Definition program.cpp:863
NumberFormat DefaultNumberFormat
Definition formatter.inl:96
TAString & Delete(integer regionStart, integer regionLength=MAX_LEN)
TAString & ReplaceSubstring(const TString< TChar > &src, integer regionStart, integer regionLength)
TAString & ShortenTo(integer newLength)
Definition tastring.inl:816
void DbgDisableBufferReplacementWarning()
Definition tastring.inl:245
constexpr integer Length() const
Definition string.inl:318
TChar CharAtStart() const
Definition string.inl:440
bool Equals(const TString< TChar > &rhs) const
Definition string.inl:541
ALIB_DLL bool Match(const String &needle)
Definition token.cpp:316
#define ALIB_CALLER_NULLED
Definition alib.inl:1010
#define A_CHAR(STR)
#define ALIB_STRING_RESETTER(astring)
TChar ToUpper(TChar c)
TChar ToLower(TChar c)
@ ReplaceVerbalOperatorsToLowerCase
See sibling flag ReplaceVerbalOperatorsToSymbolic.
@ NONE
All flags are cleared, may be used for testing bits.
@ ReplaceVerbalOperatorsToUpperCase
See sibling flag ReplaceVerbalOperatorsToSymbolic.
@ Local
Denotes local reach.
@ On
Switch it on, switched on, etc.
strings::TEscape< character > Escape
Type alias in namespace alib.
Definition format.inl:536
strings::TDec< character > Dec
Type alias in namespace alib.
Definition format.inl:545
strings::TAString< character, lang::HeapAllocator > AString
Type alias in namespace alib.
LocalString< 64 > String64
Type alias name for TLocalString<character,64>.
constexpr const String EMPTY_STRING
An empty string of the default character type.
Definition string.inl:2443
lang::integer integer
Type alias in namespace alib.
Definition integers.inl:149
strings::TNumberFormat< character > NumberFormat
Type alias in namespace alib.
strings::TOct< character > Oct
Type alias in namespace alib.
Definition format.inl:563
monomem::TMonoAllocator< lang::HeapAllocator > MonoAllocator
strings::THex< character > Hex
Type alias in namespace alib.
Definition format.inl:554
exceptions::Exception Exception
Type alias in namespace alib.
strings::TString< character > String
Type alias in namespace alib.
Definition string.inl:2381
expressions::Compiler Compiler
Type alias in namespace alib.
Definition compiler.inl:574
strings::TBin< character > Bin
Type alias in namespace alib.
Definition format.inl:572
virtual void Assemble(Program &program, MonoAllocator &allocator, AString &normalized) override
Definition ast.cpp:400
virtual AST * Optimize(Normalization normalization) override
Definition ast.cpp:69
ASTBinaryOp(const String &op, AST *lhs, AST *rhs, integer position)
Definition ast_impl.inl:221
AST * Lhs
The left-hand-side expression node.
Definition ast_impl.inl:213
String Operator
The operator symbol.
Definition ast_impl.inl:212
virtual void Assemble(Program &program, MonoAllocator &allocator, AString &normalized) override
Definition ast.cpp:539
integer ColonPosition
The index of the colon in the expression string.
Definition ast_impl.inl:248
virtual AST * Optimize(Normalization normalization) override
Definition ast.cpp:76
List< MonoAllocator, AST * > Arguments
The argument nodes.
Definition ast_impl.inl:146
String Name
The function name as parsed.
Definition ast_impl.inl:145
virtual void Assemble(Program &program, MonoAllocator &allocator, AString &normalized) override
Definition ast.cpp:188
Abstract syntax tree node representing identifiers.
Definition ast_impl.inl:117
String Name
The name of the identifier as parsed from the expression string.
Definition ast_impl.inl:118
virtual AST * Optimize(Normalization normalization) override
Definition ast.cpp:61
virtual void Assemble(Program &program, MonoAllocator &allocator, AString &normalized) override
Definition ast.cpp:174
Abstract syntax tree node representing identifiers.
Definition ast_impl.inl:53
@ Scientific
Float was given in scientific format.
Definition ast_impl.inl:60
@ Hexadecimal
Integral value was given in hexadecimal format.
Definition ast_impl.inl:61
@ Binary
Integral value was given in binary format.
Definition ast_impl.inl:63
@ Octal
Integral value was given in octal format.
Definition ast_impl.inl:62
Box Value
The value of the literal.
Definition ast_impl.inl:66
virtual void Assemble(Program &program, MonoAllocator &allocator, AString &normalized) override
Definition ast.cpp:123
virtual AST * Optimize(Normalization normalization) override
Definition ast.cpp:86
AST * Argument
The argument node.
Definition ast_impl.inl:181
String Operator
The operator symbol.
Definition ast_impl.inl:180
virtual void Assemble(Program &program, MonoAllocator &allocator, AString &normalized) override
Definition ast.cpp:286
integer Position
Position in the original expression string.
Definition ast_impl.inl:18
AST()=delete
Deleted default constructor.
TCString< TChar > BinLiteralPrefix
NumberFormatFlags Flags
The flag field.
TCString< TChar > HexLiteralPrefix
TCString< TChar > OctLiteralPrefix