1
0
mirror of https://github.com/janet-lang/janet synced 2025-11-19 00:35:11 +00:00

string and peg replacement functions can now take functions

Functions will be invoked with the matched text, and their result will be
coerced to a string and used as the new replacement text.

This also allows passing non-function, non-byteviewable values, which will be
converted into strings during replacement (only once, and only if at least
one match is found).
This commit is contained in:
Ian Henry
2023-04-22 23:40:32 -07:00
parent d9ed7a77f8
commit 485099fd6e
6 changed files with 79 additions and 16 deletions

View File

@@ -93,6 +93,7 @@ void janet_buffer_format(
Janet *argv);
Janet janet_next_impl(Janet ds, Janet key, int is_interpreter);
JanetBinding janet_binding_from_entry(Janet entry);
JanetByteView janet_text_substitution(Janet *subst, const uint8_t *bytes, uint32_t len);
/* Registry functions */
void janet_registry_put(