diff options
author | Aleksey Kladov <[email protected]> | 2018-02-11 14:58:22 +0000 |
---|---|---|
committer | Aleksey Kladov <[email protected]> | 2018-02-11 14:58:22 +0000 |
commit | 59087840f515c809498f09ec535e59054a893525 (patch) | |
tree | 282e1f9606dbeeba6c19a2dcd6ff94da420d155a /src/parser/grammar | |
parent | 9e2c0564783aa91f6440e7cadcc1a4dfda785de0 (diff) |
Document how the parsing works
Diffstat (limited to 'src/parser/grammar')
-rw-r--r-- | src/parser/grammar/mod.rs | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/src/parser/grammar/mod.rs b/src/parser/grammar/mod.rs index e29cf9b02..ee0263203 100644 --- a/src/parser/grammar/mod.rs +++ b/src/parser/grammar/mod.rs | |||
@@ -1,4 +1,27 @@ | |||
1 | use parser::parser::{Parser}; | 1 | //! This is the actual "grammar" of the Rust language. |
2 | //! | ||
3 | //! Each function in this module and its children corresponds | ||
4 | //! to a production of the format grammar. Submodules roughly | ||
5 | //! correspond to different *areas* of the grammar. By convention, | ||
6 | //! each submodule starts with `use super::*` import and exports | ||
7 | //! "public" productions via `pub(super)`. | ||
8 | //! | ||
9 | //! See docs for `Parser` to learn about API, available to the grammar, | ||
10 | //! and see docs for `Event` to learn how this actually manages to | ||
11 | //! produce parse trees. | ||
12 | //! | ||
13 | //! Code in this module also contains inline tests, which start with | ||
14 | //! `// test name-of-the-test` comment and look like this: | ||
15 | //! | ||
16 | //! ``` | ||
17 | //! // test fn_item_with_zero_parameters | ||
18 | //! // fn foo() {} | ||
19 | //! ``` | ||
20 | //! | ||
21 | //! After adding a new inline-test, run `cargo collect-tests` to extract | ||
22 | //! it as a standalone text-fixture into `tests/data/parser/inline`, and | ||
23 | //! run `cargo test` once to create the "gold" value. | ||
24 | use parser::parser::Parser; | ||
2 | use parser::token_set::TokenSet; | 25 | use parser::token_set::TokenSet; |
3 | use SyntaxKind; | 26 | use SyntaxKind; |
4 | use syntax_kinds::*; | 27 | use syntax_kinds::*; |