6#include "Templates/PointerIsConvertibleFromTo.h"
7#include "Templates/UnrealTemplate.h"
8#include "Containers/Array.h"
9#include "Containers/UnrealString.h"
10#include "Templates/Function.h"
11#include "Containers/Set.h"
12#include "Containers/Map.h"
13#include "Misc/Optional.h"
14#include "Internationalization/Text.h"
15#include "Internationalization/Internationalization.h"
17#include "Templates/ValueOrError.h"
63 FStringToken(
const TCHAR* InStart, int32 Line = 0, int32 Character = 0)
94
95
96
97
98
159#define DEFINE_EXPRESSION_NODE_TYPE(TYPE, ...) template
160 <> struct TGetExpressionNodeTypeId<TYPE>\
161{
162 static const FGuid& GetTypeId()
164 static FGuid Global(__VA_ARGS__);
167};
168template<
typename T>
struct TGetExpressionNodeTypeId;
175
176
177
178
190 typename TEnableIf<!TPointerIsConvertibleFromTo<T, FExpressionNode>::Value>::Type* =
nullptr
204 const T*
Cast()
const;
228 :
Node(MoveTemp(InNode))
279template<
typename ContextType=
void>
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311 template<
typename OperatorType,
typename FuncType>
315
316
317
318 template<
typename OperatorType,
typename FuncType>
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352 template<
typename OperatorType,
typename FuncType>
355 template<
typename OperatorType,
typename FuncType>
376
377
389template<
typename ContextType =
void>
431
432
450
451
452
453
489
490
498
499
524 template<
typename TStartGroup,
typename TEndGroup>
528 template<
typename TExpressionNode>
532 template<
typename TExpressionNode>
536
537
538
539
540
541
542 template<
typename TExpressionNode>
583#include "Misc/ExpressionParserTypes.inl"
#define DEFINE_EXPRESSION_NODE_TYPE(TYPE,...)
typedef TOptional< FExpressionError >(FExpressionDefinition)(FExpressionTokenConsumer &)
TOperatorJumpTable FOperatorJumpTable
TOperatorEvaluationEnvironment FOperatorEvaluationEnvironment
TValueOrError< FExpressionNode, FExpressionError > FExpressionResult
TSet< FGuid > PostUnaryOperators
const FGuid * GetGrouping(const FGuid &TypeId) const
void DefinePreUnaryOperator()
TMap< FGuid, FGuid > Groupings
void DefineBinaryOperator(int32 InPrecedence, EAssociativity InAssociativity=EAssociativity::RightToLeft, bool bCanShortCircuit=false)
void DefinePostUnaryOperator()
bool HasPostUnaryOperator(const FGuid &TypeId) const
const FOpParameters * GetBinaryOperatorDefParameters(const FGuid &TypeId) const
TSet< FGuid > PreUnaryOperators
TMap< FGuid, FOpParameters > BinaryOperators
bool HasPreUnaryOperator(const FGuid &TypeId) const
const FGuid & GetTypeId() const
FExpressionNode(FExpressionNode &&In)
uint8 InlineBytes[MaxStackAllocationSize]
static constexpr uint32 MaxStackAllocationSize
FExpressionNode(T In, typename TEnableIf<!TPointerIsConvertibleFromTo< T, FExpressionNode >::Value >::Type *=nullptr)
FExpressionNode & operator=(FExpressionNode &&In)
Impl::IExpressionNodeStorage * GetData()
FExpressionNode Copy() const
const Impl::IExpressionNodeStorage * GetData() const
TArray< FExpressionToken > Extract()
FExpressionTokenConsumer(const FExpressionTokenConsumer &)
FExpressionTokenConsumer(const TCHAR *InExpression)
TArray< FExpressionToken > Tokens
void Add(const FStringToken &SourceToken, FExpressionNode &&Node)
FExpressionTokenConsumer & operator=(const FExpressionTokenConsumer &)
FTokenStream & GetStream()
FExpressionToken & operator=(FExpressionToken &&In)
FExpressionToken(const FStringToken &InContext, FExpressionNode InNode)
FExpressionToken(FExpressionToken &&In)
ARK_API FString(int32 Len, const WIDECHAR *Str)
int32 GetCharacterIndex() const
FStringToken(const TCHAR *InStart, int32 Line=0, int32 Character=0)
int32 GetLineNumber() const
const TCHAR * GetTokenStartPos() const
FString GetString() const
void Accumulate(const FStringToken &InToken)
const TCHAR * GetTokenEndPos() const
TArray< TFunction< FExpressionDefinition > > Definitions
void DefineToken(TFunction< FExpressionDefinition > &&Definition)
bool DoesIgnoreWhitespace()
TOptional< FExpressionError > ConsumeToken(FExpressionTokenConsumer &Consumer) const
TOptional< FExpressionError > ConsumeTokens(FExpressionTokenConsumer &Consumer) const
TOptional< FStringToken > ParseWhitespace(FStringToken *Accumulate=nullptr) const
const TCHAR * GetRead() const
TOptional< FStringToken > ParseSymbol(TCHAR Symbol, FStringToken *Accumulate=nullptr) const
int32 GetPosition() const
void SetReadPos(const FStringToken &Token)
TOptional< FStringToken > GenerateToken(int32 NumChars, FStringToken *Accumulate=nullptr) const
TOptional< FStringToken > ParseTokenIgnoreCase(const TCHAR *Symbol, FStringToken *Accumulate=nullptr) const
FTokenStream(const TCHAR *In)
const TCHAR * GetEnd() const
FString GetErrorContext() const
TOptional< FStringToken > ParseToken(const TCHAR *Symbol, FStringToken *Accumulate=nullptr) const
bool IsReadPosValid(const TCHAR *InPos, int32 MinNumChars=1) const
int32 CharsRemaining() const
TOptional< FStringToken > ParseToken(TFunctionRef< EParseState(TCHAR)> Pred, FStringToken *Accumulate=nullptr) const
TOptional< FStringToken > ParseSymbol(FStringToken *Accumulate=nullptr) const
TCHAR PeekChar(int32 Offset=0) const
const TCHAR * GetStart() const
FCompiledToken(EType InType, FExpressionToken InToken, TOptional< int32 > InShortCircuitIndex=TOptional< int32 >())
FCompiledToken(FCompiledToken &&In)
TOptional< int32 > ShortCircuitIndex
FCompiledToken & operator=(FCompiledToken &&In)
FExpressionError(const FText &InText)
friend bool operator==(const FGuid &X, const FGuid &Y)
FGuid(uint32 InA, uint32 InB, uint32 InC, uint32 InD)
friend uint32 GetTypeHash(const FGuid &Guid)
FOpParameters(int32 InPrecedence, EAssociativity InAssociativity, bool bInCanShortCircuit)
EAssociativity Associativity
friend bool operator==(const FOperatorFunctionID &A, const FOperatorFunctionID &B)
friend uint32 GetTypeHash(const FOperatorFunctionID &In)
virtual FExpressionResult ExecBinary(const FExpressionToken &Operator, const FExpressionToken &L, const FExpressionToken &R) const =0
virtual FExpressionResult ExecPostUnary(const FExpressionToken &Operator, const FExpressionToken &L) const =0
virtual FExpressionResult ExecPreUnary(const FExpressionToken &Operator, const FExpressionToken &R) const =0
virtual bool ShouldShortCircuit(const FExpressionToken &Operator, const FExpressionToken &L) const =0
virtual FExpressionResult ExecPostUnary(const FExpressionToken &Operator, const FExpressionToken &L) const override
virtual bool ShouldShortCircuit(const FExpressionToken &Operator, const FExpressionToken &L) const override
const TOperatorJumpTable< ContextType > & Operators
TOperatorEvaluationEnvironment(const TOperatorJumpTable< ContextType > &InOperators, const ContextType *InContext)
virtual FExpressionResult ExecPreUnary(const FExpressionToken &Operator, const FExpressionToken &R) const override
const ContextType * Context
virtual FExpressionResult ExecBinary(const FExpressionToken &Operator, const FExpressionToken &L, const FExpressionToken &R) const override
FExpressionResult ExecPreUnary(const FExpressionToken &Operator, const FExpressionToken &R, const ContextType *Context) const
TMap< FOperatorFunctionID, FUnaryFunction > PostUnaryOps
TMap< FOperatorFunctionID, FBinaryFunction > BinaryOps
void MapShortCircuit(FuncType InFunc)
TFunction< bool(const FExpressionNode &, const ContextType *Context) FShortCircuit)
bool ShouldShortCircuit(const FExpressionToken &Operator, const FExpressionToken &L, const ContextType *Context) const
void MapPostUnary(FuncType InFunc)
FExpressionResult ExecBinary(const FExpressionToken &Operator, const FExpressionToken &L, const FExpressionToken &R, const ContextType *Context) const
FExpressionResult ExecPostUnary(const FExpressionToken &Operator, const FExpressionToken &L, const ContextType *Context) const
void MapBinary(FuncType InFunc)
TFunction< FExpressionResult(const FExpressionNode &, const ContextType *Context) FUnaryFunction)
TMap< FOperatorFunctionID, FShortCircuit > BinaryShortCircuits
TMap< FOperatorFunctionID, FUnaryFunction > PreUnaryOps
TFunction< FExpressionResult(const FExpressionNode &, const FExpressionNode &, const ContextType *Context) FBinaryFunction)
void MapPreUnary(FuncType InFunc)