Skip to content

Main content

Random CSS Custom Property Fallback Corpus Generator

Compose nested var fallback expressions and literal bindings, then lower their acyclic fallback paths to the supported core resolver.

Loading tool…

Description

Compose nested var fallback expressions and literal bindings, then lower their acyclic fallback paths to the supported core resolver.

A protocol fixture is local test data representing headers, messages, identifiers, or request decisions. Serialization and parsing can be checked without contacting a server, while authentication, delivery, and actual client behavior require separate tests.

Compose nested var fallback expressions and literal bindings, then lower their acyclic fallback paths to the supported core resolver.

When to use this tool

Use this generator to create reproducible css custom property fallback corpus cases from the supplied model or bank. Inspect the returned evidence before using cases in a test or exercise.

How to use the tool and how it works

  1. Supply count, depth, literalTokens, bindingProbability in the field shapes below. Set seed when you need an explicit replay.
  2. Run the tool and correct any input error. For generated controls, distinguish a successful fixture containing an invalid case from failure to generate the fixture.
  3. Read cases. Use the conventions below. Keep answer-bearing fields separate when presenting an exercise.

Build nested fallback expressions over generated variable names and randomly supplied literal bindings. Serialize and parse declarations, translate the constructed chain into the linked fallback graph representation, and return its resolution evidence.1

Delegated operations used for this result: variable parser; variable fallback chain resolution. Their calculation or parsing conventions apply to the corresponding result fields.2, 3

Input fieldMeaning and unitsAccepted input
countCountRequired. Safe integer; minimum 1; maximum 32.
depthDepthRequired. Object; no unknown keys.
depth.minimumMinimumRequired. Safe integer; minimum 1; maximum 8.
depth.maximumMaximumRequired. Safe integer; minimum 1; maximum 8.
literalTokensLiteral TokensRequired. Array of Text; minimum UTF-16 length 1; maximum UTF-16 length 128.; minimum items 1; maximum items 32.
bindingProbabilityBinding ProbabilityRequired. Finite number; minimum 0; maximum 1.
seedOptional numeric seed; takes precedence over context randomness. Without either, use the fixed tool.io default seed.Optional. Safe integer.
Output fieldInterpretationReturned shape
casesCasesRequired. Array of Object; no unknown keys.; minimum items 1; maximum items 32.
cases[].expressionExpressionRequired. Text; maximum UTF-16 length 2048.
cases[].declarationsDeclarationsRequired. Text; maximum UTF-16 length 2048.
cases[].parsedBindingsParsed BindingsRequired. Array of Object; no unknown keys.; minimum items 0; maximum items 8.
cases[].parsedBindings[].nameNameRequired. Text.
cases[].parsedBindings[].valueValueRequired. Text.
cases[].normalizedGraphNormalized GraphRequired. Object; no unknown keys.
cases[].normalizedGraph.variableNamesVariable NamesRequired. Array of Text; maximum UTF-16 length 128.; minimum items 0; maximum items 8.
cases[].normalizedGraph.literalTokensLiteral TokensRequired. Array of Text; maximum UTF-16 length 128.; minimum items 0; maximum items 8.
cases[].normalizedGraph.referencedVariablesReferenced VariablesRequired. Array of Text; maximum UTF-16 length 128.; minimum items 0; maximum items 8.
cases[].normalizedGraph.fallbackTokensFallback TokensRequired. Array of Text; maximum UTF-16 length 128.; minimum items 0; maximum items 8.
cases[].normalizedGraph.queryVariableQuery VariableRequired. Text.
cases[].resolvedTokenResolved TokenRequired. Text; maximum UTF-16 length 128.
cases[].visitedVariablesVisited VariablesRequired. Array of Text; maximum UTF-16 length 128.; minimum items 0; maximum items 8.
randomnessReplay source and normalized 32-bit seed, or null seed for an advancing context source.Required. Object; no unknown keys.
randomness.seedOptional safe-integer replay seed; normalization and precedence are explained below.Required. Safe integer. or Null.
randomness.sourceSourceRequired. Text; one of "context", "seed".

