parse/constants
All checks were successful
/ job (push) Successful in 4m27s

This commit is contained in:
Marc Beninca 2025-07-04 00:47:18 +02:00
parent 6a73a8a740
commit 8fd6beed11
Signed by: marc.beninca
GPG key ID: 9C7613450C80C24F

View file

@ -46,6 +46,8 @@ rwx_main() {
fi
# source user root
rwx_source "${RWX_SELF_USER}"
# parse code cache
rwx_parse
# context / command
if [ -n "${RWX_COMMAND_NAME}" ]; then
"${RWX_SELF_COMMAND}${RWX_COMMAND_NAME}" "${@}"
@ -201,14 +203,24 @@ rwx_find_shell() {
rwx_parse() {
local ws="[[:space:]]*"
local start="^${ws}"
local constant="[_A-Z][_0-9A-Z]*"
local setting="=.*"
local fn="${ws}(${ws})${ws}{"
local id="[_a-zA-Z][_a-z0-9A-Z]*"
local line
rwx_ifs_set
RWX_CONSTANTS=""
for line in $(echo "${RWX_CODE}" |
grep "${start}${constant}${setting}" |
sed "s|${start}\\(${constant}\\)${setting}|\\1|"); do
RWX_CONSTANTS="${RWX_CONSTANTS}${line}
"
done
RWX_FUNCTIONS=""
for line in $(echo "${RWX_CODE}" |
grep "^${ws}${id}${fn}" |
sed "s|^${ws}\\(${id}\\)${fn}.*|\\1|"); do
grep "${start}${id}${fn}" |
sed "s|${start}\\(${id}\\)${fn}.*|\\1|"); do
RWX_FUNCTIONS="${RWX_FUNCTIONS}${line}
"
done