phino-0.0.152: test-resources/rewriter-packs/custom/sed-with-slashes.yaml
# SPDX-FileCopyrightText: Copyright (c) 2025 Objectionary.com
# SPDX-License-Identifier: MIT
---
input: |
[[
x -> "java/lang/Boolean",
y -> "()Ljava/lang/String;",
z -> "(Ljava/lang/String)Ljava/lang/Boolean",
w -> "java/lang/Integer"
]]
output: |-
⟦
x ↦ "java/lang/Integer",
y ↦ "invokevirtual",
z ↦ "invokestatic",
w -> "java\\/lang\\/Integer"
⟧
rules:
custom:
- name: sed with slashes
pattern: '[[ x -> !e1, y -> !e2, z -> !e3, w -> !e4 ]]'
result: '[[ x -> !e11, y -> !e22, z -> !e33, w -> !e44 ]]'
where:
- meta: '!e11'
function: sed
args:
- '!e1'
- '"s/java\\/lang\\/Boolean/java\\/lang\\/Integer/g"'
- meta: '!e22'
function: sed
args:
- 𝑒2
- '"s/\\(\\).+/invokevirtual/g"'
- '"s/\\(.+\\).+/invokestatic/g"'
- meta: '!e33'
function: sed
args:
- '!e3'
- '"s/\\(.+\\).+/invokestatic/g"'
- '"s/\\(\\).+/invokevirtual/g"'
- meta: '!e44'
function: sed
args:
- '!e4'
- '"s/\\//\\\\\\//g"'