aboutsummaryrefslogtreecommitdiffstats
path: root/askama_parser/src/lib.rs (unfollow)
Commit message (Collapse)AuthorFilesLines
2023-10-25Create a type alias for all `IResult` to simplify code readingLibravatar Guillaume Gomez1-37/+34
2023-10-25Improve error for invalid name used in `endblock`Libravatar Guillaume Gomez1-1/+1
2023-10-25Create `ErrorContext` typeLibravatar Guillaume Gomez1-31/+97
2023-09-28Pass `Node` parsing level to expressionsLibravatar René Kijewski1-1/+1
2023-09-28Limit nesting in parser nodes, tooLibravatar René Kijewski1-0/+15
2023-09-28Move Level into the crate rootLibravatar Dirkjan Ochtman1-0/+15
2023-08-03Parse paths and identifiers only onceLibravatar René Kijewski1-24/+31
In the old implementation each variable in an expression would be parsed up to three times: * Try to parse a path because it contains a leading double colon, or infix double colons. * Try to parse it as path again by scanning for an identifier that contains an upper case character. * Fall back to scanning for any identifier. This PR turns all three steps into one, without the need for backtracking.
2023-08-02parser: allow negative numbers in patternsLibravatar René Kijewski1-1/+5
2023-08-02parser: better error message for unknown nodesLibravatar René Kijewski1-8/+7
2023-08-01parser: remove re-exports `parser::{node,expr}::*`Libravatar René Kijewski1-9/+6
2023-08-01parser: add type for `Node::Extends`Libravatar René Kijewski1-2/+2
2023-08-01parser: add type for `Node::Include`Libravatar René Kijewski1-2/+2
2023-08-01parser: rename `Node::Cond` into `If` and add typeLibravatar René Kijewski1-2/+2
2023-08-01parser: add type for `Node::Let`Libravatar René Kijewski1-1/+1
2023-08-01parser: add type for `Node::Raw`Libravatar René Kijewski1-1/+1
2023-08-01parser: add type for `Node::Lit`Libravatar René Kijewski1-8/+2
2023-08-01parser: add type for `Node::BlockDef`Libravatar René Kijewski1-1/+1
2023-08-01parser: add type for `Node::Match`Libravatar René Kijewski1-1/+1
2023-08-01parser: add type for `Node::Call`Libravatar René Kijewski1-1/+3
2023-08-01parser: add type for `Node::Import`Libravatar René Kijewski1-1/+1
2023-08-01parser: add `Ast::nodes()` methodLibravatar René Kijewski1-0/+4
2023-08-01parser: impement `PartialEq` for `Ast`Libravatar René Kijewski1-0/+7
2023-08-01parser: implement `Debug` for `Parsed`Libravatar René Kijewski1-1/+9
2023-08-01parser: use `?`Libravatar René Kijewski1-5/+1
2023-08-01parser: ensure correct drop order for `Parsed`Libravatar René Kijewski1-2/+3
According to [RFC 1857] the fields of a struct are dropped in the same order as they are declared. For `struct S { a: A, b: B }` field `a` is dropped before field `b`. Our struct `Parsed` is self referencial. Its field `ast` depends on `source`, so `source` must outlife `ast`. This PR changes the order of the fields to reflect this requirement. In practice it should not matter, because we know that the variant of `Node` won't access the string data during their `Drop`, but better safe than sorry - maybe `Node` changes in the future. [RFC 1857]: https://rust-lang.github.io/rfcs/1857-stabilize-drop-order.html
2023-07-31parser: move node parsers into impl blockLibravatar Dirkjan Ochtman1-22/+2
2023-07-31parser: simplify top-level parser matchLibravatar Dirkjan Ochtman1-29/+24
2023-07-31parser: add top-level Ast typeLibravatar Dirkjan Ochtman1-33/+40
2023-07-31parser: move nested_parenthesis() helper into node moduleLibravatar Dirkjan Ochtman1-48/+0
2023-07-31parser: move helper functions into State implLibravatar Dirkjan Ochtman1-61/+61
2023-07-31parser: move trait impl closer to type definitionLibravatar Dirkjan Ochtman1-11/+0
2023-07-31parser: move single-use functions into callerLibravatar Dirkjan Ochtman1-13/+13
2023-07-31Extract askama_parser crateLibravatar Dirkjan Ochtman1-15/+18
2023-07-31derive: move Parsed into parser moduleLibravatar Dirkjan Ochtman1-0/+34
2023-07-31derive: define separate ParseError typeLibravatar Dirkjan Ochtman1-6/+17
2023-07-31derive: move Syntax into parser moduleLibravatar Dirkjan Ochtman1-1/+23
2023-06-28Parse templates onceLibravatar Dirkjan Ochtman1-4/+1
2023-02-21Revert "derive: Make Config `'static`"Libravatar René Kijewski1-13/+16
2023-01-30derive: refactor parserLibravatar René Kijewski1-0/+314
`parser.rs` was a single file containing almost 2000 lines. This PR split the file into multiple, smaller files. `Expr`, `Node`, and `Target` each get an own file. Each struct gets a `parse()` method that return `Result<Self>`, and every other detail is private to the file. This PR should make this essential part of Askama more easy to understand, and make future modifications easier.