Compiler
MMO\client\scs · 1 symbol · generated 5 Oct 2026
Compiler
Compiler.php:26The Simple CSS compiler: one instance compiles one stylesheet.
- Namespace
MMO\client\scs
Index
| CSS_FUNCTIONS | The css functions a value may call. | |
| DECLARATION_AT_RULES | at-rules whose body is a declaration block rather than a set of rules | |
| MAX_DEPTH | ||
| MAX_ITERATIONS | how many times a single @for may run, so a mistyped range cannot hang a page | |
| NESTED_AT_RULES | at-rules whose body holds rules that must not be prefixed by the enclosing selector | |
| OPTIONS | the options a @config instruction is allowed to set | |
| PAGE_MARGIN_AT_RULES | The sixteen margin boxes of @page. | |
| context | ||
| emitter | ||
| evaluator | ||
| expanding | ||
| files | ||
| functions | ||
| global | ||
| imported | ||
| index | ||
| namespace | ||
| namespaces | ||
| options | ||
| registry | ||
| scopes | ||
| sources | ||
| styles | ||
| themes | ||
| tokens | ||
| atRule($node, $scope, $frame) | A css at-rule the language does not interpret: @media, @supports, @keyframes, @font-face... | |
| bind($params, $args, $parent, $node, $name) | Bind the arguments of a @style or a @fn call to a new scope. | |
| callFunction($name, $args, $node, $namespace) | Call an @fn. | |
| callPhp($node, $args, $scope, $selector) | Call an authorized php function (PhpFunctionRegistry). | |
| circular($key, $node) | ||
| compile($source, $filename) | Compile a .scs source. | |
| component($node, $scope, $frame) | `@component button { ... | |
| configure($node) | Apply a @config instruction. | |
| context() | ||
| declare($node, $scope, $frame) | Emit a declaration into the frame's rule. | |
| declareNamespace($filename, $statements, $alias, $merge, $node) | Give a file its namespace, and remember it: from @namespace, else from an as alias, else from the file name (lib.scs holds lib), else the anonymous namespace of a source with no name of its… | |
| define($kind, $namespace, $node) | Register a @style or a @fn in a namespace. | |
| emitter() | ||
| error($message, $context, $location, $previous) | Build a located compilation error, with the source line it happened on. | |
| evaluate($expression, $selector) | Evaluate a single scs expression, without generating any css. | |
| exec($statements, $scope, $frame) | Execute a list of statements. | |
| execNode($statement, $scope, $frame) | ||
| execStatement($statement, $scope, $frame) | ||
| hasFunction($name, $namespace) | ||
| hoist($statements) | Step 4 of the pipeline: register @config, @theme paths, @style and @fn before anything is generated, so they can be referenced regardless of where they are declared. | |
| import($node, $directory, $namespace) | Resolve, read and parse an @imported file. | |
| isCssFunction($name) | ||
| Key($namespace, $name) static | ||
| load($source, $filename) | Parse a source and merge everything it @imports, in place. | |
| lookup($kind, $namespace, $name) | Find a @style or a @fn: qualified, in the namespace it names; unqualified, in the namespace of the file the reference is written in. | |
| loop($node, $scope, $frame) | @for $i in 1..6 / @for $key:$value in $collection. | |
| merge($ast, $directory, $namespace) | ||
| namespaceOf($node) | ||
| NamespaceOfFile($filename) static | ||
| namespaceScope($namespace) | ||
| options() | ||
| query($target, $scope, $frame) | Turn a @screen target into a media query. | |
| registry() | ||
| resolve($path, $directory, $node) | ||
| scope() | ||
| scopeOf($namespace) | ||
| selectors($selector, $frame) | Resolve a (possibly nested) selector against the frame it is declared in. | |
| split($selector) | Split a selector list on its top level commas (a comma inside :is(...) or [attr=","] is not one). | |
| theme($node, $scope, $frame) | @theme { ... } -- emit the design tokens as css custom properties. | |
| themeValue($path) | Resolve a $path against the declared design tokens. | |
| undefined($kind, $namespace, $name, $node) | The error for a reference that resolves to nothing -- naming the namespace the definition really lives in, which is the whole point of writing them down. | |
| undefinedFunction($name, $node) | The error for a call that resolves to nothing -- an @fn of another namespace, or a typo. | |
| useStyle($node, $scope, $frame) | @use lib::center / @use size(48px, 48px) -- expand a reusable style in place. | |
| variableName($path) | ||
| variant($node, $scope, $frame) | `@variant primary { ... | |
| __construct($options, $context, $registry) |
Constants7
CSS_FUNCTIONS
The css functions a value may call. Anything else is reported as an undefined function in strictFunctions mode (the default), which is what catches a misspelled @fn instead of emitting css no browser understands. A vendor prefixed (-webkit-...) or custom (--...) function is always allowed.
- See
Parser::CSS_FUNCTIONSfor the ones whose arguments are additionally kept as written.
DECLARATION_AT_RULES
at-rules whose body is a declaration block rather than a set of rules
MAX_DEPTH
MAX_ITERATIONS
how many times a single @for may run, so a mistyped range cannot hang a page
NESTED_AT_RULES
at-rules whose body holds rules that must not be prefixed by the enclosing selector
OPTIONS
the options a @config instruction is allowed to set
PAGE_MARGIN_AT_RULES
The sixteen margin boxes of @page. They hold declarations, like @page itself, but they are written *inside* it -- `@page
Properties18
context
emitter
- Type
- Emitter
evaluator
- Type
- Evaluator
expanding
- Type
- array
files
- Type
- array
functions
- Type
- array
global
- Type
- Scope
imported
- Type
- array
index
- Type
- array
namespace
- Type
- string
namespaces
- Type
- array
options
- Type
- array
registry
scopes
- Type
- array
sources
- Type
- array
styles
- Type
- array
themes
- Type
- array
tokens
- Type
- array
Methods46
atRule($node, $scope, $frame)
Compiler.php:762A css at-rule the language does not interpret: @media, @supports, @keyframes, @font-face...
| $node | AtRuleNode | |
| $scope | Scope | |
| $frame | Frame | |
| returns | void |
bind($params, $args, $parent, $node, $name)
Compiler.php:1010Bind the arguments of a @style or a @fn call to a new scope.
callFunction($name, $args, $node, $namespace)
Compiler.php:945Call an @fn.
callPhp($node, $args, $scope, $selector)
Compiler.php:978Call an authorized php function (PhpFunctionRegistry).
circular($key, $node)
Compiler.php:1032compile($source, $filename)
Compiler.php:155Compile a .scs source.
component($node, $scope, $frame)
Compiler.php:653@component button { ... } -- a name becomes a selector through the componentSelector option, an explicit selector is used as written.
| $node | ComponentNode | |
| $scope | Scope | |
| $frame | Frame | |
| returns | void |
configure($node)
Compiler.php:493Apply a @config instruction.
| $node | ConfigNode | |
| returns | void |
context()
Compiler.php:196| returns | CompilationContext |
declare($node, $scope, $frame)
Compiler.php:637Emit a declaration into the frame's rule.
| $node | DeclarationNode | |
| $scope | Scope | |
| $frame | Frame | |
| returns | void |
declareNamespace($filename, $statements, $alias, $merge, $node)
Compiler.php:258Give a file its namespace, and remember it: from @namespace, else from an as alias, else from the file name (lib.scs holds lib), else the anonymous namespace of a source with no name of its own.
| $filename | string | |
| $statements | array | the file's top level statements, read for a @namespace instruction |
| $alias = null | null | string | the name the importing file registers it under |
| $merge = null | null | string | the namespace to merge it into (@import ... as self) |
| $node = null | null | Node | the @import reporting the error |
| returns | string | the namespace |
define($kind, $namespace, $node)
Compiler.php:419Register a @style or a @fn in a namespace.
emitter()
Compiler.php:198| returns | Emitter |
error($message, $context, $location, $previous)
Compiler.php:210Build a located compilation error, with the source line it happened on.
evaluate($expression, $selector)
Compiler.php:188Evaluate a single scs expression, without generating any css.
| $expression | string | ex: php::calculatePadding(), $spacing |
| $selector = null | null | string | the selector context-aware php functions should see |
| returns | Value |
exec($statements, $scope, $frame)
Compiler.php:525Execute a list of statements.
execNode($statement, $scope, $frame)
Compiler.php:544execStatement($statement, $scope, $frame)
Compiler.php:533hasFunction($name, $namespace)
Compiler.php:920hoist($statements)
Compiler.php:399Step 4 of the pipeline: register @config, @theme paths, @style and @fn before anything is generated, so they can be referenced regardless of where they are declared.
import($node, $directory, $namespace)
Compiler.php:333Resolve, read and parse an @imported file.
| $node | ImportNode | |
| $directory | string | |
| $namespace = '' | string | |
| returns | array | the imported statements, empty when the file was already imported |
isCssFunction($name)
Compiler.php:929Key($namespace, $name)
staticCompiler.php:323load($source, $filename)
Compiler.php:224Parse a source and merge everything it @imports, in place.
lookup($kind, $namespace, $name)
Compiler.php:437Find a @style or a @fn: qualified, in the namespace it names; unqualified, in the namespace of the file the reference is written in.
loop($node, $scope, $frame)
Compiler.php:715@for $i in 1..6 / @for $key:$value in $collection.
merge($ast, $directory, $namespace)
Compiler.php:237| $ast | StylesheetNode | |
| $directory | string | the directory @import paths are relative to |
| $namespace | string | the namespace of the file being merged, for its @import ... as self |
| returns | array |
namespaceOf($node)
Compiler.php:314NamespaceOfFile($filename)
staticCompiler.php:287namespaceScope($namespace)
Compiler.php:295options()
Compiler.php:200| returns | array |
query($target, $scope, $frame)
Compiler.php:873Turn a @screen target into a media query.
| $target | ValueListNode | tablet, 455px, (max-width: 600px) or print |
| $scope | Scope | |
| $frame | Frame | |
| returns | string |
registry()
Compiler.php:197| returns | PhpFunctionRegistry |
resolve($path, $directory, $node)
Compiler.php:374scope()
Compiler.php:199| returns | Scope |
scopeOf($namespace)
Compiler.php:303selectors($selector, $frame)
Compiler.php:817Resolve a (possibly nested) selector against the frame it is declared in.
split($selector)
Compiler.php:839Split a selector list on its top level commas (a comma inside :is(...) or [attr=","] is not one).
theme($node, $scope, $frame)
Compiler.php:682@theme { ... } -- emit the design tokens as css custom properties.
themeValue($path)
Compiler.php:899Resolve a $path against the declared design tokens.
undefined($kind, $namespace, $name, $node)
Compiler.php:451The error for a reference that resolves to nothing -- naming the namespace the definition really lives in, which is the whole point of writing them down.
undefinedFunction($name, $node)
Compiler.php:488The error for a call that resolves to nothing -- an @fn of another namespace, or a typo.
useStyle($node, $scope, $frame)
Compiler.php:697@use lib::center / @use size(48px, 48px) -- expand a reusable style in place.
variableName($path)
Compiler.php:889variant($node, $scope, $frame)
Compiler.php:661@variant primary { ... } -- emitted as {selector}--{variant}.
| $node | VariantNode | |
| $scope | Scope | |
| $frame | Frame | |
| returns | void |
__construct($options, $context, $registry)
Compiler.php:116| $options = [] | array | SCSCompiler::DefaultConfig for the supported keys |
| $context = null | null | CompilationContext | the values injected by the php application (context::name) |
| $registry = null | null | PhpFunctionRegistry | the authorized php callables (php::name()) |