Index

Evaluator

MMO\client\scs · 1 symbol · generated 5 Oct 2026

class

Evaluator

Evaluator.php:22

Evaluates expressions and renders css values.

class MMO\client\scs\Evaluator
Namespace
MMO\client\scs
See
Compiler which owns the definitions this evaluator reads.
It is the single place where the three namespaces of the language are resolved: ```text $name compile-time variable, then theme token -> var(--name) name(...) @fn, built-in, or plain css function php::name(...) explicitly authorized php callable context::name value injected by the php application ```

Index

compiler
binary($node, $scope, $selector)
call($node, $scope, $selector)
compute($operator, $left, $right, $node)
context($node)
dig($value, $path)Walk a dotted path inside a value.
evaluate($node, $scope, $selector)Evaluate any expression node.
index($node, $scope, $selector)
map($node, $scope, $selector)
member($value, $key, $node)Read a key of a map, or an index of a list.
render($node, $scope, $selector, $quote)Render a css value, a selector or an at-rule prelude, keeping the source's own spacing.
string($node, $scope, $selector)Build a string whose ${...} parts are evaluated.
unary($node, $scope, $selector)
unitOf($operator, $left, $right, $node)The unit of an arithmetic result.
valueOf($node, $scope, $selector)Evaluate a value list as a single value: a lone term keeps its type (a map stays a map, a number stays a number), a comma separated list becomes a list, anything else becomes the css text it render…
variable($node, $scope)Resolve $name / $name.path: a compile-time variable first, a theme token second.
__construct($compiler)

Properties1

compiler

protected MMO\client\scs\Compiler $compiler
Type
Compiler

Methods16

binary($node, $scope, $selector)

Evaluator.php:224
protected function binary( MMO\client\scs\nodes\BinaryNode $node, MMO\client\scs\Scope $scope, ?string $selector ): MMO\client\scs\Value
$nodeBinaryNode
$scopeScope
$selectornull | string
returnsValue

call($node, $scope, $selector)

Evaluator.php:324
protected function call( MMO\client\scs\nodes\CallNode $node, MMO\client\scs\Scope $scope, ?string $selector ): MMO\client\scs\Value
$nodeCallNode
$scopeScope
$selectornull | string
returnsValue

compute($operator, $left, $right, $node)

Evaluator.php:271
protected function compute( string $operator, float $left, float $right, MMO\client\scs\nodes\Node $node ): float
$operatorstring
$leftfloat
$rightfloat
$nodeNode
returnsfloat

dig($value, $path)

Evaluator.php:157

Walk a dotted path inside a value.

protected function dig(?MMO\client\scs\Value $value, array $path): ?MMO\client\scs\Value
$valuenull | Value
$patharray
returnsnull | Valuenull when the path does not exist in this value

evaluate($node, $scope, $selector)

Evaluator.php:32

Evaluate any expression node.

function evaluate( MMO\client\scs\nodes\Node $node, MMO\client\scs\Scope $scope, ?string $selector = null ): MMO\client\scs\Value
$nodeNode
$scopeScope
$selector = nullnull | stringthe resolved selector being emitted, passed to context-aware php functions
returnsValue

index($node, $scope, $selector)

Evaluator.php:176
protected function index( MMO\client\scs\nodes\IndexNode $node, MMO\client\scs\Scope $scope, ?string $selector ): MMO\client\scs\Value
$nodeIndexNode
$scopeScope
$selectornull | string
returnsValue

map($node, $scope, $selector)

Evaluator.php:201
protected function map( MMO\client\scs\nodes\MapNode $node, MMO\client\scs\Scope $scope, ?string $selector ): MMO\client\scs\Value
$nodeMapNode
$scopeScope
$selectornull | string
returnsValue

member($value, $key, $node)

Evaluator.php:185

Read a key of a map, or an index of a list.

protected function member( MMO\client\scs\Value $value, MMO\client\scs\Value $key, MMO\client\scs\nodes\Node $node ): MMO\client\scs\Value
$valueValue
$keyValue
$nodeNode
returnsValue

render($node, $scope, $selector, $quote)

Evaluator.php:69

Render a css value, a selector or an at-rule prelude, keeping the source's own spacing.

function render( MMO\client\scs\nodes\ValueListNode $node, MMO\client\scs\Scope $scope, ?string $selector = null, bool $quote = true ): string
$nodeValueListNode
$scopeScope
$selector = nullnull | string
$quote = trueboolfalse to drop string quotes (selector and interpolation context)
returnsstring

string($node, $scope, $selector)

Evaluator.php:52

Build a string whose ${...} parts are evaluated.

protected function string( MMO\client\scs\nodes\StringNode $node, MMO\client\scs\Scope $scope, ?string $selector ): MMO\client\scs\Value
$nodeStringNode
$scopeScope
$selectornull | string
returnsValue

unary($node, $scope, $selector)

Evaluator.php:213
protected function unary( MMO\client\scs\nodes\UnaryNode $node, MMO\client\scs\Scope $scope, ?string $selector ): MMO\client\scs\Value
$nodeUnaryNode
$scopeScope
$selectornull | string
returnsValue

unitOf($operator, $left, $right, $node)

Evaluator.php:289

The unit of an arithmetic result. Incompatible units are a compile error (the spec, 5.4).

protected function unitOf( string $operator, MMO\client\scs\Value $left, MMO\client\scs\Value $right, MMO\client\scs\nodes\Node $node ): string
$operatorstring
$leftValue
$rightValue
$nodeNode
returnsstring

valueOf($node, $scope, $selector)

Evaluator.php:85

Evaluate a value list as a single value: a lone term keeps its type (a map stays a map, a number stays a number), a comma separated list becomes a list, anything else becomes the css text it renders to.

function valueOf( MMO\client\scs\nodes\ValueListNode $node, MMO\client\scs\Scope $scope, ?string $selector = null ): MMO\client\scs\Value
$nodeValueListNode
$scopeScope
$selector = nullnull | string
returnsValue

variable($node, $scope)

Evaluator.php:116

Resolve $name / $name.path: a compile-time variable first, a theme token second.

protected function variable(MMO\client\scs\nodes\VariableRefNode $node, MMO\client\scs\Scope $scope): MMO\client\scs\Value
See
the spec, 38 and 39 -- a theme token never becomes its value, it becomes var(--name-path).
$nodeVariableRefNode
$scopeScope
returnsValue