ALib C++ Library
Library Version: 2412 R0
Documentation generated by doxygen
Loading...
Searching...
No Matches
alib::expressions Namespace Reference

Description:

This is the reference documentation of sub-namespace expressions of the ALib C++ Library, which holds types of library module ALib Expressions.

Extensive documentation for this module is provided with ALib Module Expressions - Programmer's Manual.

Nested Namespaces:

namespace  detail
 
namespace  plugins
 
namespace  util
 Utility types of camp ALib Expressions.
 

Type Index:

class  Compiler
 
struct  CompilerPlugin
 
struct  ERBinaryOperator
 
struct  EROperatorAlias
 
struct  Expression
 
class  ExpressionRepository
 
class  ExpressionsCamp
 
class  ExpressionVal
 
struct  FToLiteral
 
struct  Scope
 
struct  ScopeResource
 
struct  Signatures
 
class  StandardRepository
 
struct  Types
 

Type Definition Index:

using ArgIterator = StdVectorMono<Box>::iterator
 
using CallbackDecl = Box (*)( Scope& scope, ArgIterator argsBegin, ArgIterator argsEnd )
 
using Type = const alib::boxing::Box&
 

Enumeration Index:

enum class  Compilation {
  DefaultUnaryOperators = (1 << 1) , DefaultBinaryOperators = (1 << 2) , DefaultAlphabeticOperatorAliases = (1 << 3) , AlphabeticOperatorsIgnoreCase = (1 << 4) ,
  AllowSubscriptOperator = (1 << 5) , AliasEqualsOperatorWithAssignOperator = (1 << 6) , AllowBitwiseBooleanOperators = (1 << 7) , AllowOmittingParenthesesOfParameterlessFunctions = (1 << 8) ,
  AllowEmptyParenthesesForIdentifierFunctions = (1 << 9) , AllowCompileTimeNestedExpressions = (1 << 10) , AllowIdentifiersForNestedExpressions = (1 << 11) , CaseSensitiveNamedExpressions = (1 << 12) ,
  PluginExceptionFallThrough = (1 << 13) , CallbackExceptionFallThrough = (1 << 14) , NoOptimization = (1 << 20) , DEFAULT
}
 
enum class  CompilePriorities {
  NONE = 0 , ElvisOperator = 100 , AutoCast = 200 , Strings = 300 ,
  Arithmetics = 400 , Math = 500 , DateAndTime = 600 , Custom = 1000
}
 
enum class  DefaultAlphabeticBinaryOperatorAliases {
  And , Or , Sm , Smaller ,
  SmEq , SmallerOrEqual , Gt , Greater ,
  GtEq , GreaterOrEqual , Eq , Equals ,
  NEq , NotEqual
}
 
enum class  DefaultAlphabeticUnaryOperatorAliases { Not }
 
enum class  DefaultBinaryOperators {
  NONE , Subscript , Multiply , Divide ,
  Modulo , Add , Subtract , ShiftLeft ,
  ShiftRight , Smaller , SmallerOrEqual , Greater ,
  GreaterOrEqual , Equal , NotEqual , BitAnd ,
  BitXOr , BitOr , BoolAnd , BoolOr ,
  Assign , Elvis
}
 
enum class  DefaultUnaryOperators {
  NONE , Positive , Negative , BoolNot ,
  BitNot , Indirection
}
 
enum class  Exceptions {
  SyntaxError =1 , ExpressionInfo = -1 , StdExceptionInfo =-2 , EmptyExpressionString =2 ,
  SyntaxErrorExpectation =5 , UnknownUnaryOperatorSymbol =6 , UnknownBinaryOperatorSymbol =7 , UnknownIdentifier =14 ,
  UnknownFunction =15 , FunctionHint =-15 , UnaryOperatorNotDefined =16 , BinaryOperatorNotDefined =17 ,
  MissingFunctionParentheses =22 , IdentifierWithFunctionParentheses =23 , IncompatibleTypesInConditional =25 , ExceptionInPlugin =30 ,
  ExceptionInCallback =40 , NamedExpressionNotConstant =50 , NamedExpressionNotFound =51 , NestedExpressionNotFoundCT =52 ,
  NestedExpressionCallArgumentMismatch =53 , NestedExpressionNotFoundET =54 , WhenEvaluatingNestedExpression =-54 , NestedExpressionResultTypeError = 55 ,
  CircularNestedExpressions = 56 , CircularNestedExpressionsInfo =-56 , InExpressionFormatter =-500
}
 
enum class  Normalization : uint64_t {
  ReplaceFunctionNames = (1LLU << 1) , ReplaceAliasOperators = (1LLU << 2) , ReplaceVerbalOperatorsToSymbolic = (1LLU << 3) , ReplaceVerbalOperatorsToLowerCase = (1LLU << 4) ,
  ReplaceVerbalOperatorsToUpperCase = (1LLU << 5) , ReplaceVerbalOperatorsToDefinedLetterCase = (1LLU << 6) , QuoteUnaryNestedExpressionOperatorArgument = (1LLU << 7) , RemoveRedundantUnaryOpsOnNumberLiterals = (1LLU << 8) ,
  UnaryOpSpace = (1LLU << 9) , UnaryOpSpaceIfUnaryFollows = (1LLU << 10) , UnaryOpSpaceIfBracketFollows = (1LLU << 11) , UnaryOpInnerBracketSpace = (1LLU << 12) ,
  RedundantBracketsBetweenTwoUnaryOps = (1LLU << 13) , RedundantUnaryOpBrackets = (1LLU << 14) , BinaryOpSpaces = (1LLU << 15) , InnerBracketSpace = (1LLU << 16) ,
  OuterBracketSpace = (1LLU << 17) , RedundantRhsBracketsIfRhsIsStrongerBinaryOp = (1LLU << 18) , RedundantBracketsIfLhsAndRhsAreBinaryOps = (1LLU << 19) , RedundantBinaryOpBrackets = (1LLU << 20) ,
  ConditionalOpSpaceBeforeQM = (1LLU << 21) , ConditionalOpSpaceAfterQM = (1LLU << 22) , ConditionalOpSpaceBeforeColon = (1LLU << 23) , ConditionalOpSpaceAfterColon = (1LLU << 24) ,
  RedundantConditionalOpBrackets = (1LLU << 25) , FunctionSpaceBeforeOpeningBracket = (1LLU << 26) , FunctionInnerBracketSpace = (1LLU << 27) , FunctionInnerBracketSpaceIfNoArguments = (1LLU << 28) ,
  FunctionSpaceBeforeComma = (1LLU << 29) , FunctionSpaceAfterComma = (1LLU << 30) , SubscriptSpaceBeforeBrackets = (1LLU << 31) , SubscriptInnerBracketSpace = (1LLU << 32) ,
  KeepScientificFormat = (1LLU << 33 ) , ForceHexadecimal = (1LLU << 34 ) , ForceOctal = (1LLU << 35 ) , ForceBinary = (1LLU << 36 ) ,
  NONE = 0L , COMPACT = 0L , DEFAULT
}
 

Type Definition Details:

◆ ArgIterator

using ArgIterator = StdVectorMono<Box>::iterator

Type definition for passing arguments to expression callbacks.

See also
For more information, see 3.2 Type definitions With Sample Boxes.

Definition at line 971 of file expressionscamp.hpp.

◆ CallbackDecl

using CallbackDecl = Box (*)( Scope& scope, ArgIterator argsBegin, ArgIterator argsEnd )

Function pointer implementing native callback functions, for expression functions and operators. The implementations are defined and selected by the compiler plugins. They are called (executed) when an expression is evaluated.

Parameters
scopeThe expression's evaluation scope.
[out]argsBeginAn iterator that returns Box objects. The first entry takes also the result.
[out]argsEndThe end-iterator.

Definition at line 982 of file expressionscamp.hpp.

◆ Type

using Type = const alib::boxing::Box&

Type definition for passing boxes as sample types.

See also
For more information, see 3.2 Type definitions With Sample Boxes.

Definition at line 965 of file expressionscamp.hpp.

Enumeration Details:

◆ Compilation

enum class Compilation
strong

Bitwise enum class defining options of expression compilation. Flags defined with this type are set in field Compiler::CfgCompilation.

Enumerator
DefaultUnaryOperators 

If this flag is set, all unary operators given in DefaultUnaryOperators are defined with method Compiler::SetupDefaults.

Note that the enumeration class is equipped with resourced ALib Enum Records, which might be changed as an alternative to clearing this flag and provide own definitions.

This flag is set by default.

DefaultBinaryOperators 

If this flag is set, all binary operators given in DefaultBinaryOperators are defined with method Compiler::SetupDefaults.

Note that the enumeration class is equipped with resourced ALib Enum Records, which might be changed as an alternative to clearing this flag and provide own definitions.

This flag is set by default.

DefaultAlphabeticOperatorAliases 

If this flag is set, all alphabetic operator aliases given in enumerations DefaultAlphabeticUnaryOperatorAliases and DefaultAlphabeticBinaryOperatorAliases are defined with method Compiler::SetupDefaults.

Note that both enumeration classes are equipped with resourced ALib Enum Records, which might be changed as an alternative to clearing this flag and provide own definitions.

This flag is set by default.

AlphabeticOperatorsIgnoreCase 

If this flag is set, alphabetic operator aliases defined in Compiler::AlphabeticUnaryOperatorAliases and Compiler::AlphabeticBinaryOperatorAliases are parsed ignoring letter case.

Note
Even when this flag is cleared, no two verbal operator aliases that are equal when case is ignored must be defined (e.g "or" and "OR" ).

This flag is set by default.

AllowSubscriptOperator 

If not set, array subscript operator [] is not supported and its use will cause parse errors errors.

Note that compiler plug-ins get the array subscript operator presented for compilation as a usual binary operator given as DefaultBinaryOperators::Subscript. This makes its support with custom types quite simple.

Attention
This flag has to be changed to a custom state before performing the first compilation of an expression with a dedicated Compiler. The rationale behind this is, that the compiler creates the parser system at its first use, which in turn does not check the flag after creation.

This flag is set by default.

AliasEqualsOperatorWithAssignOperator 

Used with constructor of compiler plug-ins plugins::Arithmetics and plugins::Strings. (If they are activated in Compiler::CfgBuiltInPlugins or "manually" added.)

Denotes if the assignment operator = is an alias for equal operator ==. If set to false, the use of the = operator with several any argument type, throws a compilation exception, unless it is compiled by a custom plug-in.

Attention
In addition to aliasing the == with =, the latter also receives a higher precedence of parsing! If this flag is not set, the precedence of assign =,follows the C++ standards and thus is below the group of &, ^, |, &&, || and ? :. If the alias setting is activated, then the precedence is raised to be on the same level as boolean equal == and thus higher than the aforementioned operators!
AllowBitwiseBooleanOperators 

Used with constructor of compiler plug-in plugins::Arithmetics. (If it is activated in Compiler::CfgBuiltInPlugins or "manually" added.)

Denotes if the unary bitwise operator ~ and binary bitwise operators &, | and ^ should be allowed for boolean values. If set to false, the use of the bitwise operators with boolean arguments, throws a compilation exception, unless the bitwise operators are compiled by a custom plug-in.

AllowOmittingParenthesesOfParameterlessFunctions 

If false, compile-time exception Exceptions::MissingFunctionParentheses is thrown if a parameterless function is stated without (otherwise redundant) parentheses '()'.

If true, this is tolerated.

Note
This flag is not tested, and the exception is not thrown, by the compiler itself, but by class Calculus.
Even if this flag is false, still functions without parentheses may be allowed by setting nullptr to field Calculus::FunctionEntry::Signature when registering a function. In this case the function is considered rather being an "identifier" than a function. (Still it is the very same as a function, it is just a matter of wording here.)

The other way round, if a function is registered as an identifier, flag AllowEmptyParenthesesForIdentifierFunctions, controls if exception Exceptions::IdentifierWithFunctionParentheses is to be thrown if empty parentheses are given on functions that are registered as identifier-style functions.

AllowEmptyParenthesesForIdentifierFunctions 

If false, compile-time exception Exceptions::IdentifierWithFunctionParentheses is thrown if a parameterless function, declared as 'identifier style' is used with parentheses '()'.

If true, this is tolerated.

See also
For more information, see the note in documentation of flag AllowOmittingParenthesesOfParameterlessFunctions.
AllowCompileTimeNestedExpressions 

If this flag is set (the default), the unary nested expression operator is activated, as well as the single-parameter overload of the nested expression function. If the field is cleared, then only evaluation-time nested expressions are allowed, which is the two- and three-parameter version of the expression function. Other uses are then causing compilation exception Exceptions::UnaryOperatorNotDefined, respectively Exceptions::NestedExpressionCallArgumentMismatch.

AllowIdentifiersForNestedExpressions 

If this flag is set (the default), then identifiers that follow the unary nested expression operator (defaults to '*'), are internally converted to corresponding string literals - just as if they were given as a quoted string.

See also
Normalization flag QuoteUnaryNestedExpressionOperatorArgument.
CaseSensitiveNamedExpressions 

If not set (the default), then names of named expressions are not distinguished by letter case.

PluginExceptionFallThrough 

Controls whether exceptions of type std::exception thrown in plug-ins during compilation are caught by the compiler and transformed to Exceptions::ExceptionInPlugin

Note that exceptions thrown in callback functions which are evaluated at compile-time against constant parameters, are considered plug-in exceptions.

CallbackExceptionFallThrough 

This is an "evaluation-time compiler flag". If not set (the default) exceptions of type Exception and std::exception thrown in callback functions during expression evaluation are caught and transformed to Exceptions::ExceptionInCallback letter case.

NoOptimization 

If this flag is set, no optimizations are performed when assembling the program.

Note
There is absolutely no reason for setting this flag, other than for running the unit tests. Or for playing with the little virtual machine implemented with this library and having fun understanding the non-optimized program listings generated. The assembly language is easy, it has only four virtual assembly commands - plus a fifth for invoking programs of nested expressions.
DEFAULT 

Default value. Evaluates to:
DefaultUnaryOperators +
DefaultBinaryOperators +
DefaultAlphabeticOperatorAliases +
AlphabeticOperatorsIgnoreCase +
AliasEqualsOperatorWithAssignOperator +
AllowBitwiseBooleanOperators +
AllowSubscriptOperator +
AllowOmittingParenthesesOfParameterlessFunctions +
AllowEmptyParenthesesForIdentifierFunctions +
AllowCompileTimeNestedExpressions +
AllowIdentifiersForNestedExpressions +

Definition at line 465 of file expressionscamp.hpp.

◆ CompilePriorities

enum class CompilePriorities
strong

Arithmetical enumeration of slots used to prioritize CompilerPlugin instances attached to instances of class Compiler at run-time.

Enumerator
NONE 

Used to denote that no variable or plug-in was found.

ElvisOperator 

Built-in operator ?: (like conditional, but no 'true'-expression).

See also
plugins::ElvisOperator
AutoCast 

Auto-cast plug-in.

Strings 

Built-in String comparison and manipulation.

Arithmetics 

Collection of built-in unary and binary operators for boolean, integer and floating point values.

Math 

Collection of built-in unary and binary operators for boolean, integer and floating point values.

DateAndTime 

Collection of date and time functions based on alib::time.

Custom 

This is where custom plug-ins usually should be placed. It gives them a higher priority than all built-in plug-ins have.
If more than one plug-in should be installed, add 1, 2, ... to the enum element.

Definition at line 172 of file expressionscamp.hpp.

◆ DefaultAlphabeticBinaryOperatorAliases

This enumeration lists the built-in verbal alias names for binary operators.

The associated ALib Enum Records provides the operator verbs as well as the replacement operator.

Flag Compilation::DefaultAlphabeticOperatorAliases controls if method Compiler::SetupDefaults adds the aliases to the compiler.

Enumerator
And 

Verbal alias "And" to boolean and operator '&&'.

Or 

Verbal alias "Or" to boolean or operator '||'.

Sm 

Verbal alias "Sm" to operator '<'.

Smaller 

Verbal alias "Smaller" to operator '<'.

SmEq 

Verbal alias "Smeq" to operator '<='.

SmallerOrEqual 

Verbal alias "Smaller_or_equal" to operator '<='.

Gt 

Verbal alias "Gt" to operator '>'.

Greater 

Verbal alias "Greater" to operator '>'.

GtEq 

Verbal alias "Gteq" to operator '>='.

GreaterOrEqual 

Verbal alias "Greater_or_equal" to operator '>='.

Eq 

Verbal alias "Eq" to operator '=='.

Equals 

Verbal alias "Equals" to operator '=='.

NEq 

Verbal alias "Neq" to operator '!='.

NotEqual 

Verbal alias "Not_equals" to operator '!='.

Definition at line 410 of file expressionscamp.hpp.

◆ DefaultAlphabeticUnaryOperatorAliases

This enumeration lists the built-in verbal alias names for unary operators.

The associated ALib Enum Records provides the operator verbs as well as the replacement operator.

Flag Compilation::DefaultAlphabeticOperatorAliases controls if method Compiler::SetupDefaults adds the aliases to the compiler.

Enumerator
Not 

Verbal alias "Not" to operator '!'.

Definition at line 396 of file expressionscamp.hpp.

◆ DefaultBinaryOperators

enum class DefaultBinaryOperators
strong

This enumeration lists the built-in binary operators. The associated ALib Enum RecordS of type ERBinaryOperator provides an operator's symbol an its precedence.

Enumerator
NONE 

Not an operator.

Subscript 

Array subscripting ('[]'). Precedence hardcoded with parser.

Multiply 

Arithmetic multiplication ('*'). Precedence 900.

Divide 

Arithmetic division ('/'). Precedence 900.

Modulo 

Arithmetic modulo ('%'). Precedence 900.

Add 

Arithmetic addition ('+'). Precedence 800.

Subtract 

Arithmetic subtraction ('-'). Precedence 800.

ShiftLeft 

Bitwise shifting of integral values ('<<'). Precedence 700.

ShiftRight 

Bitwise shifting of integral values ('>>'). Precedence 700.

Smaller 

Smaller operator ('<'). Precedence 600.

SmallerOrEqual 

Smaller or equal operator ('<='). Precedence 600.

Greater 

Greater operator ('>'). Precedence 600.

GreaterOrEqual 

Greater or equal operator ('>='). Precedence 600.

Equal 

Equal operator ('=='). Precedence 500.

NotEqual 

Not equal operator ('!='). Precedence 500.

BitAnd 

Binary and ('&'). "and"s all bits of two integral values. Precedence 470.

BitXOr 

Binary xor ('^'). "xor"s all bits of two integral values. Precedence 460.

BitOr 

Binary or ('|'). "or"s all bits of two integral values. Precedence 450.

BoolAnd 

Boolean and ('&&'). Result is boolean. Precedence 440.

BoolOr 

Boolean or ('||'). Result is boolean. Precedence 430.

Assign 

Assignment. By default, this is used as alias operator for operator Equal by the built-in compiler plug-ins. See AliasEqualsOperatorWithAssignOperator for more information.
Precedence 300.

Elvis 

Binary version of ternary operator Q ? T : F with second operand (T) not given. Whitespaces are allowed between '?' and ':'.
Precedence 200.

Definition at line 313 of file expressionscamp.hpp.

◆ DefaultUnaryOperators

enum class DefaultUnaryOperators
strong

This enumeration lists the built-in unary operators. The associated ALib Enum Records provides the operator symbols.

Enumerator
NONE 

Not an operator.

Positive 

'+' operator (usually returns identity value).

Negative 

'-' operator, negates a value.

BoolNot 

Boolean not ('!').

BitNot 

Bitwise not ('~').

Indirection 

Unary '*' operator. Similar to the C++ indirection operator, this is the default operator uses with nested expressions, which is defined with Compiler::CfgNestedExpressionOperator.

Definition at line 293 of file expressionscamp.hpp.

◆ Exceptions

enum class Exceptions
strong

Exceptions thrown by module ALib Expressions.

Note
This enum type is associated with ALib Enum Records according to the specification documented with class Exception.
Enumerator
SyntaxError 

General error thrown by the parser.

ExpressionInfo 

Detail entry (negative element value) used with various exceptions. Shows the expression in a first line and a marker of the syntax error position in a second.

StdExceptionInfo 

This is added to exceptions when when a std::exception is wrapped. The 'what()' string is included as entry parameter. (This is a detail entry with negative element value).

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.

UnknownUnaryOperatorSymbol 

Unknown unary operator symbol found when parsing expression string.

UnknownBinaryOperatorSymbol 

Unknown binary operator symbol found when parsing expression string.

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.

FunctionHint 

Optional info entry (negative element value) on a function with matching name but non-matching arguments found.

UnaryOperatorNotDefined 

Compile-time exception thrown when an unary operator is not applicable to the given argument type.

BinaryOperatorNotDefined 

Compile-time exception thrown when a binary operator is not applicable to the combination of left-hand and right-and argument type.

MissingFunctionParentheses 

Compile-time exception thrown when function parentheses are missing with parameterless functions, while flag AllowOmittingParenthesesOfParameterlessFunctions is not set in Compiler::CfgCompilation.

IdentifierWithFunctionParentheses 

Compile-time exception thrown when empty function parentheses are given with identifiers (parameterless functions), while flag AllowEmptyParenthesesForIdentifierFunctions is not set in Compiler::CfgCompilation.

IncompatibleTypesInConditional 

Compile-time exception thrown when incompatible types are given with conditional term Q ? T : F. Note that before throwing this exception, the compiler tries to insert auto-cast callback functions, and if found, performs one second try to compile the operator for the new pair of operatnd types.

ExceptionInPlugin 

This is a "wrapper" exception thrown when a plug-in or a compile-time invoked callback function throws an exception of type std::exception or of type Exception with a code that is not of this enumeration type.
Used only if compilation Compilation::PluginExceptionFallThrough is not set.

ExceptionInCallback 

This is a "wrapper" exception thrown when callback functions throws an exception of type std::exception or of type Exception. Used only if compilation Compilation::CallbackExceptionFallThrough is not set.

NamedExpressionNotConstant 

Compile-time exception thrown when unary expression operator is used with a non-constant nested expression name.

NamedExpressionNotFound 

Compile-time exception thrown when an expression refers to an unknown named nested expression.

NestedExpressionNotFoundCT 

Compile-time exception thrown when a named nested expression which is searched an inserted at compile-time could not be found.
Overwrites exception NamedExpressionNotFound.

See also
Manual chapter 10. Nested Expressions.
NestedExpressionCallArgumentMismatch 

Compile-time exception thrown when when wrong arguments were passed to function Compiler::CfgNestedExpressionFunction.

See also
Manual chapter 10. Nested Expressions.
NestedExpressionNotFoundET 

Evaluation-time exception thrown when a named nested expression which is searched only at evaluation-time could not be found.
Overwrites exception NamedExpressionNotFound.

See also
Manual chapter 10. Nested Expressions.
WhenEvaluatingNestedExpression 

Informational exception entry (negative element value) providing the name of the expression that caused any other exception than NamedExpressionNotFound during evaluation of a nested expression.

Note that entries of this type might be repeated when expressions are recursively nested. The number of entries in the exception corresponds to the depth of nesting.

NestedExpressionResultTypeError 

Evaluation-time exception thrown when a named nested expression which was searched and found only at evaluation-time, returned a different result type than specified.

See also
Manual chapter 10. Nested Expressions.
CircularNestedExpressions 

Evaluation-time exception thrown when a circular relationship of nested expressions is detected, which comprises an infinite loop.

CircularNestedExpressionsInfo 

A list of informational entries of this type is given with exception CircularNestedExpressions. Each entry provides the name of the expression that was evaluated and the name of the nested expression that it called. Hence, the list of entries of this type comprise the "call stack" that leaded to the circular call that caused the exception.

InExpressionFormatter 

This is an extension entry added to exceptions that occur with compilation or evaluation of expressions by class util::ExpressionFormatter.

Definition at line 32 of file expressionscamp.hpp.

◆ Normalization

enum class Normalization : uint64_t
strong

Bitwise enum class defining options for formatting parsed expressions. The normalized conversion of the expression input string is available with method ExpressionVal::GetNormalizedString, after an expression was successfully compiled.

The normalization flags are stored per compiler instance, consequently using a public compiler field namely Compiler::CfgNormalization.

Enumerator
ReplaceFunctionNames 

Replace given shortened and letter case mismatched identifier and function names with completed versions.
This flag is set with DEFAULT.

ReplaceAliasOperators 

Replace alias operators with effective operators.
This flag is not set with DEFAULT.

ReplaceVerbalOperatorsToSymbolic 

This is one of four flags that together allow five possible normalization options for verbal alias operators. If more than one flag is set, the one with the highest precedence is used.

The following table lists the flags, their precedence and the type of normalization:

Precedence Flag Description
0 <none set> A verbal operator is normalized as given in original expression string.
1 ReplaceVerbalOperatorsToSymbolic Replaces verbal operators with the symbolic operator that they represent.
2 ReplaceVerbalOperatorsToLowerCase Converts verbal operators to lower case letters.
3 ReplaceVerbalOperatorsToUpperCase Converts verbal operators to upper case letters.
4 ReplaceVerbalOperatorsToDefinedLetterCase Uses the writing specified with the definition of the verbal operator.

With configuration DEFAULT, flag ReplaceVerbalOperatorsToUpperCase is set.

ReplaceVerbalOperatorsToLowerCase 

See sibling flag ReplaceVerbalOperatorsToSymbolic.

ReplaceVerbalOperatorsToUpperCase 

See sibling flag ReplaceVerbalOperatorsToSymbolic.

ReplaceVerbalOperatorsToDefinedLetterCase 

See sibling flag ReplaceVerbalOperatorsToSymbolic.

QuoteUnaryNestedExpressionOperatorArgument 

Converts nested expression names that have been given unquoted to a quoted string literal. If this is not set, the quotation remains as given in original expression string. This flag is not set with DEFAULT.

See also
Compilation flag AllowIdentifiersForNestedExpressions.
RemoveRedundantUnaryOpsOnNumberLiterals 

Remove redundant provisions unary operators '+' and '-' from number literals.
This flag is not set with DEFAULT.

UnaryOpSpace 

Write a space after an unary operator (if no brackets around arguments and no unary operator follows).
This flag is not set with DEFAULT.

UnaryOpSpaceIfUnaryFollows 

Write a space between two unary operators.
This flag is not set with DEFAULT.

UnaryOpSpaceIfBracketFollows 

Write a space before opening bracket of bracketed arguments of unary operators.
This flag is not set with DEFAULT.

UnaryOpInnerBracketSpace 

Write a space after an opening and before a closing bracket of arguments of unary operators.
This flag is not set with DEFAULT.

RedundantBracketsBetweenTwoUnaryOps 

If this flag is set, normalization inserts redundant brackets to the argument of an unary operator, if that argument is an unary operator itself.

This flag is superseded by RedundantUnaryOpBrackets.
This flag is not set with DEFAULT.

RedundantUnaryOpBrackets 

If this flag is set, normalization inserts redundant brackets to arguments of unary operators.

This flag supersedes by RedundantBracketsBetweenTwoUnaryOps.
This flag is not set with DEFAULT.

BinaryOpSpaces 

Write a space before and after binary operator symbol.
This flag is set with DEFAULT.

InnerBracketSpace 

Write a space after an opening and before a closing bracket of arguments of binary operators and around a conditional expression.
This flag is not set with DEFAULT.

OuterBracketSpace 

Write a space before opening and after closing bracket of arguments of binary operators and around a conditional expression.
This flag is not set with DEFAULT.

RedundantRhsBracketsIfRhsIsStrongerBinaryOp 

If this flag is set, normalization inserts redundant brackets to the right-hand side operand of binary operators if that operand is a binary operator itself and has a higher precedence.

The following samples demonstrate why this is useful if normalization targets humans:

Without flag set With flag set
1 - 2 - 3 no change
1 - 2 * 3 1 - (2 * 3)
1 * 2 - 3 no change
1 - 2 * 3 - 4 - 5 * 6 - 7 1 - (2 * 3) - 4 - (5 * 6) - 7
true == false && true no change
true && false == true true && (false == true)
true && false == false && true true && (false == false) && true
true && false == (false && true) true && (false == (false && true))
true && false == true < false true && (false == (true < false))
true && false == false == true true && (false == false == true)

This flag is superseded by RedundantBinaryOpBrackets.
This flag is set with DEFAULT.

RedundantBracketsIfLhsAndRhsAreBinaryOps 

If this flag is set, normalization inserts redundant brackets to both operands of binary operators if both are binary operators themselves.

The following samples demonstrate why this is useful if normalization strings target humans:

Without flag set With flag set
1 - 2 - 3 no change
1 - 2 - 3 - 4 no change
1 - 2 - (3 - 4) (1 - 2) - (3 - 4)
1 - 2 - 3 - (4 - 5) (1 - 2 - 3) - (4 - 5)
1 - 2 - (3 - 4) - 5 (1 - 2) - (3 - 4) - 5

This flag is superseded by RedundantBinaryOpBrackets.
This flag is set with DEFAULT.

RedundantBinaryOpBrackets 

If this flag is set, normalization inserts redundant brackets around each binary operator sub-expression. This flag supersedes flags RedundantRhsBracketsIfRhsIsStrongerBinaryOp and RedundantBracketsIfLhsAndRhsAreBinaryOps.

It is not recommended to set this flag. It is only useful to debug expressions and understand exactly what precedences operators have.

This flag is set with DEFAULT.

ConditionalOpSpaceBeforeQM 

Write a space before character ? of ternary conditional operator.
This flag is set with DEFAULT.

ConditionalOpSpaceAfterQM 

Write a space after character ? of a ternary conditional operator.
This flag is set with DEFAULT.

ConditionalOpSpaceBeforeColon 

Write a space before character : of ternary conditional operator.
This flag is set with DEFAULT.

ConditionalOpSpaceAfterColon 

Write a space after character : of ternary conditional operator.
This flag is set with DEFAULT.

RedundantConditionalOpBrackets 

If this flag is set, normalization inserts redundant brackets around the conditional operator expressions Q ? T : F, if it is not the root node.

This flag is set with DEFAULT.

FunctionSpaceBeforeOpeningBracket 

Write a space before between the function identifier name and the opening bracket of the argument list.
This flag is not set with DEFAULT.

FunctionInnerBracketSpace 

Write a space after the opening and before the closing bracket of argument list of a function.
This flag is set with DEFAULT.

FunctionInnerBracketSpaceIfNoArguments 

Write a space between the opening and the closing bracket of an empty argument list of a function.
This flag is set with DEFAULT.

FunctionSpaceBeforeComma 

Write a space before a comma of an argument separator of an function's argument list.
This flag is not set with DEFAULT.

FunctionSpaceAfterComma 

Write a space after a comma of an argument separator of a function's argument list.
This flag is set with DEFAULT.

SubscriptSpaceBeforeBrackets 

Write a space before array subscript operator '[]'.
This flag is not set with DEFAULT.

SubscriptInnerBracketSpace 

Write a space after the opening and before the closing bracket of array subscript operator '[]'.
This flag is not set with DEFAULT.

KeepScientificFormat 

If this flag is set, floating point literals are normalized in scientific format when given in scientific format. If it is not set, then numbers given in scientific format might be written as usual floating point values, dependent on their value. E.g. a given 1.0e1 would be converted to 10.0.

Note that scientific format can be forced for all floating point number output by setting flag ForceScientific in field Flags of variable Formatter::DefaultNumberFormat, which in turn is found in member Compiler::CfgFormatter. Such setting would supersede this flag.

This flag is not set with DEFAULT.

ForceHexadecimal 

If this flag is set, integral literals will be normalized to hexadecimal format. If this flag is not set, then integrals will be normalized in the number system that they had been provided in.

This flags supersedes flags ForceOctal and ForceBinary.

This flag is not set with DEFAULT.

ForceOctal 

If this flag is set, integral literals will be normalized to octal format. If this flag is not set, then integrals will be normalized in the number system that they had been provided in.

This flags is superseded by flag ForceHexadecimal and supersedes flag ForceBinary.

This flag is not set with DEFAULT.

ForceBinary 

If this flag is set, integral literals will be normalized to binary format. If this flag is not set, then integrals will be normalized in the number system that they had been provided in.

This flags is superseded by flags ForceHexadecimal and ForceOctal.

This flag is not set with DEFAULT.

NONE 

All flags are cleared, may be used for testing bits.

COMPACT 

All flags are cleared, hence no whitespaces and unnecessary brackets are written and identifiers as they have been given (potentially abbreviated and ignoring letter case).

DEFAULT 

Default value. Evaluates to:
ReplaceFunctionNames +
ReplaceVerbalOperatorsToUpperCase +

RemoveRedundantUnaryOpsOnNumberLiterals +
BinaryOpSpaces +
RedundantRhsBracketsIfRhsIsStrongerBinaryOp +
RedundantBracketsIfLhsAndRhsAreBinaryOps +

ConditionalOpSpaceBeforeQM +
ConditionalOpSpaceBeforeColon +
ConditionalOpSpaceAfterQM +
ConditionalOpSpaceAfterColon +
RedundantConditionalOpBrackets +

FunctionInnerBracketSpace +
FunctionSpaceAfterComma +

Definition at line 673 of file expressionscamp.hpp.