Branch: refs/heads/main Home: https://github.com/WebKit/WebKit Commit: 0e7b8c42e6a0955ba6664560ecd90648f03148a1 https://github.com/WebKit/WebKit/commit/0e7b8c42e6a0955ba6664560ecd90648f03148a1 Author: Sam Weinig <wei...@apple.com> Date: 2023-01-02 (Mon, 02 Jan 2023)
Changed paths: M Source/WebCore/css/CSSProperties.json M Source/WebCore/css/process-css-properties.py M Tools/Scripts/webkitpy/style/checkers/jsonchecker.py Log Message: ----------- Add enough BNF support for all CSS property longhand grammars https://bugs.webkit.org/show_bug.cgi?id=249980 rdar://103795673 Reviewed by Antti Koivisto. Adds the remaining BNF parsing support in process-css-properties.py to parse all the CSS property and descriptor definitions specified by CSS specifications. This just adds the parsing of the grammars themselves though, and generation of the actual C++ parsers is still to come. But, with all the grammars now supported, we can enforce that a grammar is at least added to CSSProperties.json for each longhand. And in fact, what this change does is add a new "parser-grammar-unused" field that is required for all longhands that are currently using a custom parser function, as well as a "parser-grammar-unused-reason" field that has the reason it is still using the custom parser function, usually due to some kind of term we don't support generation for yet. The majority of this change is going through each property and descriptor and adding the unused grammars and reasons, as well as updating the specification metadata and "values" arrays. For the "values" arrays, we now have a hard check that any keyword the grammar supports is listed in the "values" array as well. Eventually, we should remove the "values" array entirely, and derive it from the grammars, but to do that, we need to update the "css-status" website to support parsing the grammars as well, so for now, we just enforce they are in sync. A few other smaller changes include: - Requiring "parser-grammar", "parser-function" or "skip-parser" for each longhand ("custom-parser" is only used for shorthands, and should be removed in a subsequent change). - Renaming "parser-requires-*" fields to "parser-function-requires-*" to better indicate that these only are used when "parser-function" is used as well. - Renaming "custom-parser-allows-number-or-integer-input" to "parser-function-allows-number-or-integer-input" for the same reason. - Added a new --dump-unused-grammars argument to process-css-properties.py to print out all the properties and descriptors with unused grammars as well as the "reasons". - Added a new --check-unused-grammars-values argument to process-css-properties.py to check "values" arrays against the unused grammars. This is not checked by default as at least initially, I just want the unused grammars to be checked for whether they parse. - Added support for literals (e.g. the '[' the <line-names> production in css-grid), functional notation (e.g. 'rect( [ <length> | auto ]#{4} )' in css-masking) and functional references (e.g. '<rect()>' in css-masking as well) to the BNF parser. - Add support for all the BNF nodes to the Term class cluster, adding LiteralTerm, GroupTerm, OptionalTerm, BoundedRepetitionTerm, FixedSizeRepetitionTerm, and FunctionTerm. Also renamed and expanded CommaSeparatedRepetitionTerm to UnboundedRepetitionTerm. * Source/WebCore/css/CSSProperties.json: * Source/WebCore/css/process-css-properties.py: * Tools/Scripts/webkitpy/style/checkers/jsonchecker.py: Canonical link: https://commits.webkit.org/258381@main _______________________________________________ webkit-changes mailing list webkit-changes@lists.webkit.org https://lists.webkit.org/mailman/listinfo/webkit-changes