aboutsummaryrefslogtreecommitdiffstats
path: root/askama_parser (unfollow)
Commit message (Collapse)AuthorFilesLines
2023-09-28Pass `Node` parsing level to expressionsLibravatar René Kijewski2-16/+16
2023-09-28Limit nesting in parser nodes, tooLibravatar René Kijewski2-4/+23
2023-09-28Require Expr::parse() callers to supply LevelLibravatar Dirkjan Ochtman2-16/+18
2023-09-28Move Level into the crate rootLibravatar Dirkjan Ochtman3-18/+17
2023-09-28Yield a parser error when defining a macro named 'super'Libravatar Dirkjan Ochtman2-4/+11
2023-09-28Limit expression nesting level to avoid stack overflowsLibravatar Dirkjan Ochtman2-34/+83
2023-09-18fuzz: remove input limitLibravatar manunio1-4/+2
While working on https://github.com/djc/askama/pull/862 fuzz_parser was crashing and failing oss-fuzz build_checks. so a limit of 500 was placed, this pr removes that.
2023-09-13fuzz: Add fuzz for askama_parserLibravatar manunio4-0/+58
2023-09-11Use char_indices() to get byte indices for charactersLibravatar Dirkjan Ochtman2-1/+8
2023-09-11Rename some variablesLibravatar Dirkjan Ochtman1-7/+7
2023-08-03Optimize parsing boolean literals, tooLibravatar René Kijewski1-9/+5
2023-08-03Parse paths and identifiers only onceLibravatar René Kijewski3-37/+53
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: fix white space issues in macro parsingLibravatar René Kijewski1-2/+2
2023-08-02parser: allow negative numbers in patternsLibravatar René Kijewski1-1/+5
2023-08-02parser: don't truncates whitespaces after arraysLibravatar René Kijewski1-1/+1
2023-08-02parser: better error message for unknown nodesLibravatar René Kijewski2-9/+8
2023-08-01parser: import `parser::{Expr, Node}`Libravatar René Kijewski2-5/+4
2023-08-01parser: `node::Loop` is much bigger than the other variantsLibravatar René Kijewski1-2/+2
2023-08-01parser: move test for completenessLibravatar René Kijewski1-6/+6
2023-08-01parser: add type for `Node::Comment`Libravatar René Kijewski2-146/+109
2023-08-01parser: add `expr::Loop::parse()`Libravatar René Kijewski1-68/+70
2023-08-01parser: remove re-exports `parser::{node,expr}::*`Libravatar René Kijewski3-13/+12
2023-08-01parser: add type for `Node::Extends`Libravatar René Kijewski2-9/+16
2023-08-01parser: add type for `Node::Include`Libravatar René Kijewski2-14/+28
2023-08-01parser: rename `Node::Cond` into `If` and add typeLibravatar René Kijewski2-35/+49
2023-08-01parser: add type for `Node::Let`Libravatar René Kijewski2-26/+34
2023-08-01parser: add type for `Node::Raw`Libravatar René Kijewski2-29/+38
2023-08-01parser: add type for `Node::Lit`Libravatar René Kijewski3-49/+54
2023-08-01parser: add type for `Node::BlockDef`Libravatar René Kijewski2-30/+45
2023-08-01parser: add type for `Node::Match`Libravatar René Kijewski2-36/+54
2023-08-01parser: add type for `Node::Call`Libravatar René Kijewski2-20/+40
2023-08-01parser: add type for `Node::Import`Libravatar René Kijewski2-17/+33
2023-08-01parser: let `Macro` know its nameLibravatar René Kijewski1-52/+53
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-08-01parser: remove panicking `From<&str> for Whitespace`Libravatar René Kijewski1-12/+5
2023-07-31 Fix parsing arraysLibravatar René Kijewski2-5/+90
This change * allows using empty arrays `[]` in expessions, * adds a cut when the leading `[` was encountered, and * fixes the interaction between arrays and boolean OR. IMO the restriction that you couldn't use empty arrays is not needed. The missing cut made error messages slictly worse if you forget to add the closing `]`. Filter expressions must not have white spaces before the pipe `|`. The white space is used to tell a filter expressions, and `std::ops::Or` apart.
2023-07-31 Fix parsing callsLibravatar René Kijewski2-4/+31
This change: * adds a cut when the leading `(` was encountered, and * fixed the interaction between call expressions and boolean OR.
2023-07-31parser: rename block to nodesLibravatar Dirkjan Ochtman1-12/+13
2023-07-31parser: reorder items in node moduleLibravatar Dirkjan Ochtman1-50/+50
2023-07-31parser: move Expr parser helpers into callersLibravatar Dirkjan Ochtman1-53/+54
2023-07-31parser: move single expr parsers into Expr implLibravatar Dirkjan Ochtman1-63/+63
2023-07-31parser: move binary operator parsers into Expr implLibravatar Dirkjan Ochtman1-71/+71
2023-07-31parser: flatten top-level Expr interfaceLibravatar Dirkjan Ochtman2-36/+28
2023-07-31parser: move suffix parsers into impl blockLibravatar Dirkjan Ochtman1-53/+61
2023-07-31parser: move cond parsers into type implsLibravatar Dirkjan Ochtman1-39/+43
2023-07-31parser: move parser helpers into callersLibravatar Dirkjan Ochtman1-35/+35