_rwx_code

This commit is contained in:
Marc Beninca 2025-07-06 05:59:23 +02:00
parent 1b077ac89a
commit 0ef18c113e
Signed by: marc.beninca
GPG key ID: 9C7613450C80C24F
2 changed files with 10 additions and 5 deletions

View file

@ -64,6 +64,9 @@ rwx_main() {
# │ main │ cache │
# ╰──────┴───────╯
# cache of all sourced code modules
_rwx_code=""
# cache source code of a module
# inside a global code variable
rwx_cache() {
@ -74,7 +77,7 @@ rwx_cache() {
local text
text="$(cat "${path}")"
# all source code
RWX_CODE="${RWX_CODE}\
_rwx_code="${_rwx_code}\
#. ${name}
${text}
"
@ -187,11 +190,11 @@ rwx_parse_code() {
RWX_FUNCTIONS="$(rwx_parse_functions)"
}
rwx_parse_constants() {
printf "%s\n" "${RWX_CODE}" |
printf "%s\n" "${_rwx_code}" |
sed --silent "s|${RWX_REGEX_TARGET_CONSTANT}|\\1|p"
}
rwx_parse_functions() {
printf "%s\n" "${RWX_CODE}" |
printf "%s\n" "${_rwx_code}" |
sed --silent "s|${RWX_REGEX_TARGET_FUNCTION}|\\1|p"
}
@ -211,6 +214,8 @@ rwx_test() {
\
"RWX_MAIN_NAME" \
\
"_rwx_code" \
\
"rwx_cache" \
\
"gsc"