aboutsummaryrefslogtreecommitdiff
path: root/src/parser/grammar
diff options
context:
space:
mode:
Diffstat (limited to 'src/parser/grammar')
-rw-r--r--src/parser/grammar/items/mod.rs4
-rw-r--r--src/parser/grammar/mod.rs26
2 files changed, 27 insertions, 3 deletions
diff --git a/src/parser/grammar/items/mod.rs b/src/parser/grammar/items/mod.rs
index 18ee8af86..3af6d13a1 100644
--- a/src/parser/grammar/items/mod.rs
+++ b/src/parser/grammar/items/mod.rs
@@ -94,7 +94,7 @@ fn item(p: &mut Parser) {
94 94
95 // test unsafe_auto_trait 95 // test unsafe_auto_trait
96 // unsafe auto trait T {} 96 // unsafe auto trait T {}
97 IDENT if p.at_kw("auto") && la == TRAIT_KW => { 97 IDENT if p.at_contextual_kw("auto") && la == TRAIT_KW => {
98 p.bump_remap(AUTO_KW); 98 p.bump_remap(AUTO_KW);
99 traits::trait_item(p); 99 traits::trait_item(p);
100 TRAIT_ITEM 100 TRAIT_ITEM
@@ -109,7 +109,7 @@ fn item(p: &mut Parser) {
109 109
110 // test unsafe_default_impl 110 // test unsafe_default_impl
111 // unsafe default impl Foo {} 111 // unsafe default impl Foo {}
112 IDENT if p.at_kw("default") && la == IMPL_KW => { 112 IDENT if p.at_contextual_kw("default") && la == IMPL_KW => {
113 p.bump_remap(DEFAULT_KW); 113 p.bump_remap(DEFAULT_KW);
114 traits::impl_item(p); 114 traits::impl_item(p);
115 IMPL_ITEM 115 IMPL_ITEM
diff --git a/src/parser/grammar/mod.rs b/src/parser/grammar/mod.rs
index f5b63aaab..ee0263203 100644
--- a/src/parser/grammar/mod.rs
+++ b/src/parser/grammar/mod.rs
@@ -1,4 +1,28 @@
1use super::parser::{Parser, TokenSet}; 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.
24use parser::parser::Parser;
25use parser::token_set::TokenSet;
2use SyntaxKind; 26use SyntaxKind;
3use syntax_kinds::*; 27use syntax_kinds::*;
4 28