You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: contributor-guide/src/grammar.md
+7-4Lines changed: 7 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,6 @@
1
-
# Grammar
1
+
# Rust grammar
2
2
3
-
The Reference grammar is written in markdown code blocks using a modified BNF-like syntax (with a blend of regex and other arbitrary things). The `mdbook-spec` extension parses these rules and converts them to a renderable format, including railroad diagrams.
3
+
The Reference grammar is written in markdown code blocks using a modified BNF-like syntax (with a blend of regex and other arbitrary things). The [`mdbook-spec`] extension parses these rules and converts them to a renderable format, including railroad diagrams.
4
4
5
5
The code block should have a lang string with the word "grammar", a comma, and the category of the grammar, like this:
6
6
@@ -14,7 +14,7 @@ The category is used to group similar productions on the grammar summary page in
14
14
15
15
## Grammar syntax
16
16
17
-
The syntax for the grammar itself is pretty close to what is described in the [Notation chapter](../src/notation.md), though there are some rendering differences.
17
+
The syntax for the grammar itself is pretty close to what is described in the [Notation chapter], though there are some rendering differences.
18
18
19
19
A "root" production, marked with `@root`, is one that is not used in any other production.
20
20
@@ -123,6 +123,9 @@ The general format is a series of productions separated by blank lines. The expr
123
123
124
124
## Automatic linking
125
125
126
-
The plugin automatically adds markdown link definitions for all the production names on every page. If you want to link directly to a production name, all you need to do is surround it in square brackets, like `[ArrayExpression]`.
126
+
The [`mdbook-spec`]plugin automatically adds markdown link definitions for all the production names on every page. If you want to link directly to a production name, all you need to do is surround it in square brackets, like `[ArrayExpression]`.
127
127
128
128
In some cases there might be name collisions with the automatic linking of rule names. In that case, disambiguate with the `grammar-` prefix, such as `[Type][grammar-Type]`. You can also do that if you just feel like being more explicit.
0 commit comments