Commit Graph

93 Commits

Author SHA1 Message Date
Tom Alexander 0302ed216f
Add my implementation of a take_until_parser_matches parser.
The author of nom is too busy to review the PR, and cargo does not allow for git dependencies, so I am going to copy my implementation into this code base so I can use upstream nom so I can push to cargo. While this code has been submitted upstream to nom which is under the MIT license, I am the author of this code so I believe I have the full right to also release it in this project under the 0BSD license.
2021-02-06 16:23:54 -05:00
Tom Alexander a9a83d1b4a
Update for the latest nom and make serde an optional dep. 2020-12-29 18:07:49 -05:00
Tom Alexander 83c86ff9b3
Move ComparisonNumber into the library and add an OwnedLiteral for booleans. 2020-06-14 17:08:01 -04:00
Tom Alexander 69fa266692
Allow spaces before closing braces on tags without parameters.
Previously I incorrectly only supported spaces before closing braces on tags with parameters. This patch expands that behavior to all tags.
2020-06-14 13:29:01 -04:00
Tom Alexander 76193bf806
Stubs for the size and contextDump helpers. 2020-06-14 12:32:10 -04:00
Tom Alexander de5932b4c6
Fix bug in parsing order for literals. 2020-06-13 16:23:46 -04:00
Tom Alexander 2a89fd826e
Update tests to use templates instead of literal strings for string parameters. 2020-06-13 16:18:48 -04:00
Tom Alexander d99aa44d8e
Add support for negative integers. 2020-06-13 16:06:31 -04:00
Tom Alexander 978bbe6eb3
Implemented float literals for OwnedLiterals, not yet for serde_json. 2020-06-13 13:37:26 -04:00
Tom Alexander 6877e3d393
Add parser support for the math helper. 2020-06-13 12:03:55 -04:00
Tom Alexander a61807d84c
Add parser support for select/any/none. 2020-06-07 17:06:14 -04:00
Tom Alexander 3fb91566bb
Implement get and tap functions. 2020-06-07 14:45:32 -04:00
Tom Alexander d06fbea288
Remove unused code and clean up warnings. 2020-06-07 13:27:57 -04:00
Tom Alexander f1ec0ffb9e
Got rid of most of the Clone traits on the parser types since some of the parser results now contain owned values rather than just references. 2020-05-31 19:01:51 -04:00
Tom Alexander 975ab278ef
Starting an IntoContextElement trait to allow for delayed evaluation. 2020-05-30 16:34:32 -04:00
Tom Alexander 581f9f7e97
Update parser to treat all string rvalues as templates. 2020-05-30 15:49:13 -04:00
Tom Alexander 3352b777ae
Factor out the parsing of partial template names into its own parser for reuse as an rvalue. 2020-05-30 15:45:44 -04:00
Tom Alexander add77cf6a5
Get rid of the concept of NamedBlock and replace it with a ParameterizedBlock special case that does not support an else block. 2020-05-30 14:39:31 -04:00
Tom Alexander 108cffb771
Fully replaced conditional's Container type with ParameterizedBlock. 2020-05-25 21:26:16 -04:00
Tom Alexander dc92973313
Switch parameterized blocks to having a Path for a name and taking a parser for a name matcher in the goal of merging with the conditional blocks. 2020-05-25 21:17:58 -04:00
Tom Alexander 2527baeff4
Pull the calls for the DustTag constructor up out of parameterized_block. 2020-05-25 20:40:58 -04:00
Tom Alexander 4a21ae5af3
Add tests for explicit context setting that check failure conditions and implement a helper function to generate a new breadcrumb stack. 2020-05-25 15:40:42 -04:00
Tom Alexander 8121c93392
Make the dust template parser all_consuming. 2020-05-25 14:17:38 -04:00
Tom Alexander 5b2ac7c2c2
Add parser support for explicit contexts in helpers. 2020-05-25 14:14:17 -04:00
Tom Alexander 12de0245c5
Implemented parser support for explicit contexts in partials. 2020-05-25 14:05:46 -04:00
Tom Alexander 9031108d2a
Implemented parsing for explicit contexts in NamedBlocks. 2020-05-25 13:55:17 -04:00
Tom Alexander dbee569931
Finish adding explicit context to the parser for Container. 2020-05-25 13:38:31 -04:00
Tom Alexander 1152ff9974
Greatly expand the explicit_context_setting test.
Turns out explicit context setting works in a lot more places than the official dustjs pages indicate. Also some things don't make much sense (like setting it on a block works but not on an inline partial).
2020-05-24 18:16:16 -04:00
Tom Alexander fff401da7e
Add a test to confirm references are getting parsed. 2020-05-24 15:22:12 -04:00
Tom Alexander b73561caf9
Add support for literal string blocks. 2020-05-23 23:46:46 -04:00
Tom Alexander 95dc15f103
Update parser to preserve the dot and support paths beginning with a dot. 2020-05-23 23:12:51 -04:00
Tom Alexander 5ddeeac966
minor cleanup. 2020-05-17 21:21:26 -04:00
Tom Alexander 93f9581d8a
Renamed the new partial implementation to the old partial name. 2020-05-17 21:17:34 -04:00
Tom Alexander 7be00ffea6
Remove the old partial implementation. 2020-05-17 21:15:03 -04:00
Tom Alexander 10c8b25817
Implement the new partial type in the renderer. 2020-05-17 21:11:55 -04:00
Tom Alexander 402d8679e2
Switch the parser over to a new partial implementation for dynamic partials. 2020-05-17 20:44:17 -04:00
Tom Alexander 189dfb1755
Fix tests. 2020-05-16 22:39:29 -04:00
Tom Alexander c905e705ff
Transition to new literals compiling.
Tests still need work, as does the implementation for json.
2020-05-16 22:31:40 -04:00
Tom Alexander 30b7324049
Implement less-than. 2020-05-16 19:05:03 -04:00
Tom Alexander 1b63bc4083
Add a test for integer literals. 2020-05-10 23:42:56 -04:00
Tom Alexander c88cab8316
Hook in the integer parser. 2020-05-10 23:13:25 -04:00
Tom Alexander 79099a8654
Parsing positive integers. 2020-05-10 23:02:21 -04:00
Tom Alexander 7a8247f38a
Getting the left and right sides. 2020-05-10 14:22:59 -04:00
Tom Alexander d2904913ad
I think I have the full extraction code. 2020-05-09 21:33:10 -04:00
Tom Alexander 2a9657e3d5
Turns out the issue was the trailing space on the parameters. 2020-05-09 15:15:43 -04:00
Tom Alexander 369fbaf579
works fine with one parameter. 2020-05-09 15:11:04 -04:00
Tom Alexander 710785139a
Works fine with the partial but without parameters. 2020-05-09 15:08:31 -04:00
Tom Alexander 569b4594be
works fine without the partial. 2020-05-09 15:05:29 -04:00
Tom Alexander bb3449467a
Running into an error parsing one of the partial test templates. 2020-05-09 15:02:54 -04:00
Tom Alexander 2f515e068d
Implemented the renderer logic.
I should just need to implement ContextElement at this point.
2020-05-08 22:22:30 -04:00