ALib C++ Framework
by
Library Version: 2511 R0
Documentation generated by doxygen
Loading...
Searching...
No Matches
expressionscamp.inl
Go to the documentation of this file.
1//==================================================================================================
2/// \file
3/// This header-file is part of module \alib_expressions of the \aliblong.
4///
5/// \emoji :copyright: 2013-2025 A-Worx GmbH, Germany.
6/// Published under #"mainpage_license".
7//==================================================================================================
8ALIB_EXPORT namespace alib { namespace expressions {
9struct Scope;
10
11//==================================================================================================
12/// Exceptions thrown by module \alib_expressions_nl.
13///
14/// \note
15/// This enum type is associated with #"alib_enums_records;ALib Enum Records" according to
16/// the specification documented with class #"exc Exception".
17//==================================================================================================
18enum class Exceptions
19{
20 /// General error thrown by the parser.
22
23 /// Detail entry (negative element value) used with various exceptions. Shows the expression
24 /// in a first line and a marker of the syntax error position in a second.
26
27 /// This is added to exceptions when a \c std::exception is wrapped.
28 /// The 'what()' string is included as entry parameter.
29 /// (This is a detail entry with negative element value).
31
32 /// Thrown when an empty string is tried to be compiled.
34
35 /// Syntax error with concrete information about what the parser expected at given position.
37
38 /// Unknown unary operator symbol found when parsing expression string.
40
41 /// Unknown binary operator symbol found when parsing expression string.
43
44 /// Compile-time exception thrown when an expression uses an unknown identifier name.
46
47 /// Compile-time exception thrown when an expression uses an unknown function name.
49
50 /// Optional info entry (negative element value) on a function with matching name but
51 /// non-matching arguments found.
53
54 /// Compile-time exception thrown when an unary operator is not applicable to the given
55 /// argument type.
57
58 /// Compile-time exception thrown when a binary operator is not applicable to the combination of
59 /// left-hand and right-and argument type.
61
62 /// Compile-time exception thrown when function parentheses are missing with parameterless
63 /// functions, while flag
64 /// #"Compilation::AllowOmittingParenthesesOfParameterlessFunctions" is not set
65 /// in #"Compiler::CfgCompilation;*".
67
68 /// Compile-time exception thrown when empty function parentheses are given with identifiers
69 /// (parameterless functions), while flag
70 /// #"Compilation::AllowEmptyParenthesesForIdentifierFunctions" is not set
71 /// in #"Compiler::CfgCompilation;*".
73
74 /// Compile-time exception thrown when incompatible types are given with conditional
75 /// term <c>Q ? T : F</c>. Note that before throwing this exception, the compiler tries to
76 /// insert auto-cast callback functions, and if found, performs one second try to compile
77 /// the operator for the new pair of operatnd types.
79
80
81 /// This is a "wrapper" exception thrown when a plug-in or a compile-time invoked callback
82 /// function throws an exception of type \c std::exception or of type
83 /// #"exc Exception" with a code that is not of this enumeration type.<br>
84 /// Used only if compilation #"Compilation::PluginExceptionFallThrough;*"
85 /// is not set.
87
88 /// This is a "wrapper" exception thrown when callback functions throws an exception of type
89 /// \c std::exception or of type #"exc Exception".
90 /// Used only if compilation #"Compilation::CallbackExceptionFallThrough;*"
91 /// is not set.
93
94 //####################################### Nested expressions #####################################
95
96 /// Compile-time exception thrown when unary expression operator is used with a non-constant
97 /// nested expression name.
99
100 /// Compile-time exception thrown when an expression refers to an unknown named nested expression.
102
103 /// Compile-time exception thrown when a named nested expression which is searched an inserted
104 /// at compile-time could not be found.<br>
105 /// Overwrites exception \b %NamedExpressionNotFound.
106 ///
107 /// \see Manual chapter #"alib_expressions_nested".
109
110 /// Compile-time exception thrown when wrong arguments were passed to function
111 /// #"Compiler::CfgNestedExpressionFunction;*".
112 ///
113 /// \see Manual chapter #"alib_expressions_nested".
115
116 /// Evaluation-time exception thrown when a named nested expression which is searched only at
117 /// evaluation-time could not be found.<br>
118 /// Overwrites exception \b %NamedExpressionNotFound.
119 /// \see Manual chapter #"alib_expressions_nested".
121
122 /// Informational exception entry (negative element value) providing the name of the expression
123 /// that caused any other exception than \c NamedExpressionNotFound during evaluation of a
124 /// nested expression.
125 ///
126 /// Note that entries of this type might be repeated when expressions are recursively nested.
127 /// The number of entries in the exception corresponds to the depth of nesting.
129
130 /// Evaluation-time exception thrown when a named nested expression which was searched and found
131 /// only at evaluation-time, returned a different result type than specified.<br>
132 ///
133 /// \see Manual chapter #"alib_expressions_nested".
135
136 /// Evaluation-time exception thrown when a circular relationship of nested expressions
137 /// is detected, which comprises an infinite loop.
139
140 /// A list of informational entries of this type is given with exception
141 /// \b %CircularNestedExpressions. Each entry provides the name of the expression that
142 /// was evaluated and the name of the nested expression that it called. Hence, the list of
143 /// entries of this type comprise the "call stack" that leaded to the circular call that
144 /// caused the exception.
146
147
148 /// This is an extension entry added to exceptions that occur with compilation or evaluation
149 /// of expressions by class #"util::ExpressionFormatter;*".
151};
152
153//==================================================================================================
154/// #"ArithmeticalTraits;Arithmetical enumeration" of slots used to prioritize
155/// #"CompilerPlugin" instances attached to instances of class
156/// #"Compiler" at run-time.
157//==================================================================================================
159{
160 /// Used to denote that no variable or plug-in was found.
161 NONE = 0,
162
163 /// Built-in operator <c>?:</c> (like conditional, but no 'true'-expression).
164 /// \see #"plugins::ElvisOperator;*"
166
167 /// Auto-cast plug-in.
168 AutoCast = 200,
169
170 /// Built-in String comparison and manipulation.
171 Strings = 300,
172
173
174 /// Collection of built-in unary and binary operators for boolean, integer and floating point values.
176
177 /// Collection of built-in unary and binary operators for boolean, integer and floating point values.
178 Math = 500,
179
180 /// Collection of date and time functions based on #"alib::time".
182
183 /// This is where custom plug-ins usually should be placed. It gives them a higher priority
184 /// than all built-in plug-ins have.<br>
185 /// If more than one plug-in should be installed, add 1, 2, ... to the enum element.
186 Custom = 1000,
187};
188
189//==================================================================================================
190/// This struct holds static #"alib_expressions_prereq_sb;sample values" for
191/// the built-in supported types of module \alib_expressions_nl.
192///
193/// These boxes are mainly used by built-in compiler plug-ins to denote the corresponding type.
194/// Customized plug-ins are proposed to use these boxes to denote internal types as well and
195/// besides that to define static sample boxes for each custom type that they introduce in a
196/// similar fashion.
197///
198/// \note
199/// Of course, just sample any value might be passed where a type is expected, but using these
200/// pre-defined objects is more efficient in respect to code size. In respect to execution
201/// performance, the sample values are rather irrelevant, as those are used almost exclusively
202/// at expression compile-time.
203//==================================================================================================
204struct Types
205{
206 /// Sample <em>type-box</em> for C++ type <c>void</c>.
208
209 /// Sample <em>type-box</em> for C++ type <c>bool</c>.
211
212 /// Sample <em>type-box</em> for integer types. (Precisely for type #"lang::integer".)
214
215 /// Sample <em>type-box</em> for C++ type <c>double</c>.
217
218 /// Sample <em>type-box</em> for string types. While internally, \alib class
219 /// #"TString;String" is used, due to the magic of module \alib_boxing, almost
220 /// any custom string type is compatible, including of course \c std::string.
222
223 /// Sample <em>type-box</em> for date and time values of type #"time::DateTime").
225
226 /// Sample <em>type-box</em> for values of type #"^DateTime::Duration" (which
227 /// class \b DateTime inherits from its base).
229};
230
231//==================================================================================================
232/// This struct holds static arrays of pointers to #"alib_expressions_prereq_sb;sample values".
233/// The arrays are used with helper-class #"plugins::Calculus" to denote accepted
234/// "function signatures" when* initializing column
235/// #"FunctionEntry::Signature"
236/// of table #"Calculus::Functions".
237///
238/// Each static field of this class represents a permutation of function arguments. Note, that only
239/// those permutations which are needed and used by the built-in compiler plugins (
240/// #"plugins::Arithmetics",
241/// #"plugins::Math",
242/// #"plugins::Strings" and
243/// #"plugins::DateAndTime" ) are contained here.
244///
245/// Custom compiler plug-ins may use the argument signatures given here, if a fitting signature
246/// is already included. Otherwise a custom signature array has to be defined, initialized and
247/// provided to the function definition table.
248//==================================================================================================
250{
251 static ALIB_DLL Box* Var [1]; ///< Function accepts variadic arguments.
252 static ALIB_DLL Box* B [1]; ///< Function accepts one boolean argument.
253 static ALIB_DLL Box* BB [2]; ///< Function accepts two boolean arguments.
254 static ALIB_DLL Box* I [1]; ///< Function accepts one integral argument.
255 static ALIB_DLL Box* II [2]; ///< Function accepts two integral arguments.
256 static ALIB_DLL Box* IVar[2]; ///< Function accepts one integral argument, followed by variadic arguments.
257 static ALIB_DLL Box* F [1]; ///< Function accepts one floating point argument.
258 static ALIB_DLL Box* FF [2]; ///< Function accepts two floating point arguments.
259 static ALIB_DLL Box* S [1]; ///< Function accepts one string argument.
260 static ALIB_DLL Box* SVar[2]; ///< Function accepts one string argument, followed by variadic arguments.
261 static ALIB_DLL Box* SS [2]; ///< Function accepts two string arguments.
262 static ALIB_DLL Box* SI [2]; ///< Function accepts one string argument, followed by an integral argument.
263 static ALIB_DLL Box* SSB [3]; ///< Function accepts two string arguments, followed by a boolean argument.
264 static ALIB_DLL Box* SSI [3]; ///< Function accepts two string arguments, followed by an integral argument.
265 static ALIB_DLL Box* SII [3]; ///< Function accepts one string argument, followed by two integral arguments.
266 static ALIB_DLL Box* SSS [3]; ///< Function accepts three string arguments.
267#if ALIB_CAMP
268 static ALIB_DLL Box* D [1]; ///< Function accepts a #"time::DateTime" argument.
269 static ALIB_DLL Box* Dur [1]; ///< Function accepts a #"TimePointBase::Duration" argument.
270 static ALIB_DLL Box* DDur[2]; ///< Function accepts a #"time::DateTime" argument; followed by a #"TimePointBase::Duration".
271#endif
272};
273
274
275//==================================================================================================
276/// This enumeration lists the built-in unary operators.
277/// The associated #"alib_enums_records;ALib Enum Records" provides the operator symbols.
278//==================================================================================================
280{
281 NONE , ///< Not an operator.
282
283 Positive , ///< <c>'+'</c> operator (usually returns identity value).
284 Negative , ///< <c>'-'</c> operator, negates a value.
285
286 BoolNot , ///< Boolean not (<c>'!'</c>).
287 BitNot , ///< Bitwise not (<c>'~'</c>).
288
289 Indirection , ///< Unary <c>'*'</c> operator. Similar to the C++ indirection operator, this
290 ///< is the default operator uses with nested expressions, which is defined
291 ///< with #"Compiler::CfgNestedExpressionOperator;*".
292};
293
294//==================================================================================================
295/// This enumeration lists the built-in binary operators.
296/// The associated #"alib_enums_records;ALib Enum RecordS" of type
297/// #"ERBinaryOperator" provides an operator's symbol an its precedence.
298//==================================================================================================
300{
301 NONE , ///< Not an operator.
302 Subscript , ///< Array subscripting (<c>'[]'</c>). Precedence hardcoded with parser.
303
304 Multiply , ///< Arithmetic multiplication (<c>'*'</c>). Precedence \c 900.
305 Divide , ///< Arithmetic division (<c>'/'</c>). Precedence \c 900.
306 Modulo , ///< Arithmetic modulo (<c>'%%'</c>). Precedence \c 900.
307
308 Add , ///< Arithmetic addition (<c>'+'</c>). Precedence \c 800.
309 Subtract , ///< Arithmetic subtraction (<c>'-'</c>). Precedence \c 800.
310
311 ShiftLeft , ///< Bitwise shifting of integral values (<c>'<<'</c>). Precedence \c 700.
312 ShiftRight , ///< Bitwise shifting of integral values (<c>'>>'</c>). Precedence \c 700.
313
314 Smaller , ///< Smaller operator (<c>'<'</c>). Precedence \c 600.
315 SmallerOrEqual , ///< Smaller or equal operator (<c>'<='</c>). Precedence \c 600.
316 Greater , ///< Greater operator (<c>'>'</c>). Precedence \c 600.
317 GreaterOrEqual , ///< Greater or equal operator (<c>'>='</c>). Precedence \c 600.
318
319 Equal , ///< Equal operator (<c>'=='</c>). Precedence \c 500.
320 NotEqual , ///< Not equal operator (<c>'!='</c>). Precedence \c 500.
321
322 BitAnd , ///< Binary and (<c>'&'</c>). "and"s all bits of two integral values. Precedence \c 470.
323 BitXOr , ///< Binary xor (<c>'^'</c>). "xor"s all bits of two integral values. Precedence \c 460.
324 BitOr , ///< Binary or (<c>'|'</c>). "or"s all bits of two integral values. Precedence \c 450.
325 BoolAnd , ///< Boolean and (<c>'&&'</c>). Result is boolean. Precedence \c 440.
326 BoolOr , ///< Boolean or (<c>'||'</c>). Result is boolean. Precedence \c 430.
327
328 Assign , ///< Assignment. By default, this is used as alias operator for
329 ///< operator \b Equal by the built-in compiler plug-ins.
330 ///< See #"Compilation::AliasEqualsOperatorWithAssignOperator"
331 ///< for more information.<br>
332 ///< Precedence \c 300.
333
334
335 Elvis , ///< Binary version of ternary operator <c>Q ? T : F</c> with
336 ///< second operand (\c T) not given.
337 ///< Whitespaces are allowed between '?' and ':'.<br>
338 ///< Precedence \c 200.
339};
340
341//==================================================================================================
342/// #"alib_enums_records;ALib Enum Record" associated with enumeration
343/// #"expressions::DefaultBinaryOperators".
344//==================================================================================================
346{
347 /// The parable symbol of an operator.
349
350 /// The precedence of an operator in respect to other binary operators.
352
353 /// Required default constructor leaving the record undefined.
354 /// (Requirement is documented with "EnumRecordPrototype".)
355 ERBinaryOperator() noexcept =default;
356
357 /// Required initializing constructor.
358 /// (Requirement is documented with #"EnumRecordPrototype".)
359 ///
360 /// @param symbol The parsable operator symbol.
361 /// @param precedence The operator's precedence.
362 ERBinaryOperator( const String& symbol, int precedence )
363 : Symbol (symbol)
364 , Precedence(precedence) {}
365
366 /// Implementation of #"EnumRecordPrototype::Parse;*".
368 void Parse();
369};
370
371
372//==================================================================================================
373/// This enumeration lists the built-in verbal alias names for unary operators.
374///
375/// The associated #"alib_enums_records;ALib Enum Records" provides the operator verbs
376/// as well as the replacement operator.
377///
378/// Flag #"Compilation::DefaultAlphabeticOperatorAliases;*" controls if method
379/// #"Compiler::SetupDefaults;*" adds the aliases to the compiler.
380//==================================================================================================
382{
383 Not , ///< Verbal alias \c "Not" to operator <c>'!'</c>.
384};
385
386//==================================================================================================
387/// This enumeration lists the built-in verbal alias names for binary operators.
388///
389/// The associated #"alib_enums_records;ALib Enum Records" provides the operator verbs
390/// as well as the replacement operator.
391///
392/// Flag #"Compilation::DefaultAlphabeticOperatorAliases;*" controls if method
393/// #"Compiler::SetupDefaults;*" adds the aliases to the compiler.
394//==================================================================================================
396{
397 And , ///< Verbal alias \c "And" to boolean and operator <c>'&&'</c>.
398 Or , ///< Verbal alias \c "Or" to boolean or operator <c>'||'</c>.
399 Sm , ///< Verbal alias \c "Sm" to operator <c>'<'</c>.
400 Smaller , ///< Verbal alias \c "Smaller" to operator <c>'<'</c>.
401 SmEq , ///< Verbal alias \c "Smeq" to operator <c>'<='</c>.
402 SmallerOrEqual , ///< Verbal alias \c "Smaller_or_equal" to operator <c>'<='</c>.
403 Gt , ///< Verbal alias \c "Gt" to operator <c>'>'</c>.
404 Greater , ///< Verbal alias \c "Greater" to operator <c>'>'</c>.
405 GtEq , ///< Verbal alias \c "Gteq" to operator <c>'>='</c>.
406 GreaterOrEqual , ///< Verbal alias \c "Greater_or_equal" to operator <c>'>='</c>.
407 Eq , ///< Verbal alias \c "Eq" to operator <c>'=='</c>.
408 Equals , ///< Verbal alias \c "Equals" to operator <c>'=='</c>.
409 NEq , ///< Verbal alias \c "Neq" to operator <c>'!='</c>.
410 NotEqual , ///< Verbal alias \c "Not_equals" to operator <c>'!='</c>.
411};
412
413//==================================================================================================
414/// #"alib_enums_records;ALib Enum Record" associated with enumeration
415/// #"expressions::DefaultBinaryOperators".
416//==================================================================================================
418{
419 /// The parsable symbol of an alias operator.
421
422 /// The replacement operator symbol.
424
425 /// Required default constructor leaving the record undefined.
426 /// (Requirement is documented with #"EnumRecordPrototype".)
427 EROperatorAlias() noexcept =default;
428
429 /// Required initializing constructor.
430 /// (Requirement is documented with #"EnumRecordPrototype".)
431 ///
432 /// @param symbol The parsable operator symbol.
433 /// @param replacement The symbol of the aliased operator.
434 EROperatorAlias( const String& symbol, const String& replacement )
435 : Symbol (symbol)
436 , Replacement(replacement) {}
437
438 /// Implementation of #"EnumRecordPrototype::Parse;*".
440 void Parse();
441};
442
443
444
445//==================================================================================================
446/// #"BitwiseTraits;Bitwise" enum class defining options of expression compilation.
447/// Flags defined with this type are set in field #"Compiler::CfgCompilation;*".
448//==================================================================================================
449enum class Compilation
450{
451 /// If this flag is set, all unary operators given in #"expressions::DefaultUnaryOperators"
452 /// are defined with method #"Compiler::SetupDefaults;*".
453 ///
454 /// Note that the enumeration class is equipped with resourced
455 /// #"alib_enums_records;ALib Enum Records", which might be changed as an
456 /// alternative to clearing this flag and provide own definitions.
457 ///
458 /// This flag is set by default.
460
461 /// If this flag is set, all binary operators given in #"expressions::DefaultBinaryOperators"
462 /// are defined with method #"Compiler::SetupDefaults;*".
463 ///
464 /// Note that the enumeration class is equipped with resourced
465 /// #"alib_enums_records;ALib Enum Records", which might be changed as an
466 /// alternative to clearing this flag and provide own definitions.
467 ///
468 /// This flag is set by default.
470
471 /// If this flag is set, all alphabetic operator aliases given in enumerations
472 /// #"DefaultAlphabeticUnaryOperatorAliases" and
473 /// #"DefaultAlphabeticBinaryOperatorAliases"
474 /// are defined with method #"Compiler::SetupDefaults;*".
475 ///
476 /// Note that both enumeration classes are equipped with resourced
477 /// #"alib_enums_records;ALib Enum Records", which might be changed as an
478 /// alternative to clearing this flag and provide own definitions.
479 ///
480 /// This flag is set by default.
482
483 /// If this flag is set, alphabetic operator aliases defined in
484 /// #"Compiler::AlphabeticUnaryOperatorAliases;*" and
485 /// #"Compiler::AlphabeticBinaryOperatorAliases;*" are parsed ignoring letter
486 /// case.
487 ///
488 /// \note
489 /// Even when this flag is cleared, no two verbal operator aliases that are equal
490 /// when case is ignored must be defined (e.g "or" and "OR" ).
491 ///
492 /// This flag is set by default.
494
495 /// If not set, array subscript operator <c>[]</c> is not supported and its use will cause
496 /// parse errors errors.
497 ///
498 /// Note that compiler plug-ins get the array subscript operator presented for compilation
499 /// as a usual binary operator given as #"DefaultBinaryOperators::Subscript;*".
500 /// This makes its support with custom types quite simple.
501 ///
502 /// \attention This flag has to be changed to a custom state before performing the first
503 /// compilation of an expression with a dedicated #"Compiler".
504 /// The rationale behind this is, that the compiler creates the parser system at its
505 /// first use, which in turn does not check the flag after creation.
506 ///
507 /// This flag is set by default.
509
510 /// Used with constructor of compiler plug-ins
511 /// #"plugins::Arithmetics;*" and
512 /// #"plugins::Strings;*".
513 /// (If they are activated in #"Compiler::CfgBuiltInPlugins;*" or "manually"
514 /// added.)
515 ///
516 /// Denotes if the assignment operator <c>=</c> is an alias for equal operator <c>==</c>.
517 /// If set to \c false, the use of the <c>=</c> operator with several any argument type,
518 /// throws a compilation exception, unless it is compiled by a custom plug-in.
519 ///
520 /// \attention
521 /// In addition to aliasing the <c>==</c> with <c>=</c>, the latter also receives a
522 /// higher precedence of parsing! If this flag is not set, the precedence of
523 /// \e assign <c>=</c>,follows the C++ standards and thus is below the group of
524 /// <c>&</c>, <c>^</c>, <c>|</c>, <c>&&</c>, <c>||</c> and <c>? :</c>. If the alias
525 /// setting is activated, then the precedence is raised to be on the same level as
526 /// boolean equal <c>==</c> and thus higher than the aforementioned operators!
528
529 /// Used with constructor of compiler plug-in #"plugins::Arithmetics;*".
530 /// (If it is activated in #"Compiler::CfgBuiltInPlugins;*" or "manually" added.)
531 ///
532 /// Denotes if the unary bitwise operator <c>~</c> and binary bitwise operators
533 /// <c>&</c>, <c>|</c> and <c>^</c> should be allowed for boolean values.
534 /// If set to \c false, the use of the bitwise operators with boolean arguments, throws
535 /// a compilation exception, unless the bitwise operators are compiled by a custom plug-in.
537
538
539 /// If \c false, compile-time exception
540 /// #"Exceptions::MissingFunctionParentheses;*" is thrown if a parameterless
541 /// function is stated without (otherwise redundant) parentheses <c>'()'</c>.
542 ///
543 /// If \c true, this is tolerated.
544 ///
545 /// \note
546 /// This flag is not tested, and the exception is not thrown, by the compiler itself, but
547 /// by class #"plugins::Calculus".<br>
548 /// Even if this flag is \c false, still functions without parentheses may be allowed
549 /// by setting \c nullptr to the field #"FunctionEntry::Signature;*"
550 /// when registering a function. In this case the function is considered rather being an
551 /// "identifier" than a function. (Still it is the very same as a function, it is just a
552 /// matter of wording here.)<br>
553 ///
554 /// The other way round, if a function is registered as an identifier, flag
555 /// \b %AllowEmptyParenthesesForIdentifierFunctions, controls if exception
556 /// #"Exceptions::IdentifierWithFunctionParentheses;*" is to be thrown
557 /// if empty parentheses are given on functions that are registered as
558 /// identifier-style functions.
560
561 /// If \c false, compile-time exception
562 /// #"Exceptions::IdentifierWithFunctionParentheses;*" is thrown if a
563 /// parameterless function, declared as 'identifier style' is used with parentheses
564 /// <c>'()'</c>.
565 ///
566 /// If \c true, this is tolerated.
567 ///
568 /// \see
569 /// For more information, see the note in documentation of flag
570 /// \b %AllowOmittingParenthesesOfParameterlessFunctions.
572
573 /// If this flag is set (the default), the
574 /// #"Compiler::CfgNestedExpressionOperator;unary nested expression operator"
575 /// is activated, as well as the single-parameter overload of the
576 /// #"Compiler::CfgNestedExpressionFunction;nested expression function".
577 /// If the field is cleared, then only evaluation-time nested expressions are allowed,
578 /// which is the two- and three-parameter version of the expression function.
579 /// Other uses are then causing compilation exception
580 /// #"Exceptions::UnaryOperatorNotDefined;*", respectively
581 /// #"Exceptions::NestedExpressionCallArgumentMismatch;*".
583
584 /// If this flag is set (the default), then identifiers that follow the unary nested
585 /// expression operator (defaults to <c>'*'</c>), are internally converted to corresponding
586 /// string literals - just as if they were given as a quoted string.
587 ///
588 /// \see
589 /// Normalization flag
590 /// #"Normalization::QuoteUnaryNestedExpressionOperatorArgument".
592
593 /// If not set (the default), then names of named expressions are not distinguished by
594 /// letter case.
596
597 /// Controls whether exceptions of type \c std::exception thrown in plug-ins during compilation
598 /// are caught by the compiler and transformed to #"Exceptions::ExceptionInPlugin;*"
599 ///
600 /// Note that exceptions thrown in callback functions which are evaluated at compile-time
601 /// against constant parameters, are considered plug-in exceptions.
603
604
605 /// This is an "evaluation-time compiler flag". If not set (the default) exceptions of type
606 /// #"exc Exception" and \c std::exception thrown in callback functions during expression
607 /// evaluation are caught and transformed to #"Exceptions::ExceptionInCallback;*"
608 /// letter case.
610
611 /// If this flag is set, no optimizations are performed when assembling the program.
612 ///
613 /// \note
614 /// There is absolutely no reason for setting this flag, other than for running the
615 /// unit tests. Or for playing with the little virtual machine implemented with this
616 /// library and having fun understanding the non-optimized program listings generated.
617 /// The assembly language is easy, it has only four virtual assembly commands - plus a fifth
618 /// for invoking programs of nested expressions.
619 NoOptimization = (1 << 20),
620
621
622 /// Default value. Evaluates to:<br>
623 /// <c> DefaultUnaryOperators + </c><br>
624 /// <c> DefaultBinaryOperators + </c><br>
625 /// <c> DefaultAlphabeticOperatorAliases + </c><br>
626 /// <c> AlphabeticOperatorsIgnoreCase + </c><br>
627 /// <c> AliasEqualsOperatorWithAssignOperator + </c><br>
628 /// <c> AllowBitwiseBooleanOperators + </c><br>
629 /// <c> AllowSubscriptOperator + </c><br>
630 /// <c> AllowOmittingParenthesesOfParameterlessFunctions + </c><br>
631 /// <c> AllowEmptyParenthesesForIdentifierFunctions + </c><br>
632 /// <c> AllowCompileTimeNestedExpressions + </c><br>
633 /// <c> AllowIdentifiersForNestedExpressions + </c><br>
645};
646
647//==================================================================================================
648/// #"BitwiseTraits;Bitwise" enum class defining options for formatting parsed
649/// expressions. The normalized conversion of the expression input string is available
650/// with method #"ExpressionVal::GetNormalizedString;*", after an expression was
651/// successfully #"Compiler::Compile;compiled".
652///
653/// The normalization flags are stored per compiler instance, consequently using a public compiler
654/// field namely #"Compiler::CfgNormalization;*".
655//==================================================================================================
656enum class Normalization : uint64_t
657{
658 /// Replace given shortened and letter case mismatched identifier and function names with
659 /// completed versions.<br>
660 /// This flag is set with \b %DEFAULT.
661 ReplaceFunctionNames = (1LLU << 1),
662
663 /// Replace alias operators with effective operators.<br>
664 /// This flag is not set with \b %DEFAULT.
666
667 /// This is one of four flags that together allow five possible normalization options for
668 /// #"alib_expressions_operators_verbal;verbal alias operators".
669 /// If more than one flag is set, the one with the highest precedence is used.
670 ///
671 /// The following table lists the flags, their precedence and the type of normalization:
672 ///
673 /// |Precedence | Flag | Description
674 /// |------------|----------------------------------|------------------------------
675 /// | 0 | <none set> | A verbal operator is normalized as given in original expression string.
676 /// | 1 | ReplaceVerbalOperatorsToSymbolic | Replaces verbal operators with the symbolic operator that they represent.
677 /// | 2 | ReplaceVerbalOperatorsToLowerCase | Converts verbal operators to lower case letters.
678 /// | 3 | ReplaceVerbalOperatorsToUpperCase | Converts verbal operators to upper case letters.
679 /// | 4 | ReplaceVerbalOperatorsToDefinedLetterCase | Uses the writing specified with the definition of the verbal operator.
680 ///
681 /// With configuration #"Normalization::DEFAULT", flag
682 /// \b %ReplaceVerbalOperatorsToUpperCase is set.
684
685 /// See sibling flag #"Normalization::ReplaceVerbalOperatorsToSymbolic".
687
688 /// See sibling flag #"Normalization::ReplaceVerbalOperatorsToSymbolic".
690
691 /// See sibling flag #"Normalization::ReplaceVerbalOperatorsToSymbolic".
693
694 /// Converts nested expression names that have been given unquoted to a quoted string literal.
695 /// If this is not set, the quotation remains as given in original expression string.
696 /// This flag is \e not set with \b %DEFAULT.
697 ///
698 /// \see
699 /// Compilation flag
700 /// #"Compilation::AllowIdentifiersForNestedExpressions".
702
703 /// Remove redundant provisions unary operators <c>'+'</c> and <c>'-'</c> from number
704 /// literals.<br>
705 /// This flag is \e not set with \b %DEFAULT.
707
708 /// Write a space after an unary operator (if no brackets around arguments and no unary operator
709 /// follows).<br>
710 /// This flag is \e not set with \b %DEFAULT.
711 UnaryOpSpace = (1LLU << 9),
712
713 /// Write a space between two unary operators.<br>
714 /// This flag is \e not set with \b %DEFAULT.
716
717 /// Write a space before opening bracket of bracketed arguments of unary operators.<br>
718 /// This flag is \e not set with \b %DEFAULT.
720
721 /// Write a space after an opening and before a closing bracket of arguments of unary operators.<br>
722 /// This flag is \e not set with \b %DEFAULT.
724
725 /// If this flag is set, normalization inserts redundant brackets to the argument of an
726 /// unary operator, if that argument is an unary operator itself.
727 ///
728 /// This flag is superseded by \b %RedundantUnaryOpBrackets.<br>
729 /// This flag is \e not set with \b %DEFAULT.
731
732 /// If this flag is set, normalization inserts redundant brackets to arguments of unary
733 /// operators.
734 ///
735 /// This flag supersedes by \b %RedundantBracketsBetweenTwoUnaryOps.<br>
736 /// This flag is \e not set with \b %DEFAULT.
738
739
740 /// Write a space before and after binary operator symbol.<br>
741 /// This flag is set with \b %DEFAULT.
742 BinaryOpSpaces = (1LLU << 15),
743
744 /// Write a space after an opening and before a closing bracket of arguments of binary
745 /// operators and around a conditional expression.<br>
746 /// This flag is \e not set with \b %DEFAULT.
747 InnerBracketSpace = (1LLU << 16),
748
749 /// Write a space before opening and after closing bracket of arguments of binary
750 /// operators and around a conditional expression.<br>
751 /// This flag is \e not set with \b %DEFAULT.
752 OuterBracketSpace = (1LLU << 17),
753
754 /// If this flag is set, normalization inserts redundant brackets to the right-hand side
755 /// operand of binary operators if that operand is a binary operator itself and has a higher
756 /// precedence.
757 ///
758 /// The following samples demonstrate why this is useful if normalization targets humans:
759 ///
760 /// Without flag set | With flag set
761 /// ---------------------|----------------------
762 /// 1 - 2 - 3 | <em>no change</em>
763 /// 1 - 2 * 3 | 1 - (2 * 3)
764 /// 1 * 2 - 3 | <em>no change</em>
765 /// 1 - 2 * 3 - 4 - 5 * 6 - 7 | 1 - (2 * 3) - 4 - (5 * 6) - 7
766 /// true == false && true | <em>no change</em>
767 /// true && false == true | true && (false == true)
768 /// true && false == false && true | true && (false == false) && true
769 /// true && false == (false && true) | true && (false == (false && true))
770 /// true && false == true < false | true && (false == (true < false))
771 /// true && false == false == true | true && (false == false == true)
772 /// This flag is superseded by \b %RedundantBinaryOpBrackets.<br>
773 /// This flag is set with \b %DEFAULT.
775
776 /// If this flag is set, normalization inserts redundant brackets to both
777 /// operands of binary operators if both are binary operators themselves.
778 ///
779 /// The following samples demonstrate why this is useful if normalization strings target humans:
780 ///
781 /// Without flag set | With flag set
782 /// ---------------------|----------------------
783 /// 1 - 2 - 3 | <em>no change</em>
784 /// 1 - 2 - 3 - 4 | <em>no change</em>
785 /// 1 - 2 - (3 - 4) | (1 - 2) - (3 - 4)
786 /// 1 - 2 - 3 - (4 - 5) | (1 - 2 - 3) - (4 - 5)
787 /// 1 - 2 - (3 - 4) - 5 | (1 - 2) - (3 - 4) - 5
788 ///
789 /// This flag is superseded by \b %RedundantBinaryOpBrackets.<br>
790 /// This flag is set with \b %DEFAULT.
792
793 /// If this flag is set, normalization inserts redundant brackets around each binary operator
794 /// sub-expression. This flag supersedes flags
795 /// \b %RedundantRhsBracketsIfRhsIsStrongerBinaryOp and
796 /// \b %RedundantBracketsIfLhsAndRhsAreBinaryOps.
797 ///
798 /// It is not recommended to set this flag. It is only useful to debug expressions and
799 /// understand exactly what precedences operators have.
800 ///
801 /// This flag is set with \b %DEFAULT.
803
804
805 /// Write a space before character <c>?</c> of ternary conditional operator.<br>
806 /// This flag is set with \b %DEFAULT.
808
809 /// Write a space after character <c>?</c> of a ternary conditional operator.<br>
810 /// This flag is set with \b %DEFAULT.
812
813 /// Write a space before character <c>:</c> of ternary conditional operator.<br>
814 /// This flag is set with \b %DEFAULT.
816
817 /// Write a space after character <c>:</c> of ternary conditional operator.<br>
818 /// This flag is set with \b %DEFAULT.
820
821 /// If this flag is set, normalization inserts redundant brackets around the conditional
822 /// operator expressions <c>Q ? T : F</c>, if it is not the root node.
823 ///
824 /// This flag is set with \b %DEFAULT.
826
827 /// Write a space before between the function identifier name and the opening bracket of the
828 /// argument list.<br>
829 /// This flag is \e not set with \b %DEFAULT.
831
832 /// Write a space after the opening and before the closing bracket of argument list of a
833 /// function.<br>
834 /// This flag is set with \b %DEFAULT.
836
837 /// Write a space between the opening and the closing bracket of an empty argument list of a
838 /// function.<br>
839 /// This flag is set with \b %DEFAULT.
841
842 /// Write a space before a comma of an argument separator of an function's argument list.<br>
843 /// This flag is \e not set with \b %DEFAULT.
845
846 /// Write a space after a comma of an argument separator of a function's argument list.<br>
847 /// This flag is set with \b %DEFAULT.
849
850 /// Write a space before array subscript operator <c>'[]'</c>.<br>
851 /// This flag is \e not set with \b %DEFAULT.
853
854 /// Write a space after the opening and before the closing bracket of array subscript operator
855 /// <c>'[]'</c>.<br>
856 /// This flag is \e not set with \b %DEFAULT.
858
859
860 /// If this flag is set, floating point literals are normalized in scientific format when
861 /// given in scientific format. If it is not set, then numbers given in scientific format
862 /// might be written as usual floating point values, dependent on their value. E.g.
863 /// a given <c>1.0e1</c> would be converted to <c>10.0</c>.
864 ///
865 /// Note that the scientific format can be forced for all floating point number output by
866 /// settingthe flag #"NumberFormatFlags::ForceScientific" in the field
867 /// #"TNumberFormat::Flags" of the variable #"Formatter::DefaultNumberFormat;*", which in turn
868 /// is found in the member #"Compiler::CfgFormatter;*". Such setting would supersede
869 /// this flag.
870 ///
871 /// This flag is \e not set with \b %DEFAULT.
872 KeepScientificFormat = (1LLU << 33 ),
873
874 /// If this flag is set, integral literals will be normalized to hexadecimal format.
875 /// If this flag is not set, then integrals will be normalized in the number system that they had
876 /// been provided in.
877 ///
878 /// This flags supersedes flags \b %ForceOctal and \b %ForceBinary.
879 ///
880 /// This flag is \e not set with \b %DEFAULT.
881 ForceHexadecimal = (1LLU << 34 ),
882
883 /// If this flag is set, integral literals will be normalized to octal format.
884 /// If this flag is not set, then integrals will be normalized in the number system that they had
885 /// been provided in.
886 ///
887 /// This flags is superseded by flag \b %ForceHexadecimal and supersedes flag \b %ForceBinary.
888 ///
889 /// This flag is \e not set with \b %DEFAULT.
890 ForceOctal = (1LLU << 35 ),
891
892 /// If this flag is set, integral literals will be normalized to binary format.
893 /// If this flag is not set, then integrals will be normalized in the number system that they had
894 /// been provided in.
895 ///
896 /// This flags is superseded by flags \b %ForceHexadecimal and \b %ForceOctal.
897 ///
898 /// This flag is \e not set with \b %DEFAULT.
899 ForceBinary = (1LLU << 36 ),
900
901 /// All flags are cleared, may be used for testing bits.
902 NONE = 0L,
903
904 /// All flags are cleared, hence no whitespaces and unnecessary brackets are written and
905 /// identifiers as they have been given (potentially abbreviated and ignoring letter case).
907
908 /// Default value. Evaluates to:<br>
909 /// <c>ReplaceFunctionNames + </c><br>
910 /// <c>ReplaceVerbalOperatorsToUpperCase + </c><br>
911 /// <br>
912 /// <c>RemoveRedundantUnaryOpsOnNumberLiterals + </c><br>
913 /// <c>BinaryOpSpaces + </c><br>
914 /// <c>RedundantRhsBracketsIfRhsIsStrongerBinaryOp + </c><br>
915 /// <c>RedundantBracketsIfLhsAndRhsAreBinaryOps + </c><br>
916 /// <br>
917 /// <c>ConditionalOpSpaceBeforeQM + </c><br>
918 /// <c>ConditionalOpSpaceBeforeColon + </c><br>
919 /// <c>ConditionalOpSpaceAfterQM + </c><br>
920 /// <c>ConditionalOpSpaceAfterColon + </c><br>
921 /// <c>RedundantConditionalOpBrackets + </c><br>
922 /// <br>
923 /// <c>FunctionInnerBracketSpace + </c><br>
924 /// <c>FunctionSpaceAfterComma + </c><br>
927
932
938
941};
942
943/// Type definition for passing boxes as sample types.
944///
945/// \see For more information, see
946/// #"alib_expressions_prereq_sb".
948
949/// Type definition for passing arguments to expression callbacks.
950///
951/// \see For more information, see
952/// #"alib_expressions_prereq_sb".
953using ArgIterator= StdVectorMA<Box>::iterator;
954
955/// Function pointer implementing native callback functions, for expression functions and
956/// operators. The implementations are defined and selected by the compiler plugins.
957/// They are called (executed) when an expression is evaluated.
958///
959/// @param scope The expression's evaluation scope.
960/// @param[out] argsBegin An iterator that returns \b %Box objects.
961/// The first entry takes also the result.
962/// @param[out] argsEnd The end-iterator.
963///
964using CallbackDecl = Box (*)( Scope& scope, ArgIterator argsBegin, ArgIterator argsEnd );
965
966
967/// This struct constitutes a type declaration for a #"alib_boxing_functions;box-function".
968/// The function is used to create parsable expression "literals" from constant values of custom
969/// type stored in boxes.
970///
971/// The function is used by the library if all of the following occurs:
972/// - If custom identifiers, functions or operator callback functions return a custom type.
973/// - If such types can be constants and are announced to the compiler as such.
974/// - If method #"ExpressionVal::GetOptimizedString;*" is called.
975/// - If such string is to be used as input to compiling expressions.
976///
977/// If the last condition is met, compilation of the "normalized optimized expression string " would
978/// fail. If it is not met, then without a proper implementation of this function, the only
979/// "damage" is that such string would show an integral value where a constant custom type was
980/// expected.
981///
982/// The challenge of implementing this box-function for a custom type, is to convert constants of
983/// custom types back into a normalized, human-readable but also compilable expression string.
984/// As the expression syntax only defines the built-in literal types
985/// #"Types::Integer", #"Types::Float" and
986/// #"Types::String", the constants have to be created using either appropriate
987/// custom identifiers or "constructor functions" that have to be provided in addition along with
988/// the implementation of this box-function to make it compilable.
989///
990/// A sample for that situation is given in chapter #"alib_expressions_details_optimizations_norm"
991/// of the Programmer's Manual.
992///
993/// The identifiers and constructor functions in turn need to be compile-time evaluatable
994/// to ensure that recompiling the optimized string results to constants so that the same
995/// optimized expression program is generated..
996///
997/// #### Sample: ####
998/// So far, this probably sounded a little complicated. Let us look step by step at the sample
999/// given in the aforementioned manual section, that is solved internally by the library using
1000/// this box-function declaration.
1001///
1002/// %Compiler plug-in #"plugins::DateAndTime" introduces \alib class
1003/// #"TimePointBase::Duration;*" to expressions. This is, for example, done by defining
1004/// identifiers as follows:
1005///
1006/// \snippet "plugins/dateandtime.cpp" DOX_EXPR_FToLiteral_1
1007///
1008/// The "constructor functions" are declared to be #"CTI;compile-time invokable"
1009/// and return a constant value at compile-time in case their input parameter is constant.
1010/// When the program - that may due to optimization not contain the identifiers anymore - becomes
1011/// de-compiled, these constants have to be written to the normalized expression string in a way that
1012/// corresponding constant values of type \b %Duration are expressed.
1013///
1014/// To perform this task, an implementation of the box-function that this struct declares
1015/// has to be registered with boxes containing values of \b TimePointBase::Duration.<br>
1016/// Registrations of box-functions have to be done in the #"alib_mod_bs;bootstrap"
1017/// code of the library. In this case it is done in static method
1018/// #"plugins::DateAndTime::Bootstrap;*".
1019/// The function name that is used for the implementation is \b %FToLiteral_Duration. Here is
1020/// the line of code that registers the function with the boxed type:
1021///
1022/// \snippet "expressions/plugins/dateandtime.cpp" DOX_EXPR_FToLiteral_2
1023///
1024/// The implementation is given in an anonymous namespace of the compilation unit of compiler plug-in
1025/// \b %DateAndTime. The function's signature has to meet the one given with type definition #".Signature"
1026/// of this struct. Besides the first parameter that passes the box that the function is invoked
1027/// on (the one containing the constant value of custom type), second parameter \p{expressionString}
1028/// provides the \b AString that the function is requested to write the "generation expression" to.<br>
1029/// The implementation code looks as follows:
1030///
1031/// \snippet "expressions/plugins/dateandtime.cpp" DOX_EXPR_FToLiteral_3
1032///
1033/// As it can be understood from the code, the interface implementation tries to find the best
1034/// matching "constructor function" for the time span given, writes its name and the constant parameter
1035/// enclosed by brackets \c "()".
1036///
1037/// Only with such interface implementation in place - one that covers all possible constants - this
1038/// library is able to create <b>parsable, normalized, optimized expression strings</b>.
1039/// To finalize this example, we check what the result for three sample expressions looks like:
1040///
1041/// \snippet "DOX_EXPRESSIONS_TUT_WONO-100.txt" OUTPUT
1042/// \snippet "DOX_EXPRESSIONS_TUT_WONO-101.txt" OUTPUT
1043/// \snippet "DOX_EXPRESSIONS_TUT_WONO-102.txt" OUTPUT
1044///
1045/// \note
1046/// When integrating module \alib_expressions_nl into software, a decision has to be
1047/// taken: "Should optimized expression strings be presented to the end-user?"<br>
1048///
1049/// \note
1050/// While it is obvious, that sample two demonstrates that to be useful, sample three probably
1051/// demonstrates the opposite!<br>
1052/// It is important to understand, that the decision depends on the custom use case, where for
1053/// example the technical understanding of a typical end-user may be taken into account.
1054///
1055/// \note
1056/// If the decision is taken, \b not to present optimized expression strings to the end-user, this
1057/// has absolutely no influence on the evaluation performance: The compilation of all three
1058/// expression strings, namely
1059/// - the original input,
1060/// - the normalized output and
1061/// - the optimized, normalized output,
1062/// \note
1063/// are leading to the very same (optimized) internal program when compiled!
1064///
1065/// \note
1066/// Of course, if no optimization strings are presented to the end-user and hence are not
1067/// recompiled (or copy/pasted by such users), then the implementation of this box-function is
1068/// not needed for your custom type, as it is only invoked with method
1069/// #"ExpressionVal::GetOptimizedString;*"!
1071{
1072 /// Signature of the invokable function.
1073 ///
1074 /// @param constantValue The constant program value that is about to be written into
1075 /// \p{expressionString}.
1076 /// @param expressionString The expression string that is currently generated.
1077 using Signature = void (*) ( const Box& constantValue, AString& expressionString );
1078};
1079
1080
1081//==================================================================================================
1082/// The module class for module \alib_expressions_nl.
1083///
1084/// This is a strict singleton class. The only instance found with namespace variable
1085/// #"alib::EXPRESSIONS".
1086//==================================================================================================
1088{
1089 public:
1090 /// Constructor.<br>
1091 /// While this is public, it must not be invoked as this is a strict singleton type.
1092 /// (See notes in #"alib_camp_camp").
1094
1095 protected:
1096 /// Initializes this camp.
1097 virtual void Bootstrap() override;
1098
1099 /// Terminates this camp. (Nothing to do.)
1100 /// @param phase The shutdown phase to perform.
1101 virtual void Shutdown( ShutdownPhases phase ) override { (void) phase; }
1102
1103}; // class ExpressionsCamp
1104
1105} // namespace alib[::expressions]
1106
1107/// The singleton instance of \alibcamp class #"ExpressionsCamp".
1108extern ALIB_DLL expressions::ExpressionsCamp EXPRESSIONS;
1109
1110} // namespace [alib]
1111
1113
1117
1125
#define ALIB_DLL
Definition alib.inl:573
#define ALIB_EXPORT
Definition alib.inl:562
#define ALIB_BOXING_VTABLE_DECLARE(TMapped, Identifier)
#define ALIB_RESOURCED_IN_CAMP(T, Camp, ResName)
virtual void Shutdown(ShutdownPhases phase) override
virtual void Bootstrap() override
Initializes this camp.
#define ALIB_ENUMS_MAKE_BITWISE(TEnum)
#define ALIB_ENUMS_MAKE_ARITHMETICAL(TEnum)
#define ALIB_ENUMS_ASSIGN_RECORD(TEnum, TRecord)
@ DateAndTime
Collection of date and time functions based on #"alib::time".
@ Arithmetics
Collection of built-in unary and binary operators for boolean, integer and floating point values.
@ Strings
Built-in String comparison and manipulation.
@ Math
Collection of built-in unary and binary operators for boolean, integer and floating point values.
@ NONE
Used to denote that no variable or plug-in was found.
@ Or
Verbal alias "Or" to boolean or operator '||'.
@ And
Verbal alias "And" to boolean and operator '&&'.
Box(*)(Scope &scope, ArgIterator argsBegin, ArgIterator argsEnd) CallbackDecl
@ BitOr
Binary or ('|'). "or"s all bits of two integral values. Precedence 450.
@ SmallerOrEqual
Smaller or equal operator ('<='). Precedence 600.
@ Divide
Arithmetic division ('/'). Precedence 900.
@ NotEqual
Not equal operator ('!='). Precedence 500.
@ Subtract
Arithmetic subtraction ('-'). Precedence 800.
@ BoolAnd
Boolean and ('&&'). Result is boolean. Precedence 440.
@ Modulo
Arithmetic modulo ('%'). Precedence 900.
@ BoolOr
Boolean or ('||'). Result is boolean. Precedence 430.
@ GreaterOrEqual
Greater or equal operator ('>='). Precedence 600.
@ BitXOr
Binary xor ('^'). "xor"s all bits of two integral values. Precedence 460.
@ Greater
Greater operator ('>'). Precedence 600.
@ Subscript
Array subscripting ('[]'). Precedence hardcoded with parser.
@ Smaller
Smaller operator ('<'). Precedence 600.
@ ShiftLeft
Bitwise shifting of integral values ('<<'). Precedence 700.
@ Multiply
Arithmetic multiplication ('*'). Precedence 900.
@ BitAnd
Binary and ('&'). "and"s all bits of two integral values. Precedence 470.
@ Add
Arithmetic addition ('+'). Precedence 800.
@ ShiftRight
Bitwise shifting of integral values ('>>'). Precedence 700.
@ Equal
Equal operator ('=='). Precedence 500.
const alib::boxing::Box & Type
@ ReplaceVerbalOperatorsToLowerCase
See sibling flag #"Normalization::ReplaceVerbalOperatorsToSymbolic".
@ ReplaceVerbalOperatorsToDefinedLetterCase
See sibling flag #"Normalization::ReplaceVerbalOperatorsToSymbolic".
@ ReplaceVerbalOperatorsToUpperCase
See sibling flag #"Normalization::ReplaceVerbalOperatorsToSymbolic".
@ UnknownIdentifier
Compile-time exception thrown when an expression uses an unknown identifier name.
@ UnknownFunction
Compile-time exception thrown when an expression uses an unknown function name.
@ NamedExpressionNotFound
Compile-time exception thrown when an expression refers to an unknown named nested expression.
@ UnknownBinaryOperatorSymbol
Unknown binary operator symbol found when parsing expression string.
@ UnknownUnaryOperatorSymbol
Unknown unary operator symbol found when parsing expression string.
@ EmptyExpressionString
Thrown when an empty string is tried to be compiled.
@ SyntaxErrorExpectation
Syntax error with concrete information about what the parser expected at given position.
@ SyntaxError
General error thrown by the parser.
@ Positive
'+' operator (usually returns identity value).
@ Negative
'-' operator, negates a value.
StdVectorMA< Box >::iterator ArgIterator
ShutdownPhases
Termination levels usable with #"alib_mod_bs_camps;Bootstrapping ALib Camps".
Definition camp.inl:42
boxing::Box Box
Type alias in namespace alib.
Definition box.inl:1135
strings::TString< character > String
Type alias in namespace alib.
Definition string.inl:2172
expressions::ExpressionsCamp EXPRESSIONS
The singleton instance of ALib Camp class #"ExpressionsCamp".
strings::TAString< character, lang::HeapAllocator > AString
Type alias in namespace alib.
void Parse()
Implementation of #"EnumRecordPrototype::Parse;*".
String Symbol
The parable symbol of an operator.
int Precedence
The precedence of an operator in respect to other binary operators.
void Parse()
Implementation of #"EnumRecordPrototype::Parse;*".
EROperatorAlias() noexcept=default
String Replacement
The replacement operator symbol.
String Symbol
The parsable symbol of an alias operator.
void(*)(const Box &constantValue, AString &expressionString) Signature
static Box * SI[2]
Function accepts one string argument, followed by an integral argument.
static Box * FF[2]
Function accepts two floating point arguments.
static Box * B[1]
Function accepts one boolean argument.
static Box * IVar[2]
Function accepts one integral argument, followed by variadic arguments.
static Box * BB[2]
Function accepts two boolean arguments.
static Box * II[2]
Function accepts two integral arguments.
static Box * Dur[1]
Function accepts a #"TimePointBase::Duration" argument.
static Box * SII[3]
Function accepts one string argument, followed by two integral arguments.
static Box * SSB[3]
Function accepts two string arguments, followed by a boolean argument.
static Box * F[1]
Function accepts one floating point argument.
static Box * SVar[2]
Function accepts one string argument, followed by variadic arguments.
static Box * SS[2]
Function accepts two string arguments.
static Box * Var[1]
Function accepts variadic arguments.
static Box * DDur[2]
Function accepts a #"time::DateTime" argument; followed by a #"TimePointBase::Duration".
static Box * SSI[3]
Function accepts two string arguments, followed by an integral argument.
static Box * D[1]
Function accepts a #"time::DateTime" argument.
static Box * SSS[3]
Function accepts three string arguments.
static Box * S[1]
Function accepts one string argument.
static Box * I[1]
Function accepts one integral argument.
static Box Integer
Sample type-box for integer types. (Precisely for type #"lang::integer".).
static Box Boolean
Sample type-box for C++ type bool.
static Box Void
Sample type-box for C++ type void.
static Box Float
Sample type-box for C++ type double.
static Box DateTime
Sample type-box for date and time values of type #"time::DateTime").