Elektrine lite

โ† Feed

@sminez@hachyderm.io

Post #2280776

2025-10-30 18:30 UTC

@jbert@hachyderm.io since writing this I've been driving home from Scotland and stuck in traffic for 4 hours so I've had some time to think. I've realised that you can split the problem up in a different way to get a library that should support writing a variety of structural regular expression based systems. I have an API in mind so I'll take a stab at sketching it out when I have some free time over the next few days ๐Ÿ‘€

Replies (1)

  • @sminez@hachyderm.io 2025-11-01 16:22

    @jbert@hachyderm.io OK, still very much a work in progress but I've pushed it up to crates.io in order to nab the "structex" name while I finish things off. https://github.com/sminez/structex This example shows how to use it alongside something like handlebars in order to get string templated printing working as an action ๐Ÿ˜„ https://github.com/sminez/structex/blob/main/examples/fancy_impl_blocks.rs It's only had minimal testing so far and I suspect there's a bunch of things that don't work quite right but I think as a proof of concept it gets the idea across? The idea is to split the problem into two parts in order to avoid a bunch of issues with how actions interleave with the regex search: 1. Apply the structural regular expression terms to an input in order to locate sub-strings. Each match may then be assigned a tag with optional content that will be emitted along with matches when they are found. 2. Consume that stream of tagged matches and handle the actions as needed. I have some more ideas on making the construction of a structex more robust (setting allowed tags etc) which I'll add once I've sorted out the testing and docs. (@oac@fosstodon.org you might find this fun as well!)

    Open ##2280777