diff options
author | Aleksey Kladov <[email protected]> | 2018-02-09 19:55:50 +0000 |
---|---|---|
committer | Aleksey Kladov <[email protected]> | 2018-02-09 19:55:50 +0000 |
commit | ac932df22a993f0b287e60aa42055405ef94a6ae (patch) | |
tree | 4d53f6d5e34a4244f0aaeb2039454e3594856324 | |
parent | 0ae26c344aa7477a18c2019cfa0062a9a745d70d (diff) |
reformat
-rw-r--r-- | src/lib.rs | 2 | ||||
-rw-r--r-- | src/parser/event.rs | 6 | ||||
-rw-r--r-- | src/parser/grammar/paths.rs | 2 | ||||
-rw-r--r-- | src/parser/parser.rs | 11 | ||||
-rw-r--r-- | src/tree/file_builder.rs | 2 | ||||
-rw-r--r-- | src/tree/mod.rs | 2 |
6 files changed, 11 insertions, 14 deletions
diff --git a/src/lib.rs b/src/lib.rs index f4a313b7a..153458644 100644 --- a/src/lib.rs +++ b/src/lib.rs | |||
@@ -25,7 +25,7 @@ mod parser; | |||
25 | pub mod syntax_kinds; | 25 | pub mod syntax_kinds; |
26 | pub use text::{TextRange, TextUnit}; | 26 | pub use text::{TextRange, TextUnit}; |
27 | pub use tree::{File, Node, SyntaxKind, Token}; | 27 | pub use tree::{File, Node, SyntaxKind, Token}; |
28 | pub(crate) use tree::{FileBuilder, Sink, ErrorMsg}; | 28 | pub(crate) use tree::{ErrorMsg, FileBuilder, Sink}; |
29 | pub use lexer::{next_token, tokenize}; | 29 | pub use lexer::{next_token, tokenize}; |
30 | pub use parser::parse; | 30 | pub use parser::parse; |
31 | 31 | ||
diff --git a/src/parser/event.rs b/src/parser/event.rs index 546dbcf62..90348398e 100644 --- a/src/parser/event.rs +++ b/src/parser/event.rs | |||
@@ -1,4 +1,4 @@ | |||
1 | use {File, FileBuilder, ErrorMsg, Sink, SyntaxKind, TextUnit, Token}; | 1 | use {ErrorMsg, File, FileBuilder, Sink, SyntaxKind, TextUnit, Token}; |
2 | use syntax_kinds::TOMBSTONE; | 2 | use syntax_kinds::TOMBSTONE; |
3 | use super::is_insignificant; | 3 | use super::is_insignificant; |
4 | 4 | ||
@@ -141,8 +141,8 @@ pub(super) fn to_file(text: String, tokens: &[Token], events: Vec<Event>) -> Fil | |||
141 | builder.leaf(kind, len); | 141 | builder.leaf(kind, len); |
142 | } | 142 | } |
143 | &Event::Error { ref message } => builder.error(ErrorMsg { | 143 | &Event::Error { ref message } => builder.error(ErrorMsg { |
144 | message: message.clone() | 144 | message: message.clone(), |
145 | }) | 145 | }), |
146 | } | 146 | } |
147 | } | 147 | } |
148 | builder.finish() | 148 | builder.finish() |
diff --git a/src/parser/grammar/paths.rs b/src/parser/grammar/paths.rs index 1aa30f28b..a7fc90774 100644 --- a/src/parser/grammar/paths.rs +++ b/src/parser/grammar/paths.rs | |||
@@ -45,7 +45,7 @@ fn path_segment(p: &mut Parser, first: bool) { | |||
45 | IDENT | SELF_KW | SUPER_KW => p.bump(), | 45 | IDENT | SELF_KW | SUPER_KW => p.bump(), |
46 | _ => { | 46 | _ => { |
47 | p.error("expected identifier"); | 47 | p.error("expected identifier"); |
48 | }, | 48 | } |
49 | }; | 49 | }; |
50 | segment.complete(p, PATH_SEGMENT); | 50 | segment.complete(p, PATH_SEGMENT); |
51 | } | 51 | } |
diff --git a/src/parser/parser.rs b/src/parser/parser.rs index 069701483..7c8e47cb6 100644 --- a/src/parser/parser.rs +++ b/src/parser/parser.rs | |||
@@ -27,9 +27,9 @@ impl Marker { | |||
27 | if idx == p.events.len() - 1 { | 27 | if idx == p.events.len() - 1 { |
28 | match p.events.pop() { | 28 | match p.events.pop() { |
29 | Some(Event::Start { | 29 | Some(Event::Start { |
30 | kind: TOMBSTONE, | 30 | kind: TOMBSTONE, |
31 | forward_parent: None, | 31 | forward_parent: None, |
32 | }) => (), | 32 | }) => (), |
33 | _ => unreachable!(), | 33 | _ => unreachable!(), |
34 | } | 34 | } |
35 | } | 35 | } |
@@ -188,9 +188,6 @@ impl<'p, 't: 'p> Drop for ErrorBuilder<'p, 't> { | |||
188 | 188 | ||
189 | impl<'t, 'p> ErrorBuilder<'p, 't> { | 189 | impl<'t, 'p> ErrorBuilder<'p, 't> { |
190 | fn new(parser: &'p mut Parser<'t>, message: String) -> Self { | 190 | fn new(parser: &'p mut Parser<'t>, message: String) -> Self { |
191 | ErrorBuilder { | 191 | ErrorBuilder { message, parser } |
192 | message, | ||
193 | parser, | ||
194 | } | ||
195 | } | 192 | } |
196 | } | 193 | } |
diff --git a/src/tree/file_builder.rs b/src/tree/file_builder.rs index 81702b83e..3c7e2d7cf 100644 --- a/src/tree/file_builder.rs +++ b/src/tree/file_builder.rs | |||
@@ -157,5 +157,5 @@ fn grow(left: &mut TextRange, right: TextRange) { | |||
157 | 157 | ||
158 | #[derive(Default)] | 158 | #[derive(Default)] |
159 | pub(crate) struct ErrorMsg { | 159 | pub(crate) struct ErrorMsg { |
160 | pub(crate) message: String | 160 | pub(crate) message: String, |
161 | } | 161 | } |
diff --git a/src/tree/mod.rs b/src/tree/mod.rs index b7ed59793..ebf26777b 100644 --- a/src/tree/mod.rs +++ b/src/tree/mod.rs | |||
@@ -4,7 +4,7 @@ use std::fmt; | |||
4 | use std::cmp; | 4 | use std::cmp; |
5 | 5 | ||
6 | mod file_builder; | 6 | mod file_builder; |
7 | pub(crate) use self::file_builder::{FileBuilder, Sink, ErrorMsg}; | 7 | pub(crate) use self::file_builder::{ErrorMsg, FileBuilder, Sink}; |
8 | 8 | ||
9 | pub use syntax_kinds::SyntaxKind; | 9 | pub use syntax_kinds::SyntaxKind; |
10 | 10 | ||