Elektrine lite

โ† Feed

@sminez@hachyderm.io

Post #2280775

2025-10-30 13:43 UTC

@jbert@hachyderm.io OK, found an example of what I'm talking about. This is VERY contrived and the output below is showing some debugging prints that fire when match actions are being collected followed by the final output when things are run in order. The input text is this: A bar baz B C baz bar D And this is the script: , x/ba\w/ { g/r/ /[A-Z]/ p/>$0\n/; } Output: ADD ACTION: Action { kind: Print, template: 0 } -> "B" ADD ACTION: Action { kind: Print, template: 1 } -> "A" ADD ACTION: Action { kind: Print, template: 1 } -> "C" ADD ACTION: Action { kind: Print, template: 0 } -> "D" >B >D< The original matches being found by "x/ba\w/" are sequential within the file, but the group branches are searching forward or backward from that initial position based on what was matched. It is (of course) fully valid to say that this sort of thing shouldn't be supported ๐Ÿ˜…

Replies (1)

  • @sminez@hachyderm.io 2025-10-30 18:30

    @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 ๐Ÿ‘€

    Open ##2280776