aboutsummaryrefslogtreecommitdiff
path: root/src/parser
diff options
context:
space:
mode:
Diffstat (limited to 'src/parser')
-rw-r--r--src/parser/event.rs4
-rw-r--r--src/parser/grammar/items/mod.rs9
-rw-r--r--src/parser/grammar/mod.rs11
-rw-r--r--src/parser/input.rs6
-rw-r--r--src/parser/mod.rs10
-rw-r--r--src/parser/parser/imp.rs2
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.
10use { 10use {
11 TextUnit,
12 SyntaxKind::{self, TOMBSTONE},
13 lexer::Token, 11 lexer::Token,
12 SyntaxKind::{self, TOMBSTONE},
13 TextUnit,
14}; 14};
15 15
16pub(crate) trait Sink { 16pub(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 @@
1use super::*; 1use super::*;
2 2
3mod structs;
4mod use_item;
5mod consts; 3mod consts;
4mod structs;
6mod traits; 5mod traits;
6mod use_item;
7 7
8pub(super) fn mod_contents(p: &mut Parser, stop_on_r_curly: bool) { 8pub(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
15pub(super) const ITEM_FIRST: TokenSet = token_set![ 15pub(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
19fn item(p: &mut Parser) { 18fn 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.
24mod items;
25mod attributes; 24mod attributes;
26mod expressions; 25mod expressions;
27mod types; 26mod items;
28mod patterns;
29mod paths; 27mod paths;
28mod patterns;
30mod type_params; 29mod type_params;
30mod types;
31 31
32use { 32use {
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
40pub(crate) fn file(p: &mut Parser) { 37pub(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 @@
1use { 1use {lexer::Token, SyntaxKind, SyntaxKind::EOF, TextRange, TextUnit};
2 SyntaxKind, TextRange, TextUnit,
3 SyntaxKind::EOF,
4 lexer::Token,
5};
6 2
7use std::ops::{Add, AddAssign}; 3use 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]
2mod token_set; 2mod token_set;
3mod parser;
4mod input;
5mod event; 3mod event;
6mod grammar; 4mod grammar;
5mod input;
6mod parser;
7 7
8use { 8use {lexer::Token, parser::event::process};
9 lexer::Token,
10 parser::event::{process}
11};
12 9
13pub(crate) use self::event::Sink; 10pub(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
17pub(crate) fn parse<S: Sink>(text: String, tokens: &[Token]) -> S::Tree { 13pub(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 @@
1use parser::input::{InputPosition, ParserInput};
2use parser::event::Event; 1use parser::event::Event;
2use parser::input::{InputPosition, ParserInput};
3 3
4use SyntaxKind::{self, EOF, TOMBSTONE}; 4use SyntaxKind::{self, EOF, TOMBSTONE};
5 5