[webkit-changes] [WebKit/WebKit] ca8eeb: Replace adhoc JSON based CSS property grammars wit...

Sam Weinig noreply at github.com
Sun Dec 11 17:49:55 PST 2022


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: ca8eebd3b29a0697879a75323fb81c01c41d1e50
      https://github.com/WebKit/WebKit/commit/ca8eebd3b29a0697879a75323fb81c01c41d1e50
  Author: Sam Weinig <weinig at apple.com>
  Date:   2022-12-11 (Sun, 11 Dec 2022)

  Changed paths:
    M Source/WebCore/css/CSSProperties.json
    M Source/WebCore/css/process-css-properties.py

  Log Message:
  -----------
  Replace adhoc JSON based CSS property grammars with BNF
https://bugs.webkit.org/show_bug.cgi?id=249102
rdar://103230196

Reviewed by Darin Adler.

This adds a new lexer/parser in process-css-properties.py that can
parse the dialect of BNF used by the CSS specifications. Use it to
replace the adhoc JSON based CSS property grammars currently used
in CSSProperties.json. This will be easier for people to adopt and
understand as it will much more closely mirror the specification
text. The existing structure based grammars continue to be supported
for now, as there are a few things that can't be represented in the
new form quite yet (aliased keywords, settings conditionals, etc.),
though only one grammar definition, -webkit-absolute-size, actually
still requires it at the moment due to most of the other cases being
handed in the 'values' array.

There are few changes that will need to be added to the new parser
to fully support CSS grammars such as support for literal strings,
functional notation, and elidable commas. Also, the parser currently
supports more than the generator does, with any unsupported production
raising an error.

* Source/WebCore/css/CSSProperties.json:
* Source/WebCore/css/process-css-properties.py:
(Term):
(Term.wrap_with_multiplier):
(Term.from_node):
(ReferenceTerm):
(ReferenceTerm.from_node):
(KeywordTerm):
(KeywordTerm.from_node):
(MatchOneTerm):
(MatchOneTerm.from_node):
(RepetitionTerm):
(RepetitionTerm.wrapping_term):
(Grammar.from_json):
(SharedGrammarRule):

Canonical link: https://commits.webkit.org/257710@main




More information about the webkit-changes mailing list