Skip to content

Commit 7786052

Browse files
authored
Merge branch 'main' into blank_lines
2 parents 6fd02f8 + 064abd1 commit 7786052

File tree

11 files changed

+3294
-1167
lines changed

11 files changed

+3294
-1167
lines changed

Sources/TSPL/TSPL.docc/ReferenceManual/AboutTheLanguageReference.md

Lines changed: 11 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -20,40 +20,34 @@ follows a few conventions:
2020
- An arrow (→) is used to mark grammar productions and can be read as "can consist of."
2121
- Syntactic categories are indicated by *italic* text and appear on both sides
2222
of a grammar production rule.
23-
- Literal words and punctuation are indicated by boldface `constant width` text
23+
- Literal words and punctuation are indicated by **`boldface constant width`** text
2424
and appear only on the right-hand side of a grammar production rule.
2525
- Alternative grammar productions are separated by vertical
2626
bars (|). When alternative productions are too long to read easily,
2727
they're broken into multiple grammar production rules on new lines.
2828
- In a few cases, regular font text is used to describe the right-hand side
2929
of a grammar production rule.
3030
- Optional syntactic categories and literals are marked by a trailing
31-
subscript, *opt*.
31+
question mark, *?*.
3232

3333
As an example, the grammar of a getter-setter block is defined as follows:
3434

35-
```
36-
Grammar of a getter-setter block
37-
38-
getter-setter-block --> ``{`` getter-clause setter-clause-OPT ``}`` | ``{`` setter-clause getter-clause ``}``
39-
```
35+
> Grammar of a getter-setter block:
36+
>
37+
> *getter-setter-block***`{`** *getter-clause* *setter-clause*_?_ **`}`** | **`{`** *setter-clause* *getter-clause* **`}`**
4038
4139
This definition indicates that a getter-setter block can consist of a getter clause
4240
followed by an optional setter clause, enclosed in braces,
4341
*or* a setter clause followed by a getter clause, enclosed in braces.
4442
The grammar production above is equivalent to the following two productions,
4543
where the alternatives are spelled out explicitly:
4644

47-
```
48-
Grammar of a getter-setter block
49-
50-
getter-setter-block --> ``{`` getter-clause setter-clause-OPT ``}``
51-
getter-setter-block --> ``{`` setter-clause getter-clause ``}``
52-
```
53-
54-
*getter-setter-block*`{` *getter-clause* *setter-clause?* `}`
55-
56-
*getter-setter-block*`{` *setter-clause* *getter-clause* `}`
45+
> Grammar of a getter-setter block:
46+
>
47+
>
48+
> *getter-setter-block***`{`** *getter-clause* *setter-clause*_?_ **`}`**
49+
>
50+
> *getter-setter-block***`{`** *setter-clause* *getter-clause* **`}`**
5751
5852
<!--
5953
This source file is part of the Swift.org open source project

Sources/TSPL/TSPL.docc/ReferenceManual/Attributes.md

Lines changed: 24 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2218,21 +2218,30 @@ at the time the code is compiled.
22182218
For an example of how to use the `unknown` attribute,
22192219
see <doc:Statements#Switching-Over-Future-Enumeration-Cases>.
22202220

2221-
```
2222-
Grammar of an attribute
2223-
2224-
attribute --> ``@`` attribute-name attribute-argument-clause-OPT
2225-
attribute-name --> identifier
2226-
attribute-argument-clause --> ``(`` balanced-tokens-OPT ``)``
2227-
attributes --> attribute attributes-OPT
2228-
2229-
balanced-tokens --> balanced-token balanced-tokens-OPT
2230-
balanced-token --> ``(`` balanced-tokens-OPT ``)``
2231-
balanced-token --> ``[`` balanced-tokens-OPT ``]``
2232-
balanced-token --> ``{`` balanced-tokens-OPT ``}``
2233-
balanced-token --> Any identifier, keyword, literal, or operator
2234-
balanced-token --> Any punctuation except ``(``, ``)``, ``[``, ``]``, ``{``, or ``}``
2235-
```
2221+
> Grammar of an attribute:
2222+
>
2223+
> *attribute***`@`** *attribute-name* *attribute-argument-clause*_?_
2224+
>
2225+
> *attribute-name**identifier*
2226+
>
2227+
> *attribute-argument-clause***`(`** *balanced-tokens*_?_ **`)`**
2228+
>
2229+
> *attributes**attribute* *attributes*_?_
2230+
>
2231+
>
2232+
>
2233+
> *balanced-tokens**balanced-token* *balanced-tokens*_?_
2234+
>
2235+
> *balanced-token***`(`** *balanced-tokens*_?_ **`)`**
2236+
>
2237+
> *balanced-token***`[`** *balanced-tokens*_?_ **`]`**
2238+
>
2239+
> *balanced-token***`{`** *balanced-tokens*_?_ **`}`**
2240+
>
2241+
> *balanced-token* → Any identifier, keyword, literal, or operator
2242+
>
2243+
> *balanced-token* → Any punctuation except **`(`**, **`)`**, **`[`**, **`]`**, **`{`**, or **`}`**
2244+
22362245

22372246
<!--
22382247
This source file is part of the Swift.org open source project

0 commit comments

Comments
 (0)