diff options
author | Christopher Durham <[email protected]> | 2018-01-27 23:51:12 +0000 |
---|---|---|
committer | GitHub <[email protected]> | 2018-01-27 23:51:12 +0000 |
commit | e6e61251abb68b3e6a47fd3708f4dea6059a9ec3 (patch) | |
tree | c22cfa06a26add11f3aefca3806f0009dd25d923 /src/bin | |
parent | 357cd3358167daa38f3ff34d225e1501faff6015 (diff) | |
parent | 9140b3e7286efae57ee8c49c7bfcad8737f9c6fc (diff) |
Merge pull request #12 from CAD97/enforce-fmt
Enforce rustfmt format
Diffstat (limited to 'src/bin')
-rw-r--r-- | src/bin/gen.rs | 21 | ||||
-rw-r--r-- | src/bin/parse-rust.rs | 2 |
2 files changed, 14 insertions, 9 deletions
diff --git a/src/bin/gen.rs b/src/bin/gen.rs index 5ebf3e2e8..8f6402f5c 100644 --- a/src/bin/gen.rs +++ b/src/bin/gen.rs | |||
@@ -2,8 +2,8 @@ extern crate serde; | |||
2 | #[macro_use] | 2 | #[macro_use] |
3 | extern crate serde_derive; | 3 | extern crate serde_derive; |
4 | 4 | ||
5 | extern crate ron; | ||
6 | extern crate file; | 5 | extern crate file; |
6 | extern crate ron; | ||
7 | 7 | ||
8 | use std::path::PathBuf; | 8 | use std::path::PathBuf; |
9 | use std::fmt::Write; | 9 | use std::fmt::Write; |
@@ -33,11 +33,12 @@ impl Grammar { | |||
33 | acc.push_str("use tree::{SyntaxKind, SyntaxInfo};\n"); | 33 | acc.push_str("use tree::{SyntaxKind, SyntaxInfo};\n"); |
34 | acc.push_str("\n"); | 34 | acc.push_str("\n"); |
35 | 35 | ||
36 | let syntax_kinds: Vec<String> = | 36 | let syntax_kinds: Vec<String> = self.keywords |
37 | self.keywords.iter().map(|kw| kw_token(kw)) | 37 | .iter() |
38 | .chain(self.tokens.iter().cloned()) | 38 | .map(|kw| kw_token(kw)) |
39 | .chain(self.nodes.iter().cloned()) | 39 | .chain(self.tokens.iter().cloned()) |
40 | .collect(); | 40 | .chain(self.nodes.iter().cloned()) |
41 | .collect(); | ||
41 | 42 | ||
42 | for (idx, kind) in syntax_kinds.iter().enumerate() { | 43 | for (idx, kind) in syntax_kinds.iter().enumerate() { |
43 | let sname = scream(kind); | 44 | let sname = scream(kind); |
@@ -48,7 +49,11 @@ impl Grammar { | |||
48 | ).unwrap(); | 49 | ).unwrap(); |
49 | } | 50 | } |
50 | acc.push_str("\n"); | 51 | acc.push_str("\n"); |
51 | write!(acc, "static INFOS: [SyntaxInfo; {}] = [\n", syntax_kinds.len()).unwrap(); | 52 | write!( |
53 | acc, | ||
54 | "static INFOS: [SyntaxInfo; {}] = [\n", | ||
55 | syntax_kinds.len() | ||
56 | ).unwrap(); | ||
52 | for kind in syntax_kinds.iter() { | 57 | for kind in syntax_kinds.iter() { |
53 | let sname = scream(kind); | 58 | let sname = scream(kind); |
54 | write!( | 59 | write!( |
@@ -91,4 +96,4 @@ fn scream(word: &str) -> String { | |||
91 | 96 | ||
92 | fn kw_token(keyword: &str) -> String { | 97 | fn kw_token(keyword: &str) -> String { |
93 | format!("{}_KW", scream(keyword)) | 98 | format!("{}_KW", scream(keyword)) |
94 | } \ No newline at end of file | 99 | } |
diff --git a/src/bin/parse-rust.rs b/src/bin/parse-rust.rs index 3c13e732e..af1325bfc 100644 --- a/src/bin/parse-rust.rs +++ b/src/bin/parse-rust.rs | |||
@@ -2,7 +2,7 @@ extern crate libsyntax2; | |||
2 | 2 | ||
3 | use std::io::Read; | 3 | use std::io::Read; |
4 | 4 | ||
5 | use libsyntax2::{tokenize, parse}; | 5 | use libsyntax2::{parse, tokenize}; |
6 | use libsyntax2::utils::dump_tree; | 6 | use libsyntax2::utils::dump_tree; |
7 | 7 | ||
8 | fn main() { | 8 | fn main() { |