Donner SVG main
0.8.0 ยท 766e862a0.8.0 main
SVG editor and embeddable C⁠+⁠+⁠20 engine.
Loading...
Searching...
No Matches
VariableSubstitution.h File Reference
#include <cstddef>
#include <functional>
#include <optional>
#include <span>
#include <string_view>
#include <vector>
#include "donner/css/ComponentValue.h"
Include dependency graph for VariableSubstitution.h:
This graph shows which files directly or indirectly include this file:

Classes

struct  donner::css::VariableSubstitutionLimits
 Per-value limits in addition to any enclosing cascade work limits. More...
struct  donner::css::VariableSubstitutionResult

Namespaces

namespace  donner
 Top-level Donner namespace, which is split into different sub-namespaces such as donner::svg and donner::css.
namespace  donner::css
 Donner CSS library, a standalone composable CSS parser.

Typedefs

using donner::css::VariableLookup
 A lookup returns an already computed token sequence. Its storage must outlive substitution. An engaged empty span is a valid empty value; a missing name is guaranteed-invalid.

Enumerations

enum class  donner::css::VariableReferences {
  None ,
  Valid ,
  Invalid
}
 Classification of variable references, including references nested in functions and blocks.
enum class  donner::css::VariableSubstitutionStatus {
  Resolved ,
  Invalid ,
  LimitExceeded
}
 A rejected expansion has no partially substituted output.

Functions

VariableReferences donner::css::InspectVariableReferences (std::span< const ComponentValue > values)
 Inspect the token tree without substituting or looking up any name.
bool donner::css::VisitVariableReferences (std::span< const ComponentValue > values, const std::function< void(std::string_view)> &visit)
 Visit every referenced custom property, including those in unused fallbacks, in token order. Returns false when a var() argument list is invalid.
VariableSubstitutionResult donner::css::SubstituteVariables (std::span< const ComponentValue > values, const VariableLookup &lookup, VariableSubstitutionLimits limits={}, const std::function< bool(std::size_t, std::size_t)> &admit={})
 Substitute already computed variables and selected fallback token sequences. Token boundaries, nesting, and source locations are preserved. The optional callback admits actual output work (component count, source bytes) before each append, and may decline further work.

Class Documentation

◆ donner::css::VariableSubstitutionLimits

struct donner::css::VariableSubstitutionLimits

Per-value limits in addition to any enclosing cascade work limits.

Class Members
size_t bytes = 1024 * 1024
size_t components = 65'536

◆ donner::css::VariableSubstitutionResult

struct donner::css::VariableSubstitutionResult
Class Members
VariableSubstitutionStatus status
vector< ComponentValue > values