93 Commits

Author SHA1 Message Date
Ed Page
d171cdbaf1 refactor(parser): Remove trivial deprecated 'tag' uses 2024-10-25 11:57:07 -05:00
Ed Page
88c702e6a8 refactor(parser): Switch 'impl FnMut' to 'impl Parser' 2024-10-25 11:56:52 -05:00
Ed Page
25067bdb4e refactor(parser): Rely on Parser trait rather than FnMut 2024-10-25 11:56:50 -05:00
Ed Page
a12a667871 refactor(parser): Migrate to Winnow 0.3 2024-10-25 11:56:11 -05:00
René Kijewski
3cb337255b Bump version number to v0.3.5
We gathered quiet a few changes in the last month:
<https://github.com/rinja-rs/rinja/compare/v0.3.4...1e319fd0c869884b68c9287bc4bcb1309b16328e>
2024-10-23 15:10:15 +02:00
Guillaume Gomez
d15fc3a61f Improve config delimiters characters check 2024-10-20 05:06:06 +02:00
René Kijewski
0d8cda38b7 ci: make sure all settings apply to subprojects, too 2024-09-24 02:28:16 +02:00
René Kijewski
4b44189809 ci: update formatting for edition=2024 2024-09-24 02:07:17 +02:00
Guillaume Gomez
d488a1d28f Update crates version to 0.3.4 2024-09-19 17:45:24 +02:00
René Kijewski
eed37cd415 Run clippy --fix -- -D clippy::pedantic 2024-09-16 22:58:50 +02:00
René Kijewski
75851fa09c parser: make WithSpan contructor const 2024-09-13 13:13:47 +02:00
Guillaume Gomez
447729f753 Update crates version to 0.3.3 2024-09-11 20:34:06 +02:00
Guillaume Gomez
7ff1629815
Merge pull request #170 from Kijewski/pr-pluralize
Implement `pluralize` filter
2024-09-11 17:19:19 +02:00
René Kijewski
ecd0e6e84e parser: make {#-#} a syntax error 2024-09-11 03:27:53 +02:00
René Kijewski
ee73116c7d parser: fix clippy warning 2024-09-11 02:53:11 +02:00
René Kijewski
1948d63241 parser: add context information for unknown tags 2024-09-10 16:09:42 +02:00
René Kijewski
7b4f1dc907 parser: add optional {% endwhen %} 2024-09-10 04:09:40 +02:00
René Kijewski
f9932a03ff parser: When::match() matches else case 2024-09-10 03:58:15 +02:00
Guillaume Gomez
c38007cf25 Improve error message for unclosed items 2024-09-10 02:39:59 +02:00
René Kijewski
98b60d3d8b parser: debug output for Syntax/InnerSyntax are swapped 2024-08-28 18:41:09 +02:00
Guillaume Gomez
37c520fc38 Update crate version to 0.3.2 2024-08-25 22:36:49 +02:00
René Kijewski
bff113a942 parser: allow trailing comma in array expressions 2024-08-24 23:21:12 +02:00
René Kijewski
91626899a6 Bump version numbers for release v0.3.1 2024-08-20 15:50:00 +02:00
René Kijewski
757ba0ac7e doc: use feature(doc_cfg, doc_auto_cfg) everywhere 2024-08-20 07:36:11 +02:00
René Kijewski
d8f2341e46 Minor fix ups 2024-08-19 14:35:09 +02:00
René Kijewski
fa003fcd0d parser: fix float parsing 2024-08-19 14:35:07 +02:00
René Kijewski
37bbf0b88f parser: parse floats like 123e456 2024-08-19 14:33:37 +02:00
René Kijewski
5ee4728292 Move Syntax configuration and check into parser 2024-08-19 06:02:04 +02:00
Guillaume Gomez
71f49a8fc2 Add support for prefixes for string literals 2024-08-18 22:43:59 +02:00
Guillaume Gomez
1a24ace17b Add support for b prefix for char literals 2024-08-18 22:35:03 +02:00
Guillaume Gomez
7a7e415822 Add support for | operator in when 2024-08-15 21:10:29 +02:00
Guillaume Gomez
d5fef24ff7
Merge pull request #119 from Kijewski/pr-no-when
parser: allow `match` nodes w/o `when` if there is an `else`
2024-08-13 17:48:15 +02:00
Guillaume Gomez
411f2b75dd Fix clippy lint 2024-08-09 20:32:38 +02:00
Guillaume Gomez
9873ea065f Improve compile-time if conditions handling 2024-08-09 20:32:38 +02:00
René Kijewski
f818c582bf parser: allow match nodes w/o when if there is an else 2024-08-08 22:28:14 +02:00
René Kijewski
5efd31310f parser: understand arbitrarily mixed up end nodes 2024-08-07 20:43:18 +02:00
René Kijewski
e0a7d4df55 parser: use fail fail() where appropriate 2024-08-07 20:36:31 +02:00
René Kijewski
dec67c686b parser: tell user proper keyword to end node 2024-08-07 20:30:25 +02:00
René Kijewski
62ef553dcb readme: add badges 2024-08-04 01:23:49 +02:00
René Kijewski
6fe504e133 Bump version numbers to v0.3.0 2024-08-01 15:41:37 +02:00
Guillaume Gomez
4de78ad9be Improve compilation error message for invalid usage of rest pattern 2024-07-31 19:28:50 +02:00
Guillaume Gomez
2771533594 Add rest pattern support 2024-07-30 22:31:42 +02:00
René Kijewski
380ecc1d8e derive: properly display error locations 2024-07-29 05:05:00 +02:00
Guillaume Gomez
e74f0d20ba Change the error message to make it start at the as keyword 2024-07-28 21:37:22 +02:00
René Kijewski
7b99783f00 parser: use memchr to speed-up skip_till()
`skip_till()` is used in the parser to find the next block `{%`,
comment `{#` or expression `{{`. At every character position, it is
tested if one of these three substrings follows. Using [`memchr3()`],
we could at least skip to the next candidate, a `{`. The syntax for
blocks, comments and expressions can be modified by the user, but that
does not matter much; we can simply supply `memchr3()` with the first
byte in each of these strings.

[`memchr3()`]: <https://docs.rs/memchr/2.7.4/memchr/fn.memrchr3.html>

```text
librustdoc/all          time:   [366.54 µs 366.78 µs 367.02 µs]
                        thrpt:  [38.475 MiB/s 38.500 MiB/s 38.525 MiB/s]
                 change:
                        time:   [-17.358% -17.065% -16.820%] (p = 0.00 < 0.05)
                        thrpt:  [+20.221% +20.576% +21.004%]
                        Performance has improved.

librustdoc/item_info    time:   [6.3315 µs 6.3400 µs 6.3495 µs]
                        thrpt:  [24.783 MiB/s 24.820 MiB/s 24.853 MiB/s]
                 change:
                        time:   [-6.5547% -6.4090% -6.2633%] (p = 0.00 < 0.05)
                        thrpt:  [+6.6818% +6.8479% +7.0144%]
                        Performance has improved.

librustdoc/item_union   time:   [39.377 µs 39.551 µs 39.720 µs]
                        thrpt:  [24.850 MiB/s 24.957 MiB/s 25.067 MiB/s]
                 change:
                        time:   [-6.9834% -6.2455% -5.5849%] (p = 0.00 < 0.05)
                        thrpt:  [+5.9153% +6.6616% +7.5077%]
                        Performance has improved.

librustdoc/page         time:   [170.83 µs 170.99 µs 171.23 µs]
                        thrpt:  [36.164 MiB/s 36.213 MiB/s 36.248 MiB/s]
                 change:
                        time:   [-12.413% -12.183% -11.968%] (p = 0.00 < 0.05)
                        thrpt:  [+13.595% +13.873% +14.173%]
                        Performance has improved.

librustdoc/print_item   time:   [21.163 µs 21.234 µs 21.322 µs]
                        thrpt:  [44.280 MiB/s 44.463 MiB/s 44.612 MiB/s]
                 change:
                        time:   [-19.848% -18.613% -17.491%] (p = 0.00 < 0.05)
                        thrpt:  [+21.198% +22.870% +24.763%]
                        Performance has improved.

librustdoc/short_item_info
                        time:   [19.781 µs 19.813 µs 19.846 µs]
                        thrpt:  [45.652 MiB/s 45.727 MiB/s 45.801 MiB/s]
                 change:
                        time:   [-18.027% -17.806% -17.574%] (p = 0.00 < 0.05)
                        thrpt:  [+21.321% +21.663% +21.991%]
                        Performance has improved.

librustdoc/sidebar      time:   [40.694 µs 40.806 µs 40.957 µs]
                        thrpt:  [30.131 MiB/s 30.242 MiB/s 30.325 MiB/s]
                 change:
                        time:   [-14.698% -14.069% -13.456%] (p = 0.00 < 0.05)
                        thrpt:  [+15.548% +16.372% +17.231%]
                        Performance has improved.

librustdoc/source       time:   [15.249 µs 15.264 µs 15.278 µs]
                        thrpt:  [48.251 MiB/s 48.295 MiB/s 48.343 MiB/s]
                 change:
                        time:   [-25.832% -25.678% -25.532%] (p = 0.00 < 0.05)
                        thrpt:  [+34.285% +34.550% +34.829%]
                        Performance has improved.

librustdoc/type_layout_size
                        time:   [9.0168 µs 9.0446 µs 9.0789 µs]
                        thrpt:  [29.832 MiB/s 29.945 MiB/s 30.038 MiB/s]
                 change:
                        time:   [-11.100% -10.437% -9.4426%] (p = 0.00 < 0.05)
                        thrpt:  [+10.427% +11.653% +12.486%]
                        Performance has improved.

librustdoc/type_layout  time:   [34.088 µs 34.114 µs 34.139 µs]
                        thrpt:  [78.860 MiB/s 78.919 MiB/s 78.979 MiB/s]
                 change:
                        time:   [-37.865% -37.723% -37.585%] (p = 0.00 < 0.05)
                        thrpt:  [+60.217% +60.573% +60.941%]
                        Performance has improved.
```
2024-07-28 18:14:57 +02:00
René Kijewski
d413474217 parser: store list of primitive types at one place 2024-07-28 18:02:52 +02:00
René Kijewski
a6a474514e Implement operator as in template language
Because it is not always super obvious if an identifier refers to `T` or
`&T`, any references are automatically followed.
2024-07-28 18:02:14 +02:00
Guillaume Gomez
eb4ceae2a3 Store bool for BoolLit instead of str 2024-07-26 22:12:55 +02:00
Guillaume Gomez
5c5d9a2fc3 Remove level nesting in is_defined parsing 2024-07-24 13:14:51 +02:00
Guillaume Gomez
0372dac003 Implement is (not) defined 2024-07-24 10:27:35 +02:00