diff options
Diffstat (limited to 'src/parser')
-rw-r--r-- | src/parser/event.rs | 4 | ||||
-rw-r--r-- | src/parser/grammar/items/mod.rs | 9 | ||||
-rw-r--r-- | src/parser/grammar/mod.rs | 11 | ||||
-rw-r--r-- | src/parser/input.rs | 6 | ||||
-rw-r--r-- | src/parser/mod.rs | 10 | ||||
-rw-r--r-- | src/parser/parser/imp.rs | 2 |
6 files changed, 15 insertions, 27 deletions
diff --git a/src/parser/event.rs b/src/parser/event.rs index a8d503b3d..0086d32ea 100644 --- a/src/parser/event.rs +++ b/src/parser/event.rs | |||
@@ -8,9 +8,9 @@ | |||
8 | //! `start node`, `finish node`, and `FileBuilder` converts | 8 | //! `start node`, `finish node`, and `FileBuilder` converts |
9 | //! this stream to a real tree. | 9 | //! this stream to a real tree. |
10 | use { | 10 | use { |
11 | TextUnit, | ||
12 | SyntaxKind::{self, TOMBSTONE}, | ||
13 | lexer::Token, | 11 | lexer::Token, |
12 | SyntaxKind::{self, TOMBSTONE}, | ||
13 | TextUnit, | ||
14 | }; | 14 | }; |
15 | 15 | ||
16 | pub(crate) trait Sink { | 16 | pub(crate) trait Sink { |
diff --git a/src/parser/grammar/items/mod.rs b/src/parser/grammar/items/mod.rs index 1fe646652..5d8d57a80 100644 --- a/src/parser/grammar/items/mod.rs +++ b/src/parser/grammar/items/mod.rs | |||
@@ -1,9 +1,9 @@ | |||
1 | use super::*; | 1 | use super::*; |
2 | 2 | ||
3 | mod structs; | ||
4 | mod use_item; | ||
5 | mod consts; | 3 | mod consts; |
4 | mod structs; | ||
6 | mod traits; | 5 | mod traits; |
6 | mod use_item; | ||
7 | 7 | ||
8 | pub(super) fn mod_contents(p: &mut Parser, stop_on_r_curly: bool) { | 8 | pub(super) fn mod_contents(p: &mut Parser, stop_on_r_curly: bool) { |
9 | attributes::inner_attributes(p); | 9 | attributes::inner_attributes(p); |
@@ -12,9 +12,8 @@ pub(super) fn mod_contents(p: &mut Parser, stop_on_r_curly: bool) { | |||
12 | } | 12 | } |
13 | } | 13 | } |
14 | 14 | ||
15 | pub(super) const ITEM_FIRST: TokenSet = token_set![ | 15 | pub(super) const ITEM_FIRST: TokenSet = |
16 | EXTERN_KW, MOD_KW, USE_KW, STRUCT_KW, ENUM_KW, FN_KW, PUB_KW, POUND | 16 | token_set![EXTERN_KW, MOD_KW, USE_KW, STRUCT_KW, ENUM_KW, FN_KW, PUB_KW, POUND]; |
17 | ]; | ||
18 | 17 | ||
19 | fn item(p: &mut Parser) { | 18 | fn item(p: &mut Parser) { |
20 | let item = p.start(); | 19 | let item = p.start(); |
diff --git a/src/parser/grammar/mod.rs b/src/parser/grammar/mod.rs index 085e62d56..e24f1055e 100644 --- a/src/parser/grammar/mod.rs +++ b/src/parser/grammar/mod.rs | |||
@@ -21,20 +21,17 @@ | |||
21 | //! After adding a new inline-test, run `cargo collect-tests` to extract | 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 | 22 | //! it as a standalone text-fixture into `tests/data/parser/inline`, and |
23 | //! run `cargo test` once to create the "gold" value. | 23 | //! run `cargo test` once to create the "gold" value. |
24 | mod items; | ||
25 | mod attributes; | 24 | mod attributes; |
26 | mod expressions; | 25 | mod expressions; |
27 | mod types; | 26 | mod items; |
28 | mod patterns; | ||
29 | mod paths; | 27 | mod paths; |
28 | mod patterns; | ||
30 | mod type_params; | 29 | mod type_params; |
30 | mod types; | ||
31 | 31 | ||
32 | use { | 32 | use { |
33 | parser::{parser::Parser, token_set::TokenSet}, | ||
33 | SyntaxKind::{self, *}, | 34 | SyntaxKind::{self, *}, |
34 | parser::{ | ||
35 | parser::Parser, | ||
36 | token_set::TokenSet | ||
37 | } | ||
38 | }; | 35 | }; |
39 | 36 | ||
40 | pub(crate) fn file(p: &mut Parser) { | 37 | pub(crate) fn file(p: &mut Parser) { |
diff --git a/src/parser/input.rs b/src/parser/input.rs index 052981fbc..db76364b2 100644 --- a/src/parser/input.rs +++ b/src/parser/input.rs | |||
@@ -1,8 +1,4 @@ | |||
1 | use { | 1 | use {lexer::Token, SyntaxKind, SyntaxKind::EOF, TextRange, TextUnit}; |
2 | SyntaxKind, TextRange, TextUnit, | ||
3 | SyntaxKind::EOF, | ||
4 | lexer::Token, | ||
5 | }; | ||
6 | 2 | ||
7 | use std::ops::{Add, AddAssign}; | 3 | use std::ops::{Add, AddAssign}; |
8 | 4 | ||
diff --git a/src/parser/mod.rs b/src/parser/mod.rs index e72ab05af..8631baa2e 100644 --- a/src/parser/mod.rs +++ b/src/parser/mod.rs | |||
@@ -1,18 +1,14 @@ | |||
1 | #[macro_use] | 1 | #[macro_use] |
2 | mod token_set; | 2 | mod token_set; |
3 | mod parser; | ||
4 | mod input; | ||
5 | mod event; | 3 | mod event; |
6 | mod grammar; | 4 | mod grammar; |
5 | mod input; | ||
6 | mod parser; | ||
7 | 7 | ||
8 | use { | 8 | use {lexer::Token, parser::event::process}; |
9 | lexer::Token, | ||
10 | parser::event::{process} | ||
11 | }; | ||
12 | 9 | ||
13 | pub(crate) use self::event::Sink; | 10 | pub(crate) use self::event::Sink; |
14 | 11 | ||
15 | |||
16 | /// Parse a sequence of tokens into the representative node tree | 12 | /// Parse a sequence of tokens into the representative node tree |
17 | pub(crate) fn parse<S: Sink>(text: String, tokens: &[Token]) -> S::Tree { | 13 | pub(crate) fn parse<S: Sink>(text: String, tokens: &[Token]) -> S::Tree { |
18 | let events = { | 14 | let events = { |
diff --git a/src/parser/parser/imp.rs b/src/parser/parser/imp.rs index 38237ac06..c653e3524 100644 --- a/src/parser/parser/imp.rs +++ b/src/parser/parser/imp.rs | |||
@@ -1,5 +1,5 @@ | |||
1 | use parser::input::{InputPosition, ParserInput}; | ||
2 | use parser::event::Event; | 1 | use parser::event::Event; |
2 | use parser::input::{InputPosition, ParserInput}; | ||
3 | 3 | ||
4 | use SyntaxKind::{self, EOF, TOMBSTONE}; | 4 | use SyntaxKind::{self, EOF, TOMBSTONE}; |
5 | 5 | ||