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