Skip to content

Commit

Permalink
style(parser): Organize imports
Browse files Browse the repository at this point in the history
  • Loading branch information
epage committed Dec 22, 2022
1 parent dbc70a8 commit 2839693
Show file tree
Hide file tree
Showing 9 changed files with 47 additions and 34 deletions.
7 changes: 4 additions & 3 deletions crates/toml_edit/src/parser/array.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
use crate::parser::trivia::ws_comment_newline;
use crate::parser::value::value;
use crate::{Array, Value};
use combine::parser::byte::byte;
use combine::parser::range::recognize_with_value;
use combine::stream::RangeStream;
use combine::*;

use crate::parser::trivia::ws_comment_newline;
use crate::parser::value::value;
use crate::{Array, Value};

// ;; Array

// array = array-open array-values array-close
Expand Down
14 changes: 8 additions & 6 deletions crates/toml_edit/src/parser/document.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
use std::cell::RefCell;

use combine::parser::byte::byte;
use combine::stream::position::{IndexPositioner, Positioner, Stream};
use combine::stream::RangeStream;
use combine::Parser;
use combine::*;

use crate::document::Document;
use crate::key::Key;
use crate::parser::inline_table::KEYVAL_SEP;
Expand All @@ -8,12 +16,6 @@ use crate::parser::value::value;
use crate::parser::{ParseState, TomlError};
use crate::table::TableKeyValue;
use crate::Item;
use combine::parser::byte::byte;
use combine::stream::position::{IndexPositioner, Positioner, Stream};
use combine::stream::RangeStream;
use combine::Parser;
use combine::*;
use std::cell::RefCell;

// ;; TOML

Expand Down
8 changes: 5 additions & 3 deletions crates/toml_edit/src/parser/errors.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
use crate::Key;
use std::error::Error as StdError;
use std::fmt::{Display, Formatter, Result};

use combine::easy::Errors as ParseError;
use combine::stream::easy::Error;
use combine::stream::position::SourcePosition;
use itertools::Itertools;
use std::error::Error as StdError;
use std::fmt::{Display, Formatter, Result};

use crate::Key;

/// Type representing a TOML parse error
#[derive(Debug, Clone, Eq, PartialEq, Hash)]
Expand Down
9 changes: 5 additions & 4 deletions crates/toml_edit/src/parser/inline_table.rs
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
use combine::parser::byte::byte;
use combine::stream::RangeStream;
use combine::*;
use indexmap::map::Entry;

use crate::key::Key;
use crate::parser::errors::CustomError;
use crate::parser::key::key;
use crate::parser::trivia::ws;
use crate::parser::value::value;
use crate::table::TableKeyValue;
use crate::{InlineTable, InternalString, Item, Value};
use combine::parser::byte::byte;
use combine::stream::RangeStream;
use combine::*;
use indexmap::map::Entry;

// ;; Inline Table

Expand Down
9 changes: 5 additions & 4 deletions crates/toml_edit/src/parser/key.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
use combine::parser::byte::byte;
use combine::parser::range::{recognize_with_value, take_while1};
use combine::stream::RangeStream;
use combine::*;

use crate::key::Key;
use crate::parser::strings::{basic_string, literal_string};
use crate::parser::trivia::{from_utf8_unchecked, ws};
use crate::repr::{Decor, Repr};
use crate::InternalString;
use combine::parser::byte::byte;
use combine::parser::range::{recognize_with_value, take_while1};
use combine::stream::RangeStream;
use combine::*;

// key = simple-key / dotted-key
// dotted-key = simple-key 1*( dot-sep simple-key )
Expand Down
3 changes: 2 additions & 1 deletion crates/toml_edit/src/parser/numbers.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
use crate::parser::trivia::from_utf8_unchecked;
use combine::parser::byte::{byte, bytes, digit, hex_digit, oct_digit};
use combine::parser::range::{range, recognize};
use combine::stream::RangeStream;
use combine::*;

use crate::parser::trivia::from_utf8_unchecked;

// ;; Boolean

// boolean = true / false
Expand Down
14 changes: 8 additions & 6 deletions crates/toml_edit/src/parser/strings.rs
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
use crate::parser::errors::CustomError;
use crate::parser::trivia::{
from_utf8_unchecked, is_non_ascii, is_wschar, newline, ws, ws_newlines,
};
use std::borrow::Cow;
use std::char;

use combine::error::Commit;
use combine::parser::byte::{byte, bytes, hex_digit};
use combine::parser::range::{range, recognize, take_while, take_while1};
use combine::stream::RangeStream;
use combine::*;
use std::borrow::Cow;
use std::char;

use crate::parser::errors::CustomError;
use crate::parser::trivia::{
from_utf8_unchecked, is_non_ascii, is_wschar, newline, ws, ws_newlines,
};

// ;; String

Expand Down
10 changes: 6 additions & 4 deletions crates/toml_edit/src/parser/table.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
use crate::parser::key::key;
use crate::parser::trivia::line_trailing;
use crate::parser::ParseState;
use std::cell::RefCell;

use combine::parser::byte::byte;
use combine::parser::range::range;
use combine::stream::RangeStream;
use combine::*;
use std::cell::RefCell;

use crate::parser::key::key;
use crate::parser::trivia::line_trailing;
use crate::parser::ParseState;

// std-table-open = %x5B ws ; [ Left square bracket
pub(crate) const STD_TABLE_OPEN: u8 = b'[';
Expand Down
7 changes: 4 additions & 3 deletions crates/toml_edit/src/parser/value.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
use combine::parser::range::recognize_with_value;
use combine::stream::RangeStream;
use combine::*;

use crate::parser::array::array;
use crate::parser::datetime::date_time;
use crate::parser::inline_table::inline_table;
Expand All @@ -7,9 +11,6 @@ use crate::parser::trivia::from_utf8_unchecked;
use crate::repr::{Formatted, Repr};
use crate::value as v;
use crate::Value;
use combine::parser::range::recognize_with_value;
use combine::stream::RangeStream;
use combine::*;

// val = string / boolean / array / inline-table / date-time / float / integer
parse!(value() -> v::Value, {
Expand Down

0 comments on commit 2839693

Please sign in to comment.