SIGN IN SIGN UP
facebook / react-native UNCLAIMED

A framework for building native applications using React

0 0 0 C++

Replace CSSSyntaxParser with CSSValueParser in data type sinks

Summary:
Previously, CSSDataTypeParser sinks received a raw CSSSyntaxParser& reference,
which exposed low-level tokenization APIs (consumeComponentValue with lambdas,
consumeToken, etc.) that data type parsers should not use directly. This made
it unclear what operations are appropriate when implementing a new CSS data
type.

This change promotes detail::CSSValueParser to a public CSSValueParser class
that wraps CSSSyntaxParser and exposes only value-level parsing operations:
parseNextValue, peekNextValue, consumeWhitespace, consumeDelimiter, isFinished,
peekNextTokenIs, and saveState/restoreState for lookahead patterns.

All CSSDataTypeParser sink methods now receive CSSValueParser& instead of
CSSSyntaxParser&, and use parser.parseNextValue<T>() instead of the free
function parseNextCSSValue<T>(parser). Direct consumeComponentValue calls in
gradient parsers (CSSBackgroundImage.h) are replaced with keyword set parsing
via parseNextValue<KeywordEnum>, with new To/At keywords added to CSSKeyword.

The free functions parseCSSProperty, parseNextCSSValue, and peekNextCSSValue
remain as convenience wrappers for backward compatibility.

Changelog: [Internal]

Reviewed By: jorge-cab

Differential Revision: D94357104

fbshipit-source-id: 3ba2ba236c9c6e82673e2759a6c7af803599b7f0
N
Nick Gerleman committed
4d66a26a67007d02f1ca4a09b8d05c63f30eb876
Parent: 36212c2
Committed by meta-codesync[bot] <215208954+meta-codesync[bot]@users.noreply.github.com> on 2/25/2026, 8:39:16 PM