stred

Stred: Streaming Tree Editor. Like sed but for JSON
git clone http://shtanton.xyz/git/repo/stred
Log | Files | Refs

commit c10bca852dfd2ed3ae8f776c12705675a8ab99bf
parent 1e092ec62cf591e57f0b0bfb80b4484dd90c9c8c
Author: Charlie Stanton <charlie@shtanton.xyz>
Date:   Mon, 24 Apr 2023 19:12:46 +0100

Adds a check to end subex execution early if no viable branches remain

Diffstat:
Msubex/main.go | 3+++
1 file changed, 3 insertions(+), 0 deletions(-)

diff --git a/subex/main.go b/subex/main.go @@ -112,6 +112,9 @@ func RunTransducer(transducer SubexState, input []walk.Atom) (output []walk.Atom newStates = append(newStates, state.eat(piece)...) } states = pruneStates(newStates) + if len(states) == 0 { + return nil, true + } } for _, state := range states { acceptingStacks := state.accepting()