198 Commits

Author SHA1 Message Date
Guillaume Gomez
cfc0883ff2 Update tests for lifetimes in filters 2025-12-28 18:09:28 +01:00
Guillaume Gomez
683f4a2e52 Add new decl tag 2025-12-13 21:31:28 +01:00
Guillaume Gomez
9211c599f9 Update ui tests output for rust 1.92 2025-12-13 18:04:06 +01:00
Markus Ebner
633de66a65
feat: Add support for array repeat syntax: [<element_expr>; <cnt_expr>] 2025-11-25 14:35:31 +01:00
Markus Ebner
6bb01e8520
filter_fn: Further improve invalid invocation compile error messages
This round fixes compile error messages for when not all required arguments have been supplied.
2025-11-06 18:55:28 +01:00
Guillaume Gomez
8038a8f92a Fix nightly output 2025-11-03 15:41:13 +01:00
Guillaume Gomez
cec1f04cee Fix fuzzing ui test 2025-11-03 15:39:55 +01:00
Markus Ebner
1055ae0abd
Improve compiler errors for invocations with too many arguments 2025-10-29 16:13:36 +01:00
Markus Ebner
ab28d38460
Add ui-test for filter_fn signature validation 2025-10-29 15:45:24 +01:00
Markus Ebner
38b2c3f536
Port askama to new filter_fn proc-macro-attr 2025-10-29 15:45:24 +01:00
Guillaume Gomez
d220cd5113
Merge pull request #602 from VojtaStanek/struct-expr
Add support for struct expressions
2025-10-19 16:33:39 +02:00
Guillaume Gomez
04cf06beb4 Limit maximum number of references in generics to prevent syn stack overflow 2025-10-18 22:04:50 +02:00
Guillaume Gomez
334519e7cd Greatly improve errors of invalid struct expression 2025-10-05 11:11:33 +02:00
Guillaume Gomez
5e5d57628a Improve parsing errors and ui tests 2025-10-03 00:39:06 +02:00
Guillaume Gomez
0c229240e1 Fix typo 2025-09-30 22:13:21 +02:00
Vojta Staněk
ed28a2a6b8
Add support for struct expressions - ui tests 2025-09-28 10:06:30 +02:00
Guillaume Gomez
2a347c7f08 Update tests with new number output 2025-09-27 03:30:50 +02:00
Guillaume Gomez
04e9241e4f Remove unwanted print = "ast" forgotten in tests 2025-09-02 15:30:53 +02:00
René Kijewski
52c4dfd8c3 parser: reject extends below top-level, too 2025-08-25 01:24:25 +02:00
Guillaume Gomez
b744cab2be Emit an error if an extends block doesn't come first in a template 2025-08-24 22:26:17 +02:00
René Kijewski
a0d99ba6fc Better spans 2025-08-19 17:41:20 +02:00
René Kijewski
e5189b933d Use Parser::[with_]span() to generate proc_macro::Span 2025-08-19 17:41:20 +02:00
Guillaume Gomez
1f31021632 Fix wrong macro argument parsing 2025-08-17 16:28:45 +02:00
René Kijewski
98ad5d5b3f parser: better messages for (group) 2025-08-07 20:48:15 +02:00
René Kijewski
c0d6f0f0fc parser: a little better spans 2025-08-07 20:39:38 +02:00
René Kijewski
329771152d parser: use LocatingSlice<&str> instead of &str
This will enable better span getting in subsequent PRs.
2025-08-07 18:41:51 +02:00
Guillaume Gomez
80a4af7f2d Generate a TokenStream rather than a String 2025-08-06 19:11:26 +02:00
René Kijewski
1f3c926c58 parser: r#self is not a valid raw identifier in macro calls
It's not a valid raw identifier anywhere, actually, but the other cases
(in a path, as a field name, as a macro name) were already handled.

