Skip to content

Commit

Permalink
[css-values-4] Add definition of grammar production blocks. #2921
Browse files Browse the repository at this point in the history
  • Loading branch information
fantasai committed Nov 22, 2023
1 parent 5428488 commit a4bfe38
Showing 1 changed file with 37 additions and 0 deletions.
37 changes: 37 additions & 0 deletions css-values-4/Overview.bs
Original file line number Diff line number Diff line change
Expand Up @@ -479,6 +479,41 @@ Property Value Examples</h3>
</table>
</div>

<h3 id="production-blocks">
Non-Terminal Definitions and Grammar Production Blocks</h3>

The precise grammar of non-terminals, like <<position>> or <<calc()>>,
is often specified in a <dfn export>CSS grammar production block</dfn>.
These are conventionally represented in a preformatted block of definitions
like this:

<div class="example">
The <css>&lt;foo></css> syntax is defined as follows:

<xmp class=prod>
<foo> = keyword | <bar> |
some-really-long-pattern-of-stuff
<bar> = <length>
</xmp>
</div>

Each definition starts on its own line,
and consists of the non-terminal to be defined,
followed by an <code>=</code>,
followed by the fragment of [=value definition syntax=] to which it expands.
A definition can stretch across multiple lines,
and terminates before the next line that starts a new grammar production
or at the end of the grammar production block
(whichever comes first).

<div class="example">
In the above example, the <css>&lt;foo></css> definition covers two lines.
The third line starts a new definition for <css>&lt;bar></css>.
(A naked <code>=</code> is never valid in [=value definition syntax=],
so it's unambiguous when a new line starts a fresh definition.)
</div>


<h2 id="combining-values">
Combining Values: Interpolation, Addition, and Accumulation</h2>

Expand Down Expand Up @@ -5196,6 +5231,8 @@ Recent Changes</h3>
despite violation of the “avoid dataloss by default principle”--
given existing interoperability and presumed Web-compat restriction.
(<a href="https://github.com/w3c/csswg-drafts/issues/6454">Issue 6452</a>)
* Added an explicit definition for the [=CSS grammar production block=] convention.
(<a href="https://github.com/w3c/csswg-drafts/issues/2921">Issue 2921</a>)

Substantial changes since <a href="https://www.w3.org/TR/2023/WD-css-values-4-20230406/">6 April 2023 WD</a>:

Expand Down

0 comments on commit a4bfe38

Please sign in to comment.