Cleanup CSSKeyword#49155
Closed
NickGerleman wants to merge 8 commits into
Closed
Conversation
Summary: This reverts some of the behavior I added in D68357624, since peeking a component value is non-obviously more expensive than manually copying the parser, and needing to peek will be a pain for flat lists of values (like for box-shadow). Changelog: [internal] Differential Revision: D68733518
Summary: This adds a new `consume()` function to data type parsers which passes a raw parser. This can be used for types which are compounds of other data types, where we may want to accept more than the first token. This will be used for shadow parsing, but also fixes a hypothetical future bug with ratios. E.g. `calc(foo) / calc(bar)` may be a valid ratio, not starting with a token. We instead just want to try to parse a number data type from the stream. The form of parsing a preserved token + rest is removed, with the assumption that anything parsing more than a single token should use compound parsing. Differential Revision: D68735370
Summary: Adds a data type parser for a variable number of values of a given single data type (at least 1). E.g. `CSSCommaSeparatedList<CSSShadow>` will represent the syntax of `<shadow>#` (ie the value produced by box-shadow). Changelog: [internal] Differential Revision: D68738165
Summary: tsia Changelog: [Internal] Differential Revision: D68743950
Summary: This adds support for parsing the `<shadow>` data type. In combination with `CSSCommaSeparatedList`, we can now parse box shadow expressions. Differential Revision: D68744811
Summary: For parsing a variable number of whitespace separated data types. Changelog: [Internal] Differential Revision: D68849561
Summary: This diff is... maybe an argument against a global list of interned keywords (it works better in some other contexts though), and this structure is likely to change later when we reintroduce what was previously `CSSPropertyDescriptor` (a list of allowed keywords per property). But... we're going to roll with this for now to replace the ViewConfig processor (which string splits) in the most overengineered way possible... Changelog: [Internal] Differential Revision: D68851566
Contributor
|
This pull request was exported from Phabricator. Differential Revision: D69083181 |
Summary: Pull Request resolved: facebook#49155 This does some code cleanup for CSS keywords to reduce boilerplate, duplication, better isolate namespace, fix a typo, and ensure we get a warning (unused variable) if we miss handling a defined keyword. We technically don't need `CSSKeyword` at all anymore, and don't need to overlay each keywords values to be the same, though having a pattern where each keyword set uses ordinal values from CSSKeyword forces folks to look and add the enum to the list, and include the header defining the data types for keyword sets, instead of each set looking a little magic. Changelog: [Internal] Reviewed By: lenaic Differential Revision: D69083181
Contributor
|
This pull request was exported from Phabricator. Differential Revision: D69083181 |
010b5ac to
2a06103
Compare
Contributor
|
This pull request has been merged in 6a683cb. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary:
This does some code cleanup for CSS keywords to reduce boilerplate, duplication, better isolate namespace, fix a typo, and ensure we get a warning (unused variable) if we miss handling a defined keyword.
We technically don't need
CSSKeywordat all anymore, and don't need to overlay each keywords values to be the same, though having a pattern where each keyword set uses ordinal values from CSSKeyword forces folks to look and add the enum to the list, and include the header defining the data types for keyword sets, instead of each set looking a little magic.Changelog: [Internal]
Reviewed By: lenaic
Differential Revision: D69083181