Skip to content

Commit dd3dd27

Browse files
committed
Mock up grammar in DocC's flavor of markdown.
1 parent 84cb927 commit dd3dd27

File tree

1 file changed

+50
-16
lines changed

1 file changed

+50
-16
lines changed

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

Lines changed: 50 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,15 @@ follows a few conventions:
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 `}`
38+
>
39+
> getter-setter-block → `{` getter-clause setter-clause-OPT `}` | `{` setter-clause getter-clause `}`
40+
>
41+
> getter-setter-block → `{` getter-clause setter-clause OPT `}` | `{` setter-clause getter-clause `}`
42+
>
43+
> getter-setter-block → `{` getter-clause setter-clause (opt) `}` | `{` setter-clause getter-clause `}`
4044
4145

4246
This definition indicates that a getter-setter block can consist of a getter clause
@@ -45,17 +49,47 @@ followed by an optional setter clause, enclosed in braces,
4549
The grammar production above is equivalent to the following two productions,
4650
where the alternatives are spelled out explicitly:
4751

48-
```
49-
Grammar of a getter-setter block
50-
51-
getter-setter-block --> ``{`` getter-clause setter-clause-OPT ``}``
52-
getter-setter-block --> ``{`` setter-clause getter-clause ``}``
53-
```
54-
55-
56-
*getter-setter-block*`{` *getter-clause* *setter-clause?* `}`
57-
58-
*getter-setter-block*`{` *setter-clause* *getter-clause* `}`
52+
> Grammar of a getter-setter block:
53+
>
54+
>
55+
> getter-setter-block → `{` getter-clause setter-clause? `}`
56+
>
57+
> getter-setter-block → `{` getter-clause setter-clause-OPT `}`
58+
>
59+
> getter-setter-block → `{` getter-clause setter-clause OPT `}`
60+
>
61+
> getter-setter-block → `{` getter-clause setter-clause (opt) `}`
62+
>
63+
> getter-setter-block → `{` setter-clause getter-clause `}`
64+
65+
> Grammar of a literal:
66+
>
67+
> literal → numeric-literal | string-literal | regular-expression-literal | boolean-literal | nil-literal
68+
>
69+
>
70+
> numeric-literal → `-`? integer-literal | `-`? floating-point-literal
71+
>
72+
> numeric-literal → `-`OPT integer-literal | `-`OPT floating-point-literal
73+
>
74+
> numeric-literal → `-` OPT integer-literal | `-` OPT floating-point-literal
75+
>
76+
> numeric-literal → `-` (opt) integer-literal | `-` (opt) floating-point-literal
77+
>
78+
> boolean-literal → `true` | `false`
79+
>
80+
> nil-literal → `nil`
81+
82+
83+
> Grammar of a literal:
84+
>
85+
> literal → numeric-literal | string-literal | regular-expression-literal | boolean-literal | nil-literal
86+
>
87+
>
88+
> numeric-literal → `-`opt integer-literal | `-`OPT floating-point-literal
89+
>
90+
> boolean-literal → `true` | `false`
91+
>
92+
> nil-literal → `nil`
5993
6094

6195
@Comment {

0 commit comments

Comments
 (0)