Resolves <https://issues.oss-fuzz.com/issues/435218013>.
2025-07-31 18:46:35 +02:00
René Kijewski
d670d9b91c parser: fail on unterminated byte literal
Resolves <https://issues.oss-fuzz.com/issues/433650278>.

Also, I noticed that an Unicode escape in a byte literal, e.g.
`b'\u{42}'`, was accepted when it should not have been.
2025-07-28 21:56:40 +02:00
Markus Ebner
48d5dba024
Fix #531: Allow named arguments in expr macro calls 2025-07-22 12:33:26 +02:00
Markus Ebner
526ce78cf0
Add ui tests for named arguments in rust call expressions 2025-07-22 00:58:33 +02:00
René Kijewski
ba7b0a7967 Move DefaultFilterable into its own file 2025-07-21 22:31:05 +02:00
René Kijewski
b2b0d4cbba Add filters |default, |assigned_or and |defined_or
Also, `enum Pluralize<S, P>` is renamed into `enum Either<L, R>` and
exported.
2025-07-21 22:31:05 +02:00
Markus Ebner
1b1d604dbc Add unit-tests for #517 2025-07-21 16:55:31 +02:00
Guillaume Gomez
fc2b0349ac Add ui test for generics on loop.cycle 2025-07-21 00:38:55 +02:00
Guillaume Gomez
6de8ff8042 Forbid string literal suffix 2025-07-21 00:35:48 +02:00
Guillaume Gomez
d8bf38978c Add fuzzing test 2025-07-20 16:27:23 +02:00
Guillaume Gomez
57554f3d42 Update tests 2025-07-20 16:27:23 +02:00
René Kijewski
4f5272406f parser: replace manual i_before with .with_taken() 2025-06-24 15:02:41 +02:00
René Kijewski
edfa31f9cf parser: ensure valid paths in generics 2025-06-23 18:31:16 +02:00
René Kijewski
3f380721a2 parser: reject illegal raw identifiers in attribute access 2025-06-23 18:31:16 +02:00
René Kijewski
76b26cd5fa parser: str lit must not be followed by suffix#
Resolves <https://issues.oss-fuzz.com/issues/426509683>.
2025-06-21 19:43:28 +02:00
René Kijewski
b6acf7b3a8 parser: simplify {# comment #} parsing
`winnow`'s `take_until` with feature `simd` enabled is implemented like
our "optimized" `skip_till`. There is no need to reinvent the wheel.
2025-06-16 23:49:58 +02:00
René Kijewski
568ced0c55 parser: recognize comments in macro calls
Fixes issue <https://issues.oss-fuzz.com/issues/425145246>
2025-06-16 23:49:47 +02:00
Guillaume Gomez
e329f98433
Merge pull request #484 from Kijewski/pr-u+10ffff
parser: U+10FFFF is the highest Unicode codepoint
2025-06-16 16:50:36 +02:00
René Kijewski
00b640c93b parser: better error message for bare CRs 2025-06-13 22:19:17 +02:00
René Kijewski
9ffa6b954c parser: U+10FFFF is the highest Unicode codepoint
Fix a small typo: parsing '\u{123456}` should parse up to 6 characters,
inclusively.
2025-06-13 11:32:51 +02:00
René Kijewski
341b850351 parser: reject isolated CRs in string literals
According to <https://doc.rust-lang.org/reference/tokens.html#string-literals>.

Fixes <https://github.com/askama-rs/askama/issues/482>.
Fixes <https://issues.oss-fuzz.com/issues/424227903>.
2025-06-13 06:17:12 +02:00
René Kijewski
50e0a96481 Rename LoopItem::index to LoopItem::index0
That's what the element is called in the template syntax.

Also refactor `Generator::visit_attr()` at bit to make it more readable.
Also add `__askama` prefix to `_len`.
2025-06-11 18:53:42 +02:00
René Kijewski
532e343c40 parser: reject illegal string literals 2025-06-09 19:24:08 +02:00