diff options
author | René Kijewski <rene.kijewski@fu-berlin.de> | 2023-08-01 10:39:24 +0200 |
---|---|---|
committer | Dirkjan Ochtman <dirkjan@ochtman.nl> | 2023-08-01 13:04:41 +0200 |
commit | cdfe287b730a748f0601da2bc471d056c72c0559 (patch) | |
tree | 894d09427e3f8791af7d9196b45f387acb550b71 | |
parent | 1521a08a20b6631b54d4ecbbbfcb4260e393bc97 (diff) | |
download | askama-cdfe287b730a748f0601da2bc471d056c72c0559.tar.gz askama-cdfe287b730a748f0601da2bc471d056c72c0559.tar.bz2 askama-cdfe287b730a748f0601da2bc471d056c72c0559.zip |
parser: remove re-exports `parser::{node,expr}::*`
-rw-r--r-- | askama_derive/src/config.rs | 4 | ||||
-rw-r--r-- | askama_derive/src/generator.rs | 8 | ||||
-rw-r--r-- | askama_derive/src/heritage.rs | 3 | ||||
-rw-r--r-- | askama_parser/src/lib.rs | 15 | ||||
-rw-r--r-- | askama_parser/src/node.rs | 4 | ||||
-rw-r--r-- | askama_parser/src/tests.rs | 6 |
6 files changed, 22 insertions, 18 deletions
diff --git a/askama_derive/src/config.rs b/askama_derive/src/config.rs index 6533fdc..a4eec28 100644 --- a/askama_derive/src/config.rs +++ b/askama_derive/src/config.rs @@ -6,7 +6,9 @@ use std::{env, fs}; use serde::Deserialize; use crate::CompileError; -use parser::{Syntax, Whitespace}; + +use parser::node::Whitespace; +use parser::Syntax; #[derive(Debug)] pub(crate) struct Config<'a> { diff --git a/askama_derive/src/generator.rs b/askama_derive/src/generator.rs index f33829d..6e04a1a 100644 --- a/askama_derive/src/generator.rs +++ b/askama_derive/src/generator.rs @@ -2,10 +2,12 @@ use crate::config::{get_template_source, read_config_file, Config, WhitespaceHan use crate::heritage::{Context, Heritage}; use crate::input::{Print, Source, TemplateInput}; use crate::CompileError; -use parser::{ - Call, CondTest, Expr, If, Include, Let, Lit, Loop, Match, Node, Parsed, Target, Whitespace, Ws, -}; +use parser::expr::Expr; +use parser::node::{ + Call, CondTest, If, Include, Let, Lit, Loop, Match, Node, Target, Whitespace, Ws, +}; +use parser::Parsed; use proc_macro::TokenStream; use quote::{quote, ToTokens}; use syn::punctuated::Punctuated; diff --git a/askama_derive/src/heritage.rs b/askama_derive/src/heritage.rs index f09b83e..d34ef33 100644 --- a/askama_derive/src/heritage.rs +++ b/askama_derive/src/heritage.rs @@ -3,7 +3,8 @@ use std::path::{Path, PathBuf}; use crate::config::Config; use crate::CompileError; -use parser::{BlockDef, Loop, Macro, Match, Node}; + +use parser::node::{BlockDef, Loop, Macro, Match, Node}; pub(crate) struct Heritage<'a> { pub(crate) root: &'a Context<'a>, diff --git a/askama_parser/src/lib.rs b/askama_parser/src/lib.rs index bd7edde..25d164f 100644 --- a/askama_parser/src/lib.rs +++ b/askama_parser/src/lib.rs @@ -14,14 +14,10 @@ use nom::multi::separated_list1; use nom::sequence::{delimited, pair, tuple}; use nom::{error_position, AsChar, IResult, InputTakeAtPosition}; -pub use self::expr::Expr; -pub use self::node::{ - BlockDef, Call, Cond, CondTest, Extends, If, Import, Include, Let, Lit, Loop, Macro, Match, - Node, Raw, Target, When, Whitespace, Ws, -}; - -mod expr; -mod node; +pub mod expr; +pub use expr::Expr; +pub mod node; +pub use node::Node; #[cfg(test)] mod tests; @@ -29,7 +25,8 @@ mod _parsed { use std::cmp::PartialEq; use std::{fmt, mem}; - use super::{Ast, Node, ParseError, Syntax}; + use super::node::Node; + use super::{Ast, ParseError, Syntax}; pub struct Parsed { // `source` must outlive `ast`, so `ast` must be declared before `source` diff --git a/askama_parser/src/node.rs b/askama_parser/src/node.rs index b955549..89ffae1 100644 --- a/askama_parser/src/node.rs +++ b/askama_parser/src/node.rs @@ -9,9 +9,9 @@ use nom::multi::{fold_many0, many0, many1, separated_list0, separated_list1}; use nom::sequence::{delimited, pair, preceded, terminated, tuple}; use nom::{error_position, IResult}; +use super::expr::Expr; use super::{ - bool_lit, char_lit, identifier, is_ws, keyword, num_lit, path, skip_till, str_lit, ws, Expr, - State, + bool_lit, char_lit, identifier, is_ws, keyword, num_lit, path, skip_till, str_lit, ws, State, }; #[derive(Debug, PartialEq)] diff --git a/askama_parser/src/tests.rs b/askama_parser/src/tests.rs index 4717652..9f0fbd1 100644 --- a/askama_parser/src/tests.rs +++ b/askama_parser/src/tests.rs @@ -1,4 +1,6 @@ -use super::{Ast, Expr, Lit, Node, Syntax, Whitespace, Ws}; +use super::expr::Expr; +use super::node::{Lit, Node, Whitespace, Ws}; +use super::{Ast, Syntax}; fn check_ws_split(s: &str, res: &(&str, &str, &str)) { let Lit { lws, val, rws } = Lit::split_ws_parts(s); @@ -629,7 +631,7 @@ fn test_parse_comments() { #[test] fn test_parse_tuple() { - use super::Expr::*; + use super::expr::Expr::*; let syntax = Syntax::default(); assert_eq!( Ast::from_str("{{ () }}", &syntax).unwrap().nodes, |