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