Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extract askama_parser from askama_derive #782

Closed
wants to merge 64 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
64 commits
Select commit Hold shift + click to select a range
62b0207
Remove proc_macro2 dependency from CompileError
couchand Feb 28, 2023
9133bf3
Move Syntax struct to parser module
couchand Mar 1, 2023
58157fe
Remove dependency on CompileError from parser
couchand Mar 4, 2023
1366d70
Add test for parsing Node::Call
couchand Mar 6, 2023
2857a41
Extract Call struct from Node
couchand Mar 6, 2023
c32c2ef
Extract Match struct from Node
couchand Mar 6, 2023
21ce716
Make When a proper struct
couchand Mar 6, 2023
6402dc9
Make Cond a proper struct
couchand Mar 6, 2023
a1f22be
Extract Lit struct from Node
couchand Mar 6, 2023
c0720da
Push name into Macro struct
couchand Mar 6, 2023
5ab2827
Add test for Macro parse
couchand Mar 6, 2023
fd381c1
Clarify Macro Ws semantics
couchand Mar 6, 2023
19b5564
Add test for parsing raw blocks
couchand Mar 6, 2023
54b99f9
Extract Raw struct from Node and clarify inner/outer Ws
couchand Mar 6, 2023
4c45cc5
Add test for BlockDef parse
couchand Mar 6, 2023
ed22244
Extract BlockDef struct from Node and clarify inner/outer Ws
couchand Mar 6, 2023
ea7b3da
Add test for parsing Node::Loop
couchand Mar 4, 2023
40806a1
Clarify Loop outer/body/else Ws
couchand Mar 6, 2023
77d6201
Add test for parsing Node::Match Ws
couchand Mar 4, 2023
cdefada
Clarify Match arms/outer Ws semantics
couchand Mar 6, 2023
119c9f9
Add test for parsing Node::Cond
couchand Mar 6, 2023
1b00c5f
Clarify Cond branch/outer Ws semantics
couchand Mar 6, 2023
36203ff
Inline write_comment in Generator::handle
couchand Mar 6, 2023
c24ae77
Handle Expr Ws in Generator::handle
couchand Mar 6, 2023
811af00
Handle LetDecl Ws in Generator::handle
couchand Mar 6, 2023
dd4b443
Handle Let Ws in Generator::handle
couchand Mar 6, 2023
8fd40db
Move Node::Include Ws handling to caller
couchand Mar 6, 2023
8ab621e
Inline handle_ws in Generator::handle
couchand Mar 6, 2023
c53ad69
Move Comment to Tag
couchand Mar 6, 2023
b2779e9
Move Expr to Tag
couchand Mar 6, 2023
b32de67
Move Call into Tag
couchand Mar 6, 2023
cebc21a
Don't destructure Call in Generator::handle
couchand Mar 6, 2023
d80d4ec
Move LetDecl into Tag
couchand Mar 6, 2023
90d7882
Move Let into Tag
couchand Mar 6, 2023
4690d62
Move Cond into Tag
couchand Mar 6, 2023
249487b
Move Match into Tag
couchand Mar 6, 2023
62d7c13
Don't destructure Match in Generator::handle
couchand Mar 6, 2023
1a9fb8c
Move Loop into Tag
couchand Mar 6, 2023
f022f5b
Move BlockDef into Tag
couchand Mar 6, 2023
190e154
Move Include into Tag
couchand Mar 6, 2023
8a1392e
Move Import into Tag
couchand Mar 6, 2023
5cb7b42
Move Macro into Tag
couchand Mar 6, 2023
3b39aff
Move raw into Tag
couchand Mar 6, 2023
ebc1bad
Move Break and Continue into Tag
couchand Mar 6, 2023
99bd386
Reify Tag::Super out of Tag::Call
couchand Mar 6, 2023
3ab6fcc
Move Extends into Tag
couchand Mar 6, 2023
fbc3aae
Use Block for When block
couchand Mar 6, 2023
cf6a961
Use Block for Loop body and else blocks
couchand Mar 6, 2023
a5d6931
Use Block for Macro body
couchand Mar 6, 2023
aee4e85
Use Block for BlockDef block
couchand Mar 6, 2023
9ffa1ad
Use Block for Cond block
couchand Mar 6, 2023
f1b8b43
Use Block for parser::parse return value
couchand Mar 6, 2023
0073a21
Pass whole Block into Generator::handle
couchand Mar 6, 2023
09a264a
Handle Ws within Generator::handle
couchand Mar 6, 2023
63ecf38
Unify parser error cases using nom combinators
couchand Mar 4, 2023
bdde71f
Introduce ParseError struct
couchand Mar 4, 2023
4b5e3a6
Move Whitespace and Ws to parser
couchand Mar 6, 2023
a1cd50b
Name fields on Ws struct
couchand Mar 6, 2023
55747de
Document ParseError, rename row() to line()
couchand Mar 6, 2023
74825bf
Document parser::expr module
couchand Mar 6, 2023
1dce292
Document parser module items
couchand Mar 6, 2023
9a1fa73
Document parser::node module
couchand Mar 6, 2023
51af19f
Document parser module
couchand Mar 6, 2023
26e5eff
Extract askama_parser from askama_derive
couchand Mar 6, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ members = [
"askama_derive",
"askama_escape",
"askama_mendes",
"askama_parser",
"askama_rocket",
"askama_tide",
"askama_warp",
Expand All @@ -18,5 +19,6 @@ default-members = [
"askama",
"askama_derive",
"askama_escape",
"askama_parser",
"testing",
]
2 changes: 1 addition & 1 deletion askama_derive/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@ with-tide = []
with-warp = []

[dependencies]
askama_parser = { version = "0.1", path = "../askama_parser" }
mime = "0.3"
mime_guess = "2"
nom = "7"
proc-macro2 = "1"
quote = "1"
serde = { version = "1.0", optional = true, features = ["derive"] }
Expand Down
24 changes: 1 addition & 23 deletions askama_derive/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ use std::{env, fs};
use serde::Deserialize;

use crate::CompileError;
use askama_parser::Syntax;

#[derive(Debug)]
pub(crate) struct Config<'a> {
Expand Down Expand Up @@ -120,29 +121,6 @@ impl Config<'_> {
}
}

#[derive(Debug)]
pub(crate) struct Syntax<'a> {
pub(crate) block_start: &'a str,
pub(crate) block_end: &'a str,
pub(crate) expr_start: &'a str,
pub(crate) expr_end: &'a str,
pub(crate) comment_start: &'a str,
pub(crate) comment_end: &'a str,
}

impl Default for Syntax<'static> {
fn default() -> Self {
Self {
block_start: "{%",
block_end: "%}",
expr_start: "{{",
expr_end: "}}",
comment_start: "{#",
comment_end: "#}",
}
}
}

impl<'a> TryFrom<RawSyntax<'a>> for Syntax<'a> {
type Error = CompileError;

Expand Down
Loading