Skip to content

Commit 016c065

Browse files
ehusstraviscross
authored andcommitted
Apply some light edits to the rust grammar chapter
1 parent a13a4cf commit 016c065

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

reference-dev-guide/src/grammar.md

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
# Grammar
1+
# Rust grammar
22

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.
44

55
The code block should have a lang string with the word "grammar", a comma, and the category of the grammar, like this:
66

@@ -14,7 +14,7 @@ The category is used to group similar productions on the grammar summary page in
1414

1515
## Grammar syntax
1616

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.
1818

1919
A "root" production, marked with `@root`, is one that is not used in any other production.
2020

@@ -123,6 +123,9 @@ The general format is a series of productions separated by blank lines. The expr
123123

124124
## Automatic linking
125125

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]`.
127127

128128
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.
129+
130+
[`mdbook-spec`]: tooling/mdbook-spec.md
131+
[Notation chapter]: https://doc.rust-lang.org/nightly/reference/notation.html

0 commit comments

Comments
 (0)