code/vars
This commit is contained in:
parent
40bd26f9ce
commit
45f0ebbb9b
2 changed files with 17 additions and 27 deletions
24
sh/code.sh
24
sh/code.sh
|
@ -6,8 +6,18 @@
|
||||||
# │ code │ variables │
|
# │ code │ variables │
|
||||||
# ╰──────┴───────────╯
|
# ╰──────┴───────────╯
|
||||||
|
|
||||||
# path to the required parsing awk script
|
# cache for the parsing awk script
|
||||||
_rwx_code_awk="$(cat "${RWX_ROOT_SYSTEM}/code.awk")"
|
_rwx_code_awk="$(cat "${RWX_ROOT_SYSTEM}/code.awk")"
|
||||||
|
# cache for code aliases
|
||||||
|
_rwx_code_aliases=""
|
||||||
|
# cache for code aliases functions
|
||||||
|
_rwx_code_aliases_functions=""
|
||||||
|
# cache for code constants
|
||||||
|
_rwx_code_constants=""
|
||||||
|
# cache for code functions
|
||||||
|
_rwx_code_functions=""
|
||||||
|
# cache for code variables
|
||||||
|
_rwx_code_variables=""
|
||||||
|
|
||||||
# ╭──────┬───────╮
|
# ╭──────┬───────╮
|
||||||
# │ code │ parts │
|
# │ code │ parts │
|
||||||
|
@ -19,6 +29,11 @@ rwx_code() {
|
||||||
echo "${_rwx_code}"
|
echo "${_rwx_code}"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# show the cached awk script
|
||||||
|
rwx_code_awk() {
|
||||||
|
echo "${_rwx_code_awk}"
|
||||||
|
}
|
||||||
|
|
||||||
# show the cached aliases
|
# show the cached aliases
|
||||||
#= rca
|
#= rca
|
||||||
rwx_code_aliases() {
|
rwx_code_aliases() {
|
||||||
|
@ -31,11 +46,6 @@ rwx_code_aliases_functions() {
|
||||||
echo "${_rwx_code_aliases_functions}"
|
echo "${_rwx_code_aliases_functions}"
|
||||||
}
|
}
|
||||||
|
|
||||||
# show the cached awk script
|
|
||||||
rwx_code_awk() {
|
|
||||||
echo "${_rwx_code_awk}"
|
|
||||||
}
|
|
||||||
|
|
||||||
# show the cached constants
|
# show the cached constants
|
||||||
#= rcc
|
#= rcc
|
||||||
rwx_code_constants() {
|
rwx_code_constants() {
|
||||||
|
@ -73,7 +83,7 @@ rwx_code_check() {
|
||||||
rwx_code_doc() {
|
rwx_code_doc() {
|
||||||
local name="${1}"
|
local name="${1}"
|
||||||
[ -n "${name}" ] || return
|
[ -n "${name}" ] || return
|
||||||
printf "%s" "${_rwx_code}" |
|
rwx_code |
|
||||||
awk \
|
awk \
|
||||||
--assign action="doc" \
|
--assign action="doc" \
|
||||||
--assign target="${name}" \
|
--assign target="${name}" \
|
||||||
|
|
20
sh/main.sh
20
sh/main.sh
|
@ -181,26 +181,6 @@ rwx_find_shell() {
|
||||||
# │ main │ parse │
|
# │ main │ parse │
|
||||||
# ╰──────┴───────╯
|
# ╰──────┴───────╯
|
||||||
|
|
||||||
RWX_REGEX_CONSTANT="[_A-Z][_0-9A-Z]*"
|
|
||||||
RWX_REGEX_FUNCTION="[_A-Za-z][_0-9A-Za-z]*"
|
|
||||||
RWX_REGEX_SET="=.*"
|
|
||||||
RWX_REGEX_SPACES="[[:space:]]*"
|
|
||||||
RWX_REGEX_VARIABLE="[_a-z][_0-9a-z]*"
|
|
||||||
|
|
||||||
RWX_REGEX_BEGIN="^"
|
|
||||||
RWX_REGEX_OPEN="\
|
|
||||||
${RWX_REGEX_SPACES}(${RWX_REGEX_SPACES})${RWX_REGEX_SPACES}{.*"
|
|
||||||
|
|
||||||
RWX_REGEX_TARGET_CONSTANT="\
|
|
||||||
${RWX_REGEX_BEGIN}\\(${RWX_REGEX_CONSTANT}\\)${RWX_REGEX_SET}"
|
|
||||||
RWX_REGEX_TARGET_FUNCTION="\
|
|
||||||
${RWX_REGEX_BEGIN}\\(${RWX_REGEX_FUNCTION}\\)${RWX_REGEX_OPEN}"
|
|
||||||
RWX_REGEX_TARGET_VARIABLE="\
|
|
||||||
${RWX_REGEX_BEGIN}\\(${RWX_REGEX_VARIABLE}\\)${RWX_REGEX_SET}"
|
|
||||||
|
|
||||||
# cache for code variables
|
|
||||||
_rwx_code_variables=""
|
|
||||||
|
|
||||||
rwx_parse_code() {
|
rwx_parse_code() {
|
||||||
# parse aliases
|
# parse aliases
|
||||||
_rwx_code_aliases="$(rwx_parse_aliases)"
|
_rwx_code_aliases="$(rwx_parse_aliases)"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue