ALib C++ Library
Library Version: 2511 R0
Documentation generated by doxygen
Loading...
Searching...
No Matches
compiler.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 \ref mainpage_license "Boost Software License".
7//==================================================================================================
8
9ALIB_EXPORT namespace alib { namespace expressions {
10
11// forwards
12namespace detail { struct Parser; }
13struct CompilerPlugin;
14
15//==================================================================================================
16/// An implementation of this abstract interface class may be attached to field
17/// \alib{expressions;Compiler::Repository} to enable an \e automated definition and retrieval
18/// of expression strings of nested expressions.
19///
20/// A default implementation, which uses typical \alib mechanics to define expression
21/// strings, is given with class \alib{expressions;StandardRepository}.
22///
23/// More information about automated nested expressions and the use of this interface class is
24/// provided with manual chapter \ref alib_expressions_nested_config.
25//==================================================================================================
27{
28 public:
29 /// Virtual destructor.
31
32 /// This method is called during compilation of expressions in the case a named expression
33 /// is not found by method \alib{expressions;Compiler::GetNamed}.
34 ///
35 /// @param identifier The name of the required expression.
36 /// @param[out] target The target to write the requested expression string to.
37 /// @return \c true, if the expression string could be retrieved, \c false otherwise.
38 /// If \c true is returned and \p{target} is still empty, then the string is defined
39 /// to be empty, which throws an exception on compilation.
40 virtual bool Get( const String& identifier, AString& target ) =0;
41};
42
43//==================================================================================================
44/// This is a central class of library module \alib_expressions_nl used to compile
45/// expression strings.
46///
47/// For information about general use and features of this class consult the
48/// \ref alib::expressions "ALib Expressions User Manual".
49///
50/// ## Friends ##
51/// class \alib{expressions;ExpressionVal}
52//==================================================================================================
53class Compiler : public lang::PluginContainer<CompilerPlugin, CompilePriorities>
54{
55 #if !DOXYGEN
56 friend class ExpressionVal;
57 friend struct detail::Parser;
58 friend class detail::ProgramBase;
59 #endif
60
61 public:
62 /// Alias shortcut to the type of the plug-in vector inherited from \b %PluginContainer.
63 using Plugins= std::vector<lang::PluginContainer<CompilerPlugin, CompilePriorities>::Slot>;
64
65 //################################################################################################
66 // internal fields
67 //################################################################################################
68 protected:
69 /// Memory for used for permanent allocations during the set-up phase.
70 /// Later it is also used for temporary allocations during compilation and reset to its
71 /// state after setup.
73
74 /// The expression parser.
76
77 /// The map of Type names and bit flag values.
82
83 /// The map of 'named' expressions.
86 std::hash <String>,
87 std::equal_to<String> > namedExpressions;
88
89
90 //################################################################################################
91 // Public fields
92 //################################################################################################
93 public:
94
95 /// The list of unary operators.
96 /// To define a new unary operator, method #AddUnaryOperator should be used.
97 /// In debug-builds, the methods asserts that no double insertions are performed.
98 ///
99 /// Custom insertions may be performed before or after invoking #SetupDefaults,
100 /// but before a first expression is compiled.
101 ///
102 ///
103 /// Flag \alib{expressions;Compilation::DefaultUnaryOperators} controls if method
104 /// \b %SetupDefaults adds operators resourced with enumeration
105 /// \alib{expressions;DefaultUnaryOperators}.
107
108 /// This public map allows defining alias names for unary operators. Such names
109 /// must consist only of alphabetic characters.
110 ///
111 /// Flag \alib{expressions;Compilation::DefaultAlphabeticOperatorAliases} controls if method
112 /// #SetupDefaults adds the aliases defined with resourced data records of enumeration
113 /// \alib{expressions;DefaultAlphabeticUnaryOperatorAliases} to this map.
115 String, String,
116 alib::hash_string_ignore_case<character>,
117 alib::equal_to_string_ignore_case<character> > AlphabeticUnaryOperatorAliases;
118
119 /// This public map allows defining alias names for binary operators. Such names
120 /// must consist only of alphabetic characters.
121 ///
122 /// Flag \alib{expressions;Compilation::DefaultAlphabeticOperatorAliases} controls if method
123 /// #SetupDefaults adds the aliases defined with resourced data records of enumeration
124 /// \alib{expressions;DefaultAlphabeticBinaryOperatorAliases} to this map.
126 alib::hash_string_ignore_case<character>,
127 alib::equal_to_string_ignore_case<character> > AlphabeticBinaryOperatorAliases;
128
129 /// Adds an unary operator to this expression compiler.
130 /// This method should be invoked before invoking #SetupDefaults.
131 ///
132 /// Operator symbols must be added only once.
133 ///
134 /// @param symbol The operator symbol.
135 void AddUnaryOperator( const String& symbol ) {
136 #if ALIB_DEBUG
137 for( auto& op : UnaryOperators )
138 if( op.Equals<NC>( symbol ) )
139 ALIB_ASSERT_ERROR( false, "EXPR", "Unary operator '{}' already defined.",
140 symbol )
141 #endif
142 UnaryOperators.emplace_back(symbol);
143 }
144
145
146 /// The list of binary operators. The map stores the precedences.
147 ///
148 /// To define a new binary operator, entry may be added before invoking #SetupDefaults
149 /// using method #AddBinaryOperator.
150 ///
151 /// Flag \alib{expressions;Compilation::DefaultUnaryOperators} controls if method
152 /// \b %SetupDefaults adds operators resourced with enumeration
153 /// \alib{expressions;DefaultBinaryOperators}.
155
156 /// Adds a binary operator to this expression compiler.
157 /// This method should be invoked before invoking #SetupDefaults.
158 ///
159 /// Operator symbols must be added only once.
160 ///
161 /// @param symbol The operator symbol.
162 /// @param precedence The precedence of the operator.
163 void AddBinaryOperator( const String& symbol, int precedence ) {
164 ALIB_DBG( auto result= )
165 BinaryOperators.EmplaceOrAssign(symbol, precedence);
166 ALIB_ASSERT_ERROR( result.second == true, "EXPR", // was inserted
167 "Binary operator '{}' already defined.", symbol )
168 }
169
170 /// Returns the precedence of given operator \b symbol.
171 ///
172 /// @param symbol The operator symbol.
173 /// @return The precedence of the operator as defined with #AddBinaryOperator.
174 int GetBinaryOperatorPrecedence( const String& symbol ) {
175 // search in operator table first
176 auto it= BinaryOperators.Find( symbol );
177 if( it != BinaryOperators.end() )
178 return it.Mapped();
179
180 // have an alias?
181 auto aliasOp= AlphabeticBinaryOperatorAliases.Find( symbol );
182 ALIB_ASSERT_ERROR( aliasOp != AlphabeticBinaryOperatorAliases.end(), "EXPR",
183 "Unknown binary operator '{}'.", symbol )
184
185 it= BinaryOperators.Find( aliasOp.Mapped() );
186 ALIB_ASSERT_ERROR( it != BinaryOperators.end(), "EXPR",
187 "Unknown binary operator '{}' which was aliased by '{}'.",
188 aliasOp->second, symbol )
189 return it.Mapped();
190 }
191
192
193 /// \alib{enumops;BitwiseTraits;Bitwise enum class} that lists the plug-ins built-into
194 /// \alib expression library. This bitfield is used with method #SetupDefaults, which
195 /// reads the flags set in #CfgBuiltInPlugins and installs the plug-ins accordingly.
196 enum class BuiltInPlugins
197 {
198 NONE = 0, ///< Installs no plug-in.
199 ALL = -1, ///< Installs all plug-ins.
200 ElvisOperator = (1 << 1), ///< Installs \alib{expressions;plugins::ElvisOperator}.
201 AutoCast = (1 << 2), ///< Installs \alib{expressions;plugins::AutoCast}.
202 Arithmetics = (1 << 3), ///< Installs \alib{expressions;plugins::Arithmetics}.
203 Math = (1 << 4), ///< Installs \alib{expressions;plugins::Math}.
204 Strings = (1 << 5), ///< Installs \alib{expressions;plugins::Strings}.
206 DateAndTime = (1 << 6), ) ///< Installs \alib{expressions;plugins::DateAndTime}. )
207 };
208
209
210 /// Bitfield that defines the built-in compiler plug-ins that are created and inserted
211 /// by method #SetupDefaults.
212 ///
213 /// Defaults to \alib{expressions::Compiler;BuiltInPlugins::ALL}
214 ///
215 /// \note
216 /// The built-in plug-ins are allowed to be shared by different compiler instances.
217 /// To reach that, they must not be disabled here (or method #SetupDefaults must be
218 /// omitted) and instead created once and registered with the compiler using
219 /// inherited method \alib{lang::PluginContainer::InsertPlugin}. In that case, parameter
220 /// \p{responsibility} of that method has to be provided as
221 /// \c Responsibility::KeepWithSender.
223
224 /// The operator defined in this public field is used to address nested expressions.
225 /// The operator used can be customized to any defined (!) unary operator.
226 ///
227 /// To disable nested expression parsing, change to empty or \e nulled string.
228 ///
229 /// \note
230 /// If changed, the change hast to be made \b before invoking #SetupDefaults. Otherwise,
231 /// the default configuration for
232 /// \ref alib_expressions_operators_verbal "verbal operator aliases" would be set in
233 /// effect to a wrong (or disabled) target operator.
234 ///
235 /// Defaults to \c "*".
236 ///
237 /// \see Manual chapter \ref alib_expressions_nested "10. Nested Expressions".
238 ///
240
241 /// Name descriptor for nested expression function.
242 /// Defaults to "Expression" with a minimum abbreviation of \c 4 characters, ignoring letter
243 /// case.<br>
244 /// Resourced with the key \c "EF"
245 ///
246 /// \see Manual chapter \ref alib_expressions_nested "10. Nested Expressions".
248
249 /// Keyword used with optional third parameter of expression function.
250 /// Defaults to \c "throw". Resourced with key \c "EF"
251 ///
252 /// \see Manual chapter \ref alib_expressions_nested "10. Nested Expressions".
254
255 /// Compilation flags.
257
258 /// Flags that allow to tweak the result of the normalization of the originally parsed
259 /// expression string.
261
262 /// This list is used with the normalization of the expression string. It contains
263 /// strings, which are not allowed to appear in normalized expression strings.
264 ///
265 /// In the current library version, such strings might occur only if flags
266 /// \alib{expressions;Normalization::UnaryOpSpace},
267 /// \alib{expressions;Normalization::UnaryOpSpaceIfUnaryFollows} or
268 /// \alib{expressions;Normalization::BinaryOpSpaces} are not set.
269 /// As a sample see expression:
270 ///
271 /// 1 - -2
272 ///
273 /// If no space is written after binary operators, this expression would be normalized
274 /// to:
275 /// 1--2
276 ///
277 /// While this just looks irritating to a homo sapiens, it would be even illegal if
278 /// well known C++ operator <c>--</c> was supported. Therefore, string <c>"--"</c> is added
279 /// to this map in method #SetupDefaults, which forces the normalization logic to insert
280 /// a space, even if spaces are otherwise configured to be omitted.
282
283 /// Formatter used throughout all phases of the life-cycle of an expression:
284 /// - Used for parsing expression strings (Using the encapsulated
285 /// \alib{strings;TNumberFormat;NumberFormat} object. This is also the reason, why the type
286 /// of formatter is \b %Formatter and not its more abstract base \b %Formatter.)
287 /// - Used for the generation of the normalized expression strings.
288 /// - Used for the generation of constant string objects during compilation.
289 /// - Used for the generation of string objects during evaluation.
290 ///
291 /// For the latter two, a copy of the pointer is provided through field
292 /// \doxlinkproblem{structalib_1_1expressions_1_1Scope.html;aebf2cd4ff8a2611de06368fccfd3ef5b;Scope::Formatter;expressions::Scope::Formatter}.
293 /// It is important not to change the formatting parameters in between the creation of the
294 /// compile-time scope and the creation of the evaluation-time scope. If done,
295 /// the expression results could differ when optimizations during compilation are performed.
296 ///
297 /// In the constructor of this class, a \alib{format;Formatter::Clone;clone} of the
298 /// \alib {format::Formatter;Default;default formatter} is copied here.
300
301 /// Optional pointer to a default or custom implementation of a repository that provides
302 /// expression strings for named nested expressions.
303 ///
304 /// \see Manual chapter \ref alib_expressions_nested_config.
306
307 //################################################################################################
308 // Public Interface
309 //################################################################################################
310 public:
311 /// Constructor. Construction usually is three steps:
312 /// 1. Create class instance
313 /// 2. Set the various configuration options (fields prefixed <c>Cfg</c>).
314 /// 3. Invoke #SetupDefaults.
316
317 /// Destructor
319 virtual ~Compiler();
320
321 /// Registers a (custom) type name with this compiler. The name will be used to
322 /// display a type name to end-users, for example, when malformed expressions throw an
323 /// exception.
324 ///
325 /// The built-in types get registered in the constructor of the compiler, where the
326 /// type names are read from the \alib{resources;ResourcePool} of static library object
327 /// \alib{EXPRESSIONS}.
328 ///
329 /// It is recommended that custom plug-ins invoke this method in their constructor.
330 ///
331 /// \note
332 /// There is no general need to register types for using them
333 /// with \alib_expressions_nl. Parameter \p{name} of this method is exclusively
334 /// used to generate textual, human-readable output!
335 ///
336 /// @param sample A \ref alib_expressions_prereq_sb "sample value"
337 /// of the type, which is implicitly boxed when passed.
338 /// @param name The name of the type.
340 void AddType(Type sample, const NString& name);
341
342 /// Returns the name of the type of the boxed value.
343 /// Note that custom types need to be registered with method #AddType.
344 ///
345 /// If given argument \p{box} is \ref alib_boxing_more_void_void "a void box", the returned
346 /// string is <b>"NONE"</b>.
347 ///
348 /// @param box The box to receive the type name for.
349 /// @return The type name as string.
351 NString TypeName(Type box);
352
353 /// Writes the signature of a function (as, for example, found in
354 /// \alib{expressions::plugins;Calculus::FunctionEntry}) to a string buffer.
355 ///
356 /// @param boxArray The start of the array of pointers.
357 /// @param qty The array's length.
358 /// @param target The string to write into.
360 void WriteFunctionSignature( Box** boxArray, size_t qty, AString& target );
361
362 /// Writes the signature of an argument list to a string buffer.
363 ///
364 /// @param begin Iterator to the first argument.
365 /// @param end End-iterator.
366 /// @param target The string to write into.
369 ArgIterator end,
370 AString& target );
371
372 /// Completes construction according to configuration options provided with fields
373 /// prefixed <c>Cfg</c>.
374 /// In detail, the following actions are performed:
375 /// - If flag \alib{expressions;Compilation::DefaultUnaryOperators} is set in field
376 /// #CfgCompilation, then
377 /// - the unary operators listed in the \ref alib_enums_records "enum records" of
378 /// \alib{expressions;DefaultUnaryOperators} are added using #AddUnaryOperator.
379 /// - If flag \alib{expressions;Compilation::DefaultAlphabeticOperatorAliases} is set in
380 /// field #CfgCompilation, then the alphabetic alias names found in
381 /// the data records of enumeration
382 /// \alib{expressions;DefaultAlphabeticUnaryOperatorAliases}
383 /// are set in field #AlphabeticUnaryOperatorAliases. (As of the current version this
384 /// is only the token \b NOT aliasing operator <b>"!"</b>.
385 /// - If flag \alib{expressions;Compilation::DefaultBinaryOperators} is set in field
386 /// #CfgCompilation, then
387 /// - the binary operators listed in the data records of enumeration
388 /// \alib{expressions;DefaultBinaryOperators} are added using #AddBinaryOperator.
389 /// - If flag \alib{expressions;Compilation::AllowSubscriptOperator} is not set, the
390 /// subscript operator is omitted.
391 /// - If flag \alib{expressions;Compilation::DefaultAlphabeticOperatorAliases} is set in
392 /// field #CfgCompilation, then the alphabetic alias names found in
393 /// the data records of enumeration
394 /// \alib{expressions;DefaultAlphabeticBinaryOperatorAliases}
395 /// are set in field #AlphabeticBinaryOperatorAliases. (As of the current version this
396 /// is only the token \b NOT aliasing operator <b>"!"</b>.
397 /// - Strings <b>"++"</b> and <b>"--"</b> are added to field #CfgNormalizationDisallowed
398 /// to prevent the unintentional creation of these potential operators in normalizations.
399 /// (This way, a space character will be added between binary <b>"+"</b> and unary
400 /// <b>"+"</b>, respectively binary <b>"-"</b> and unary <b>"-"</b> operators,
401 /// even if the normalization options do not suggest to do this.
402 /// - Depending on the flags set in #CfgBuiltInPlugins, the plug-ins listed in
403 /// enumeration #BuiltInPlugins are created and added.
405 void SetupDefaults();
406
407 /// Firstly, this method parses the given expression string thereby builds an intermediate
408 /// internal \alib{expressions;detail::AST;abstract syntax tree}.
409 /// This tree is then translated into a \alib{expressions;detail::Program} which evaluates
410 /// the expression in respect to a \alib{expressions;Scope} when executed.
411 ///
412 /// For building the program, attached \alib{expressions;CompilerPlugin} instances
413 /// are queried.
414 ///
415 /// During this process, a \alib{expressions;Normalization;normalized} version of the input
416 /// string is always created. While the original input string can
417 /// be accessed with \alib{expressions;ExpressionVal::GetOriginalString}, the normalized
418 /// version can be retrieved after the compilation with method
419 /// \alib{expressions;ExpressionVal::GetNormalizedString}. During compilation, the
420 /// normalization rules (flags) stored in field #CfgNormalization are applied.
421 ///
422 /// For compilation, a compile-time scope object is created by calling the virtual method
423 /// #createCompileTimeScope. If not overwritten, a standard scope object is used.
424 /// If custom callbacks exists that are invokable at compile-time
425 /// (to perform program optimization) and that at the same time rely on custom mechanics
426 /// provided with a custom scope class, then a custom, derived version of this class
427 /// has to be used that overrides method #createCompileTimeScope accordingly.
428 ///
429 /// @param expressionString The string to parse.
430 /// @return A shared pointer to the compiled expression. Contains \c nullptr on failure.
431 virtual ALIB_DLL
432 Expression Compile( const String& expressionString );
433
434 /// Compiles the given \p{expressionString} and adds a compiled expression to the map of
435 /// named expressions.
436 ///
437 /// @param name The name used to map the expression.
438 /// @param expressionString The string to parse.
439 /// If nulled, entry \p{name} is removed (if existing).
440 /// @return \c true if an expression with the same named existed and was replaced.
441 /// Otherwise, returns \c false.
442 virtual ALIB_DLL
443 bool AddNamed( const String& name, const String& expressionString );
444
445 /// Removes a named expression. This is just a shortcut to #AddNamed, providing
446 /// a nulled string for parameter \p{expressionString}.
447 ///
448 /// @param name The name of the expression to be removed.
449 /// @return \c true if an expression with the given name existed and was removed.
450 /// Otherwise, returns \c false.
451 bool RemoveNamed( const String& name ) { return AddNamed( name, NULL_STRING ); }
452
453 /// Returns a named expression previously defined using #AddNamed.
454 /// In the case that no expression with the given \p{name} was defined and optional interface
455 /// #Repository is set, then this interface is used to retrieve a corresponding expression
456 /// string and compile the named expression 'on the fly'.
457 ///
458 /// \see
459 /// Manual chapter \ref alib_expressions_nested_config.
460 ///
461 /// @param name The name of the expression.
462 /// @return In case of success a shared pointer to the expression.
463 virtual ALIB_DLL
464 Expression GetNamed( const String& name );
465
466 /// Provides access to the internal \alib{MonoAllocator}.
467 /// \note This method is deemed non-standard use of this class, and the using code needs to
468 /// knowing what to do.
469 /// @return The internal monotonous allocator.
471
472 //################################################################################################
473 // Protected Interface
474 //################################################################################################
475 protected:
476 /// This virtual method is called by #Compile to create the scope object used
477 /// for allocations that are made for intermediate results at compile-time.
478 ///
479 /// Compile-time allocations occur when expression terms that use purely constant arguments
480 /// are evaluated at compile-time. Such optimization consequently leads to the invocation
481 /// of callback functions at compile-time.
482 ///
483 /// If now, custom callback functions rely on custom allocation mechanics, provided with
484 /// custom scope types, then this method has to be overridden to return such a custom
485 /// scope object.
486 ///
487 /// @param expressionAllocator The allocator of the expression used to allocate the
488 /// compile-time scope.
489 /// @return The default implementation returns the standard scope object.
490 /// For its construction, the field #CfgFormatter is provided.<br>
491 /// Derived compilers may need to return a scope object of a derived type.
492 virtual ALIB_DLL
493 Scope* createCompileTimeScope(MonoAllocator& expressionAllocator);
494
495 /// Implements \alib{expressions;ExpressionVal::GetOptimizedString}.
496 ///
497 /// @param expression the expression to generate an optimized string for.
500};
501
502
503
504namespace detail {
505/// Base class exported by the main module \implude{Expressions} for technical reasons.
507 protected:
508 /// Friendship-access method used by derived implementation.
509 /// @param ev The expression to receive protected data from.
510 /// @return The expression's allocotor.
512
513 /// Friendship-access method used by derived implementation.
514 /// @param ev The expression to receive protected data from.
515 /// @return The expression's compile-time scope.
517
518 /// Friendship-access method used by derived implementation.
519 /// @param cmp The compiler to receive protected data from.
520 /// @return The compiler's plugins.
522};
523
524/// Base class exported by the main module \implude{Expressions} for technical reasons.
526 protected:
527 /// Friendship-access method used by derived implementation.
528 /// @param ev The expression to receive protected data from.
529 /// @return The expression's compile-time scope.
530 static Scope* getExpressionCTScope (ExpressionVal& ev) { return ev.ctScope; }
531};
532
533
534}
535
536} // namespace alib[::expressions]
537
538DOX_MARKER([DOX_MANUAL_ALIASES_COMPILER])
539/// Type alias in namespace \b alib.
541
542} // namespace [alib]
543DOX_MARKER([DOX_MANUAL_ALIASES_COMPILER])
544
bool RemoveNamed(const String &name)
Definition compiler.inl:451
Normalization CfgNormalization
Definition compiler.inl:260
ListMA< String > UnaryOperators
Definition compiler.inl:106
Compilation CfgCompilation
Compilation flags.
Definition compiler.inl:256
virtual ALIB_DLL Expression Compile(const String &expressionString)
Definition compiler.cpp:231
ALIB_DLL NString TypeName(Type box)
Definition compiler.cpp:415
StringVectorMA CfgNormalizationDisallowed
Definition compiler.inl:281
ALIB_DLL void WriteFunctionSignature(Box **boxArray, size_t qty, AString &target)
Definition compiler.cpp:428
virtual ALIB_DLL Expression GetNamed(const String &name)
Definition compiler.cpp:375
BuiltInPlugins CfgBuiltInPlugins
Definition compiler.inl:222
void AddBinaryOperator(const String &symbol, int precedence)
Definition compiler.inl:163
std::vector< lang::PluginContainer< CompilerPlugin, CompilePriorities >::Slot > Plugins
Alias shortcut to the type of the plug-in vector inherited from PluginContainer.
Definition compiler.inl:63
strings::util::Token CfgNestedExpressionFunction
Definition compiler.inl:247
virtual ALIB_DLL bool AddNamed(const String &name, const String &expressionString)
Definition compiler.cpp:344
ExpressionRepository * Repository
Definition compiler.inl:305
ALIB_DLL void getOptimizedExpressionString(ExpressionVal &expression)
Definition compiler.cpp:317
HashMap< MonoAllocator, String, int > BinaryOperators
Definition compiler.inl:154
ALIB_DLL void SetupDefaults()
Definition compiler.cpp:157
void AddUnaryOperator(const String &symbol)
Definition compiler.inl:135
@ AutoCast
Installs plugins::AutoCast.
Definition compiler.inl:201
@ IF_ALIB_CAMP
Installs plugins::DateAndTime. )
Definition compiler.inl:205
@ Arithmetics
Installs plugins::Arithmetics.
Definition compiler.inl:202
@ Strings
Installs plugins::Strings.
Definition compiler.inl:204
@ ElvisOperator
Installs plugins::ElvisOperator.
Definition compiler.inl:200
detail::Parser * parser
The expression parser.
Definition compiler.inl:75
virtual ALIB_DLL Scope * createCompileTimeScope(MonoAllocator &expressionAllocator)
Definition compiler.cpp:151
ALIB_DLL void AddType(Type sample, const NString &name)
Definition compiler.cpp:408
HashMap< MonoAllocator, AString, Expression, std::hash< String >, std::equal_to< String > > namedExpressions
The map of 'named' expressions.
Definition compiler.inl:87
HashMap< MonoAllocator, String, String, alib::hash_string_ignore_case< character >, alib::equal_to_string_ignore_case< character > > AlphabeticUnaryOperatorAliases
Definition compiler.inl:117
MonoAllocator & GetAllocator()
Definition compiler.inl:470
HashMap< MonoAllocator, lang::TypeFunctors::Key, NAString, lang::TypeFunctors::Hash, lang::TypeFunctors::EqualTo > typeMap
The map of Type names and bit flag values.
Definition compiler.inl:81
int GetBinaryOperatorPrecedence(const String &symbol)
Definition compiler.inl:174
virtual ALIB_DLL ~Compiler()
Destructor.
Definition compiler.cpp:149
HashMap< MonoAllocator, String, String, alib::hash_string_ignore_case< character >, alib::equal_to_string_ignore_case< character > > AlphabeticBinaryOperatorAliases
Definition compiler.inl:127
virtual bool Get(const String &identifier, AString &target)=0
virtual ~ExpressionRepository()
Virtual destructor.
Definition compiler.inl:30
Base class exported by the main module ALib.Expressions.H for technical reasons.
Definition compiler.inl:506
Scope * getExpressionCTScope(ExpressionVal &ev)
Definition compiler.inl:516
MonoAllocator & getExpressionAllocator(ExpressionVal &ev)
Definition compiler.inl:511
Compiler::PluginList & getCompilerPlugins(Compiler &cmp)
Definition compiler.inl:521
PluginList plugins
The plug-ins we have attached in descending priority order.
Definition plugins.inl:97
#define ALIB_DLL
Definition alib.inl:503
#define ALIB_ENUMS_MAKE_BITWISE(TEnum)
#define A_CHAR(STR)
#define ALIB_EXPORT
Definition alib.inl:497
#define ALIB_DBG(...)
Definition alib.inl:853
#define ALIB_ASSERT_ERROR(cond, domain,...)
Definition alib.inl:1066
@ DateAndTime
Collection of date and time functions based on alib::time.
const alib::boxing::Box & Type
StdVectorMA< Box >::iterator ArgIterator
constexpr String NULL_STRING
A nulled string of the default character type.
Definition string.inl:2271
strings::TAString< character, lang::HeapAllocator > AString
Type alias in namespace alib.
containers::List< T, MonoAllocator, TRecycling > ListMA
Type alias in namespace alib.
Definition list.inl:693
strings::util::TStringVector< character, MonoAllocator > StringVectorMA
Type alias in namespace alib.
strings::TString< nchar > NString
Type alias in namespace alib.
Definition string.inl:2198
strings::TAString< nchar, lang::HeapAllocator > NAString
Type alias in namespace alib.
containers::HashMap< TAllocator, TKey, TMapped, THash, TEqual, THashCaching, TRecycling > HashMap
Type alias in namespace alib.
monomem::TMonoAllocator< lang::HeapAllocator > MonoAllocator
boxing::Box Box
Type alias in namespace alib.
Definition box.inl:1149
containers::SharedPtr< format::Formatter > SPFormatter
Definition formatter.inl:42
strings::TString< character > String
Type alias in namespace alib.
Definition string.inl:2189
expressions::Compiler Compiler
Type alias in namespace alib.
Definition compiler.inl:540
This detail class constitutes an abstract base class for expression parsers.
Definition parser.inl:15
Base class exported by the main module ALib.Expressions.H for technical reasons.
Definition compiler.inl:525
static Scope * getExpressionCTScope(ExpressionVal &ev)
Definition compiler.inl:530
Comparison functor for type const std::type_info*.
Hash code functor for type const std::type_info*.
const ::std::type_info * Key
The key type.