An explicit safe-integer seed takes precedence over injected context randomness and is normalized to an unsigned 32-bit integer. With no seed and no context source, replay uses the fixed tool.io default seed. A context source must return finite values from zero inclusive to one exclusive; its advancing state must be retained separately. randomness records the source and normalized seed, or null for context. These generators are not cryptographic random sources.

json
{
  "input": {
    "count": 2,
    "depth": {
      "minimum": 3,
      "maximum": 3
    },
    "literalTokens": [
      "red",
      "blue",
      "green"
    ],
    "bindingProbability": 0.5,
    "seed": 42
  },
  "output": {
    "cases": [
      {
        "expression": "var(--v0, var(--v1, var(--v2, red)))",
        "declarations": "--v0: green; --v2: blue;",
        "parsedBindings": [
          {
            "name": "--v0",
            "value": "green"
          },
          {
            "name": "--v2",
            "value": "blue"
          }
        ],
        "normalizedGraph": {
          "variableNames": [
            "--v0",
            "--v1",
            "--v2"
          ],
          "literalTokens": [
            "green",
            "",
            "blue"
          ],
          "referencedVariables": [
            "",
            "--v2",
            ""
          ],
          "fallbackTokens": [
            "",
            "",
            ""
          ],
          "queryVariable": "--v0"
        },
        "resolvedToken": "green",
        "visitedVariables": [
          "--v0"
        ]
      },
      {
        "expression": "var(--v0, var(--v1, var(--v2, green)))",
        "declarations": "--v1: red;",
        "parsedBindings": [
          {
            "name": "--v1",
            "value": "red"
          }
        ],
        "normalizedGraph": {
          "variableNames": [
            "--v0",
            "--v1",
            "--v2"
          ],
          "literalTokens": [
            "",
            "red",
            "green"
          ],
          "referencedVariables": [
            "--v1",
            "",
            ""
          ],
          "fallbackTokens": [
            "",
            "",
            ""
          ],
          "queryVariable": "--v0"
        },
        "resolvedToken": "red",
        "visitedVariables": [
          "--v0",
          "--v1"
        ]
      }
    ],
    "randomness": {
      "seed": 42,
      "source": "seed"
    }
  }
}

Limitations and assumptions

  • This tests an explicitly constructed chain, not parsing arbitrary var expressions or evaluating the full CSS cascade. Literal bindings are trimmed tokens and no stylesheet is applied to a DOM.
  • A replay requires the same complete input and implementation. The stated sampling convention applies within its eligible space. A finite draw does not exhaust all possible outputs; repeats remain possible unless a distinct-selection rule is explicit.
  • The field tables state structural bounds; cross-field constraints and bounded search or output budgets also apply. Unknown keys are rejected where the object contract disallows them. Input errors are distinct from null fields and deliberate invalid controls in a successful output.

Alternative or Complementary methods

For a supplied example, inspect the returned construction or delegated check directly. To evaluate a consumer, also test cases chosen for its own boundaries; a generated finite corpus does not establish exhaustive coverage.

References

  1. Tool behavior and example: Random CSS Custom Property Fallback Corpus Generator — tool.io

  2. Calculation or validation: css/variable-parser — tool.io

  3. Calculation or validation: css/variable-fallback-chain-resolution — tool.io

Similar or alternative tools

  • Random Custom Element Name Fixture Generator

    Construct names from caller-supplied ASCII parts and controlled dash-removal, uppercase and reserved-name mutations, retaining current core flags without registering elements.

  • Random Barcode Label Sheet Generator

    Generate seeded synthetic EAN-13 or UPC-A data under an optional digit prefix, delegate check digits and SVG symbols, and return bounded zero-based label-grid positions for an app-rendered sheet; optional uniqueness applies to identifiers, while assignment, physical scanner readiness, print layout and export are not claimed.