8#ifndef HPP_ALIB_EXPRESSIONS_COMPILER
9#define HPP_ALIB_EXPRESSIONS_COMPILER
22namespace alib {
namespace expressions {
78 using Plugins= std::vector<lang::PluginContainer<CompilerPlugin, CompilePriorities>::Slot>;
131 alib::hash_string_ignore_case<character>,
141 alib::hash_string_ignore_case<character>,
154 if( op.Equals<
NC>( symbol ) )
155 ALIB_ASSERT_ERROR(
false,
"EXPR",
"Unary operator {!Q'} already defined.", symbol )
183 "Binary operator {!Q'} already defined.", symbol )
200 "Unknown binary operator {!Q'}.", symbol )
204 "Unknown binary operator {!Q'} which was aliased by {!Q'}.",
205 aliasOp->second, symbol )
551DOX_MARKER([DOX_MANUAL_ALIASES_COMPILER])
556DOX_MARKER([DOX_MANUAL_ALIASES_COMPILER])
void AddBinaryOperator(const String &symbol, int precedence)
HashMap< MonoAllocator, String, String, alib::hash_string_ignore_case< character >, alib::equal_to_string_ignore_case< character > > AlphabeticUnaryOperatorAliases
virtual ALIB_API Expression Compile(const String &expressionString)
StringVectorMA CfgNormalizationDisallowed
std::vector< lang::PluginContainer< CompilerPlugin, CompilePriorities >::Slot > Plugins
Alias shortcut to the type of the plug-in vector inherited from PluginContainer.
HashMap< MonoAllocator, String, String, alib::hash_string_ignore_case< character >, alib::equal_to_string_ignore_case< character > > AlphabeticBinaryOperatorAliases
ALIB_API NString TypeName(Type box)
String CfgNestedExpressionOperator
ExpressionRepository * Repository
HashMap< MonoAllocator, String, int > BinaryOperators
List< MonoAllocator, String > UnaryOperators
int GetBinaryOperatorPrecedence(const String &symbol)
HashMap< MonoAllocator, TypeFunctors::Key, NAString, TypeFunctors::Hash, TypeFunctors::EqualTo > typeMap
The map of Type names and bit flag values.
ALIB_API void AddType(Type sample, const NString &name)
ALIB_API void getOptimizedExpressionString(ExpressionVal &expression)
bool RemoveNamed(const String &name)
HashMap< MonoAllocator, AString, Expression, std::hash< String >, std::equal_to< String > > namedExpressions
The map of 'named' expressions.
Compilation CfgCompilation
Compilation flags.
strings::util::Token CfgNestedExpressionFunction
detail::Parser * parser
The expression parser.
virtual ALIB_API bool AddNamed(const String &name, const String &expressionString)
MonoAllocator & GetAllocator()
Normalization CfgNormalization
String CfgNestedExpressionThrowIdentifier
ALIB_API void WriteFunctionSignature(Box **boxArray, size_t qty, AString &target)
ALIB_API void SetupDefaults()
virtual ALIB_API ~Compiler()
Destructor.
@ AutoCast
Installs plugins::AutoCast.
@ IF_ALIB_CAMP
Installs plugins::DateAndTime. )
@ ALL
Installs all plug-ins.
@ Arithmetics
Installs plugins::Arithmetics.
@ Strings
Installs plugins::Strings.
@ Math
Installs plugins::Math.
@ NONE
Installs no plug-in.
@ ElvisOperator
Installs plugins::ElvisOperator.
virtual ALIB_API Scope * createCompileTimeScope(MonoAllocator &expressionAllocator)
BuiltInPlugins CfgBuiltInPlugins
virtual ALIB_API Expression GetNamed(const String &name)
void AddUnaryOperator(const String &symbol)
virtual bool Get(const String &identifier, AString &target)=0
virtual ~ExpressionRepository()
Virtual destructor.
#define ALIB_ENUMS_MAKE_BITWISE(TEnum)
#define ALIB_ASSERT_ERROR(cond,...)
StdVectorMono< Box >::iterator ArgIterator
@ DateAndTime
Collection of date and time functions based on alib::time.
expressions::Expression Expression
Type alias in namespace alib.
strings::TAString< character, lang::HeapAllocator > AString
Type alias in namespace alib.
strings::TAString< nchar, lang::HeapAllocator > NAString
Type alias in namespace alib.
monomem::TMonoAllocator< lang::HeapAllocator > MonoAllocator
strings::TString< character > String
Type alias in namespace alib.
constexpr String NULL_STRING
A nulled string of the default character type.
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.
This detail class constitutes an abstract base class for expression parsers.