92 Commits

Author SHA1 Message Date
Guillaume Gomez
9439638e0f Create new Filter type 2024-03-11 14:25:46 +01:00
René Kijewski
7aa4a80791 Remove redundant import 2024-03-07 17:10:58 +01:00
Guillaume Gomez
279105bd4d Remove unused Next variant value 2024-03-07 14:55:53 +01:00
Guillaume Gomez
dab6c8007c Add support for filter block 2024-03-07 11:33:34 +01:00
Guillaume Gomez
29687db996 Improve error when whitespace control is used on extends 2024-01-22 17:13:01 +01:00
Dirkjan Ochtman
eb4c4ec915 Bump version numbers for release 2024-01-18 11:30:54 +01:00
Dirkjan Ochtman
79738ff238 Fix support for mixed case variables 2024-01-18 11:23:18 +01:00
Dirkjan Ochtman
250828a6d2 Yield error on deep AST recursion 2024-01-18 07:39:25 +01:00
max
2c7759c0d0 Improve performance of find_used_templates
Signed-off-by: max <gmx.sht@gmail.com>
2024-01-17 17:58:53 +01:00
Fabio Valentini
b1386c1fbf parser: add missing license files 2024-01-15 07:28:38 +01:00
Dirkjan Ochtman
84c2094e87 parser: add test for target recursion overflow 2024-01-11 16:32:50 +01:00
Dirkjan Ochtman
10c38c51f6 parser: limit target recursion 2024-01-11 16:32:50 +01:00
Dirkjan Ochtman
25bf3e945c Prepare askama_derive and _parser releases 2023-12-18 11:07:31 +01:00
Guillaume Gomez
e4b8ca3c44 Allow trailing comma in macro definition and call 2023-12-07 11:03:26 +01:00
max
7f30a657f6 Undo an accidental deletion of #[derive(Debug)]
Signed-off-by: max <gmx.sht@gmail.com>
2023-12-07 10:17:43 +01:00
max
33eb70c34a Added testing for reserved variable names
Signed-off-by: max <gmx.sht@gmail.com>
2023-12-07 10:17:43 +01:00
Guillaume Gomez
b3020ee8bf Allow to pass named arguments to macro calls 2023-11-28 11:36:09 +01:00
PizzasBear
696561003d
Add better support for rust-like number literals (#908)
Signed-off-by: max <gmx.sht@gmail.com>
2023-11-22 16:09:33 +01:00
PizzasBear
48c6cd327d
Enhance match to include multiple targets (#911)
Signed-off-by: max <gmx.sht@gmail.com>
2023-11-22 14:56:14 +01:00
Andrew Dona-Couch
6cbfde0451 Derive Clone for Expr and Target 2023-11-13 20:24:02 +01:00
Guillaume Gomez
76462255ea Create a type alias for all IResult to simplify code reading 2023-10-25 16:26:36 +02:00
Guillaume Gomez
d48ac76f0a Improve error for elif keyword 2023-10-25 14:54:14 +02:00
Guillaume Gomez
c056d6287b Improve error for invalid name used in endmacro 2023-10-25 14:30:35 +02:00
Guillaume Gomez
c3281e353d Improve error for invalid name used in endblock 2023-10-25 14:30:35 +02:00
Guillaume Gomez
6dae920a45 Create ErrorContext type 2023-10-25 14:30:35 +02:00
Dirkjan Ochtman
a6bc14c8ca Advertise Discord channel instead of Gitter 2023-10-03 17:39:03 +02:00
Dirkjan Ochtman
22ec6c95a1 parser: version bump to 0.1.1 2023-09-29 17:07:12 +02:00
Dirkjan Ochtman
1ce939a729 parser: add rudimentary README 2023-09-29 17:07:12 +02:00
Dirkjan Ochtman
daa8d89b57 Add MSRV checking in CI
Bump MSRV to 1.65 for the use of let .. else.
2023-09-29 16:13:24 +02:00
René Kijewski
eef38cea67 Pass Node parsing level to expressions 2023-09-28 17:28:26 +02:00
René Kijewski
238e4bbad7 Limit nesting in parser nodes, too 2023-09-28 17:28:26 +02:00
Dirkjan Ochtman
36f4442978 Require Expr::parse() callers to supply Level 2023-09-28 17:28:26 +02:00
Dirkjan Ochtman
5718175291 Move Level into the crate root 2023-09-28 17:28:26 +02:00
Dirkjan Ochtman
5ab8813fe2 Yield a parser error when defining a macro named 'super' 2023-09-28 15:40:57 +02:00
Dirkjan Ochtman
c8530493a1 Limit expression nesting level to avoid stack overflows 2023-09-28 14:43:44 +02:00
manunio
2ef2b9db9e fuzz: remove input limit
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-18 15:57:17 +02:00
manunio
8f3140a33f fuzz: Add fuzz for askama_parser 2023-09-13 14:48:08 +02:00
Dirkjan Ochtman
2e8e42af45 Use char_indices() to get byte indices for characters 2023-09-11 12:19:16 +02:00
Dirkjan Ochtman
dd9635ace6 Rename some variables 2023-09-11 12:19:16 +02:00
René Kijewski
d4fbad1db2 Optimize parsing boolean literals, too 2023-08-03 00:02:04 +02:00
René Kijewski
95ff27c087 Parse paths and identifiers only once
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-03 00:02:04 +02:00
René Kijewski
d38e2b4e26 parser: fix white space issues in macro parsing 2023-08-02 11:09:05 +02:00
René Kijewski
06ad86b1e1 parser: allow negative numbers in patterns 2023-08-02 11:09:05 +02:00
René Kijewski
50745e41c2 parser: don't truncates whitespaces after arrays 2023-08-02 11:09:05 +02:00
René Kijewski
d09041bd0a parser: better error message for unknown nodes 2023-08-02 11:09:05 +02:00
René Kijewski
04e585b9d2 parser: import parser::{Expr, Node} 2023-08-01 13:04:41 +02:00
René Kijewski
c8399c75ed parser: node::Loop is much bigger than the other variants 2023-08-01 13:04:41 +02:00
René Kijewski
11f3d0714c parser: move test for completeness 2023-08-01 13:04:41 +02:00
René Kijewski
4315773676 parser: add type for Node::Comment 2023-08-01 13:04:41 +02:00
René Kijewski
32cd2825c4 parser: add expr::Loop::parse() 2023-08-01 13:04:41 +02:00