phino-0.0.152: test-resources/rewriter-packs/custom/sed.yaml
# SPDX-FileCopyrightText: Copyright (c) 2025 Objectionary.com
# SPDX-License-Identifier: MIT
---
input: |
[[
x -> " he llo ",
y -> "1234567891011",
z -> "Hello, 2025, 2026",
w -> "hi (jeff)"
]]
output: |-
⟦
x ↦ "hello",
y ↦ "11!",
z ↦ "Hello, 2025!, 2026!",
w ↦ "jeff hi",
o ↦ "((he(llo(("
⟧
rules:
custom:
- name: concat from expression
pattern: '[[ x -> !e1, y -> !e2, z -> !e10, w -> !e11 ]]'
result: '[[ x -> !e3, y -> !e4, z -> !e20, w -> !e21, o -> !e5 ]]'
where:
- meta: '!e3'
function: sed
args: ['!e1', '"s/\\s+//g"']
- meta: '!e4'
function: sed
args: ['!e2', '"s/(1)(2)(3)(4)(5)(6)(7)(8)(9)(10)(11)/$11!/g"']
- meta: '!e20'
function: sed
args: ['!e10', '"s/([0-9]+)/$1!/g"']
- meta: '!e21'
function: sed
args: ['!e11', '"s/(hi) \\((jeff)\\)/$2 $1"']
- meta: '!e5'
function: sed
args: ['!e1', '"s/\\s/(/g"']