engine
 
载入中...
搜索中...
未找到
函数
ExpressionParser 命名空间参考

Define some expression types for basic arithmetic 更多...

函数

CORE_API CompileResultType Compile (const TCHAR *InExpression, const FTokenDefinitions &TokenDefinitions, const FExpressionGrammar &InGrammar)
 Compile the specified expression into an array of Reverse-Polish order nodes for evaluation, according to our grammar definition
 
CORE_API CompileResultType Compile (TArray< FExpressionToken > InTokens, const FExpressionGrammar &InGrammar)
 Compile the specified tokens into an array of Reverse-Polish order nodes for evaluation, according to our grammar definition
 
CORE_API TOptional< FExpressionError > ConsumeLocalizedNumber (FExpressionTokenConsumer &Consumer)
 Consume a localized number from the specified consumer's stream, if one exists at the current read position
 
CORE_API TOptional< FExpressionError > ConsumeLocalizedNumberWithAgnosticFallback (FExpressionTokenConsumer &Consumer)
 Consume a localized number from the specified consumer's stream, if one exists at the current read position
 
CORE_API TOptional< FExpressionError > ConsumeNumber (FExpressionTokenConsumer &Consumer)
 Consume a number from the specified consumer's stream, if one exists at the current read position
 
CORE_API TOptional< FExpressionError > ConsumeNumberWithRules (FExpressionTokenConsumer &Consumer, const FDecimalNumberFormattingRules &InFormattingRules)
 Consume a number formatted using the given rules from the specified consumer's stream, if one exists at the current read position
 
template<typename TSymbol >
TOptional< FExpressionError > ConsumeSymbol (FExpressionTokenConsumer &Consumer)
 Consume a symbol from the specified consumer's stream, if one exists at the current read position
 
CORE_API FExpressionResult Evaluate (const TArray< FCompiledToken > &CompiledTokens, const IOperatorEvaluationEnvironment &InEnvironment)
 Evaluate the specified pre-compiled tokens using an evaluation environment
 
CORE_API FExpressionResult Evaluate (const TCHAR *InExpression, const FTokenDefinitions &InTokenDefinitions, const FExpressionGrammar &InGrammar, const IOperatorEvaluationEnvironment &InEnvironment)
 Evaluate the specified expression using the specified token definitions, grammar definition, and evaluation environment
 
template<typename ContextType >
FExpressionResult Evaluate (const TCHAR *InExpression, const FTokenDefinitions &InTokenDefinitions, const FExpressionGrammar &InGrammar, const TOperatorJumpTable< ContextType > &InJumpTable, const ContextType *InContext=nullptr)
 Templated versions of evaluation functions used when passing a specific jump table and context
 
CORE_API const FDecimalNumberFormattingRules & GetLocalizedNumberFormattingRules ()
 Get the default set number formatting rules based on the current locale and user settings
 
CORE_API LexResultType Lex (const TCHAR *InExpression, const FTokenDefinitions &TokenDefinitions)
 Lex the specified string, using the specified grammar
 
CORE_API TOptional< FStringToken > ParseLocalizedNumber (const FTokenStream &InStream, FStringToken *Accumulate=nullptr, double *OutValue=nullptr)
 Parse a localized number from the given stream, optionally from a specific read position
 
CORE_API TOptional< FStringToken > ParseLocalizedNumberWithAgnosticFallback (const FTokenStream &InStream, FStringToken *Accumulate=nullptr, double *OutValue=nullptr)
 Parse a localized number from the given stream, optionally from a specific read position
 
CORE_API TOptional< FStringToken > ParseNumber (const FTokenStream &InStream, FStringToken *Accumulate=nullptr, double *OutValue=nullptr)
 Parse a number from the given stream, optionally from a specific read position
 
CORE_API TOptional< FStringToken > ParseNumberWithFallback (const FTokenStream &InStream, const FDecimalNumberFormattingRules &InPrimaryFormattingRules, const FDecimalNumberFormattingRules &InFallbackFormattingRules, FStringToken *Accumulate=nullptr, double *OutValue=nullptr)
 Parse a number formatted using the given rules from the given stream, optionally from a specific read position
 
CORE_API TOptional< FStringToken > ParseNumberWithRules (const FTokenStream &InStream, const FDecimalNumberFormattingRules &InFormattingRules, FStringToken *Accumulate=nullptr, double *OutValue=nullptr)
 Parse a number formatted using the given rules from the given stream, optionally from a specific read position
 

详细描述

Define some expression types for basic arithmetic

An expression parser, responsible for lexing, compiling, and evaluating expressions.

The parser supports 3 functions:

  1. Lexing the expression into a set of user defined tokens,
  2. Compiling the tokenized expression to an efficient reverse-polish execution order,
  3. Evaluating the compiled tokens

See ExpressionParserExamples.cpp for example usage.