NaifyView\Dialect\Naify\NaifyExpressionEvaluator クラス

NaifyExpressionEvaluator — Naify dialect の Naify Expression Evaluator

Native template 構文の parser / evaluator / runtime contract を担当する。 Twig / Smarty 互換文化を混ぜず、Naify として持つ構文 surface をここで固定する。

使用例

// Naify dialect の parser / expression / runtime helper として使う。
// 通常は NaifyParser や compiler/executor から間接的に呼ばれる。

プロパティ

名前型説明
private $helperChainParser NaifyHelperChainParser helper/filter world parser
private $specialVariableRuntime NaifySpecialVariableRuntime `@naify.*` owner
private $callableRuntime NaifyCallableRuntime top-level callable provider owner
private $valueTransformRuntime NaifyValueTransformRuntime helper/filter/stringify owner
private $pathResolver NaifyExpressionPathResolver path traversal owner
private $stringScanner NaifyExpressionStringScanner quote/bracket/top-level scanner
private static $unwrapParenthesesCache array wrapped parentheses unwrap cache
private static $ternarySplitCache array
private static $splitTopLevelCache array top-level split cache
private static $argumentListCache array argument split cache
private static $pathPlanCache array

メソッド

メソッド説明
public __construct(?NaifyHelperChainParser $helperChainParser, ?NaifySpecialVariableRuntime $specialVariableRuntime, ?NaifyCallableRuntime $callableRuntime, ?NaifyValueTransformRuntime $valueTransformRuntime): void インスタンスを初期化する
public static clearProcessCaches(): void `clearProcessCaches()` をクリアする
public evaluate(string $expression, array $scope): mixed `evaluate()` を実行する
public evaluateNormalized(string $expression, array $scope): mixed Evaluate a decoded subexpression; decoding belongs to the source boundary.
private matchTopLevelCallableCall(string $expression): ?array `matchTopLevelCallableCall()` を実行する
private invokeTopLevelCallableCall(string $callableName, string $argumentExpression, array $scope): mixed `invokeTopLevelCallableCall()` を実行する
public isTruthy(mixed $value): bool `isTruthy()` かを返す
public splitArgumentList(string $expression): array `splitArgumentList()` を実行する
public splitTopLevel(string $expression, string $operator): array `splitTopLevel()` を実行する
public describeOperatorExpression(string $expression): ?array Describe the outer operation once, shared by interpretation and PHP compilation.
public splitMapEntry(string $expression): ?array Only the first top-level colon belongs to a map key; the rest belongs to its value.
public splitTopLevelArithmetic(string $expression, array $operators): ?array `splitTopLevelArithmetic()` を実行する
private isUnaryArithmeticSign(string $expression, int $index): bool `isUnaryArithmeticSign()` かを返す
public describePathPlan(string $expression, bool $normalized = false): ?array `describePathPlan()` を実行する
public describeDotFilterChain(string $expression, bool $normalized = false): ?array `describeDotFilterChain()` を実行する
private resolvePath(string $expression, array $scope): mixed `resolvePath()` を実行する
private isResolvablePathExpression(string $expression): bool `isResolvablePathExpression()` かを返す
private buildUnsupportedExpressionException(string $expression): NaifyViewException `buildUnsupportedExpressionException()` を実行する
private concatenateValues(array $parts, array $scope): string `concatenateValues()` を実行する
private calculateArithmeticValues(array $parts, array $operators, array $scope): int|float `calculateArithmeticValues()` を実行する
private moduloNumbers(int|float $left, int|float $right, string $leftExpression, string $rightExpression): int|float `moduloNumbers()` を実行する
private stringifyValue(mixed $value): string `stringifyValue()` を実行する
private normalizeNumericValue(mixed $value, string $expression): int|float `normalizeNumericValue()` を実行する
private evaluateDotFilterChain(array $helperChain, array $scope): mixed `evaluateDotFilterChain()` を実行する
private resolveDotFilterArguments(string $argumentExpression, array $scope): array `resolveDotFilterArguments()` を実行する
private evaluateListLiteral(string $expression, array $scope): array `evaluateListLiteral()` を実行する
private evaluateMapLiteral(string $expression, array $scope): array `evaluateMapLiteral()` を実行する
private evaluateRangeExpression(string $startExpression, string $endExpression, string $expression, array $scope): array `evaluateRangeExpression()` を実行する
private normalizeRangeExpressionNumber(mixed $value, string $expression): int `normalizeRangeExpressionNumber()` を実行する
private resolveMapKey(string $keyExpression, array $scope): string|int `resolveMapKey()` を実行する
private isListLiteral(string $expression): bool `isListLiteral()` かを返す
private isMapLiteral(string $expression): bool `isMapLiteral()` かを返す
private matchObjectMethodCall(string $expression, array $scope): ?array `matchObjectMethodCall()` を実行する
private isTrustedRootAllowed(string $bindingName, array $scope): bool `isTrustedRootAllowed()` かを返す
private invokeObjectMethodCall(string $targetExpression, string $methodName, string $argumentExpression, array $scope): mixed `invokeObjectMethodCall()` を実行する
private loadPathPlan(string $expression): array `loadPathPlan()` を実行する
private isMissingPathExpression(string $expression, array $scope): bool `isMissingPathExpression()` かを返す
private readRootToken(string $expression): array `readRootToken()` を実行する
private readIdentifier(string $expression, int $offset): array `readIdentifier()` を実行する
private isIdentifierCharacter(string $char): bool `isIdentifierCharacter()` かを返す
private findMatchingBracket(string $expression, int $start): int `findMatchingBracket()` を実行する
private findMatchingParenthesis(string $expression, int $start): int `findMatchingParenthesis()` を実行する
private findMatchingBrace(string $expression, int $start): int `findMatchingBrace()` を実行する
public splitTernary(string $expression): ?array `splitTernary()` を実行する
private unwrapWrappedParentheses(string $expression): string `unwrapWrappedParentheses()` を実行する
private assertBalancedExpression(string $expression): void `assertBalancedExpression()` を実行する
private decodeQuotedStringLiteral(string $expression): string `decodeQuotedStringLiteral()` を実行する
private isEscapedCharacter(string $expression, int $index): bool `isEscapedCharacter()` かを返す