ParameterReader
Steady-state allocation-free tokenizer for comma-separated modifier parameters, including quoted tokens and escaped delimiters.
Example
[ctor]public ParameterReader(ReadOnlySpan<char> parameter)public bool Next(out ReadOnlySpan<char> token)Reads the next comma-delimited token after quote and escape decoding.
public bool Next(out ReadOnlySpan<char> token, out bool isSet)Reads the next token and reports whether the slot was explicitly set. A bare empty slot is unset; "" and '' are set empty strings.
public bool TryPeek(out ReadOnlySpan<char> token)Reads the next comma-delimited token (trimmed) without consuming it — a following Next returns the same token. Returns false if no tokens remain. The optional-slot idiom: peek, test, and call Next only on a match, so a non-matching token flows to the following slot instead of being eaten.
public bool TryPeekOptional(out ReadOnlySpan<char> token)Peek for an optional positional slot. An explicitly-empty slot (a bare comma) is a positional skip: it is consumed here and reported as absent (returns false). A non-empty token is left in place — the caller tests it and either claims it with Next or lets it flow to the following slot. Centralizes the empty-skip so a leading empty slot can never silently shift the remaining positional values.
public static bool ParseFloat(ReadOnlySpan<char> s, out float value)Parses a span as float using InvariantCulture. For pre-extracted tokens where Next() was already called. Only finite values with a magnitude of at most 10^7 parse; infinities, larger values and NaN fail, so the slot falls back to its next layer — a field whose own value is NaN keeps meaning "inherit".
Reads the next token as a value of enum T. Matches the full enum-member name case-insensitively; for single-character tokens, also matches against the first letter of any member whose initial is unique within the enum (e.g. r → Radial when no other member starts with R). Members whose initial collides with another member's keep working under their full name but lose the short alias. Returns false if missing or unmatched; on failure value is left at defaultValue.
public bool NextUnitFloat(out float value, out UnitKind unit, float defaultValue = 0f)Reads the next token as a float with an optional unit suffix. Missing or unparseable → defaultValue, UnitKind.Absolute, false.
Reads the next token as a space-separated "x y" vector where each axis may carry a unit suffix (0.1em -0.1em). The reported unit is UnitKind.Em if either axis is em; every other combination resolves to UnitKind.Absolute. Missing/empty token keeps defaultValue and returns false.
public bool NextUnitVector2(out Vector2 value, out UnitKind unit, UnitVector2 fallback)Reads the next unit-vector token, falling back to fallback's value and unit when absent. The fallback's unit is also the default coordinate space for a suffix-less axis.
