all repos — hex @ eebdc95fcbf44a4adbb053ec7383290a47fee0f5

A tiny, minimalist, slightly-esoteric concatenative programming lannguage.

Enhanced doc.hex script to include mini-toc.
h3rald h3rald@h3rald.com
Thu, 11 Sep 2025 14:37:06 +0200
commit

eebdc95fcbf44a4adbb053ec7383290a47fee0f5

parent

bfa429736448d2d533116a407dbee9e4f9f8e7b2

4 files changed, 45 insertions(+), 15 deletions(-)

jump to
M lib/utils.hexlib/utils.hex

@@ -1,7 +1,15 @@

-;;;;; Standard Utilities (utils.hex) +;;;;;; utils.hex +;;;;; Standard Utilities (utils.hex)<a name="utils.hex"></a> ;;;;; This file contains a collection of standardized utility symbols extending the native symbols of the hex programming language. +;;;;; <ul> +;;;;; <li><a href="#utils.hex_input-output">Input/Output Symbols</a></li> +;;;;; <li><a href="#utils.hex_control-flow">Control Flow Symbols</a></li> +;;;;; <li><a href="#utils.hex_quotation">Quotation Symbols</a></li> +;;;;; <li><a href="#utils.hex_stack-management">Stack Management Symbols</a></li> +;;;;; <li><a href="#utils.hex_string">String Symbols</a></li> +;;;;; </ul> -;;;; Input/Output Symbols +;;;; <a name="utils.hex_input-output"></a>Input/Output Symbols ;;;; These additional symbols are used for input and output operations. ;;; dputs

@@ -11,7 +19,7 @@ (

dup puts ) "dputs" :: -;;;; Control Flow Symbols +;;;; <a name="utils.hex_control-flow"></a>Control Flow Symbols ;;;; These symbols are used for controlling the flow of execution in a program. ;;; unless

@@ -31,7 +39,7 @@ ()

if ) "when" :: -;;;; Quotation Symbols +;;;; <a name="utils.hex_quotation"></a>Quotation Symbols ;;;; These additional symbols are used for manipulating quotations. ;;; cons

@@ -349,7 +357,7 @@ "_unswons_result" #

"_unswons_c" # ) "unswons" :: -;;;; Stack Management Symbols +;;;; <a name="utils.hex_stack-management"></a>Stack Management Symbols ;;;; These additional symbols are used for manipulating the stack. ;;; dip

@@ -368,7 +376,7 @@ dup _over_a swap

"_over_a" # ) "over" :: -;;;; String Symbols +;;;; <a name="utils.hex_string"></a>String Symbols ;;;; These additional symbols are used for manipulating strings. ;;; begins
M scripts/doc.hexscripts/doc.hex

@@ -20,10 +20,25 @@ INFILE read "\n" split "LINES" :

"" "PREV" : "" "OUT" : +"" "ID" : LINES ( "LINE" : - (LINE ";;;;; " begins) + (LINE ";;;;;; " begins) + ; ID + ( + LINE ";;;;;; " "" sub "ID" : + "id" "PREV" : + ) + when + (LINE ";;;;; <" begins) + ; TOC + ( + LINE ";;;;; <" "" sub () cons "<${0}\n" swap fmt OUT swap cat "OUT" : + "tag" "PREV" : + ) + when + (LINE ";;;;; " begins "tag" PREV != and) ( ("h3" PREV ==) ; Paragraph after title

@@ -33,7 +48,7 @@ "p" "PREV" :

) ; H3 ( - LINE ";;;;; " "" sub () cons "<h3>${0}</h2>\n" swap fmt OUT swap cat "OUT" : + LINE ";;;;; " "" sub () cons "<h3>${0}</h3>\n" swap fmt OUT swap cat "OUT" : "h3" "PREV" : ) if

@@ -49,7 +64,7 @@ "p" "PREV" :

) ; H4 ( - LINE ";;;; " "" sub () cons "<h4>${0}</h3>\n" swap fmt OUT swap cat "OUT" : + LINE ";;;; " "" sub (ID) cons "<h4>${0}<a href=\"#${1}\">&uarr;</a></h4>\n" swap fmt OUT swap cat "OUT" : "h4" "PREV" : ) if

@@ -57,7 +72,7 @@ )

when (LINE ";;; " begins) ( - LINE ";;; " "" sub () cons "<h5 id=\"${0}-symbol\"><code><span class=\"hex-symbol\">${0}</span></code> Symbol</h5><a href=\"top\"></a>\n" swap fmt OUT swap cat "OUT" : + LINE ";;; " "" sub (ID) cons "<h5 id=\"${0}-symbol\"><code><span class=\"hex-symbol\">${0}</span></code> Symbol<a href=\"#${1}\">&uarr;</a></h5>\n" swap fmt OUT swap cat "OUT" : "sym" "PREV" : ) when

@@ -84,4 +99,5 @@

"OUT" # "PREV" # "LINES" # -"INFILE" # +"INFILE" # +"ID" #
M src/hex.csrc/hex.c

@@ -708,6 +708,7 @@ hex_item_t *orig_item = ctx->stack->entries[ctx->stack->top];

ctx->stack->entries[ctx->stack->top] = NULL; // Clear the stack reference ctx->stack->top--; + // Copying the item to avoid ownership issues when freeing hex_item_t *item = hex_copy_item(ctx, orig_item); hex_debug_item(ctx, " POP", item); return item;
M web/assets/styles.cssweb/assets/styles.css

@@ -157,10 +157,11 @@ background-color: #222;

field-sizing: content; color: white; display: flex; - margin: 1rem; + margin: 1rem; } -article input:focus, article textarea:focus { +article input:focus, +article textarea:focus { outline: none; }

@@ -222,11 +223,15 @@ article nav {

font-size: 90%; } -a[href^="#top"]::before { +h3 [href^="#top"]::before, +h4 [href^="#top"]::before, +h5 [href^="#top"]::before { content: "↑ "; } -a[href^="#top"] { +h3 a[href], +h4 a[href], +h5 a[href] { font-size: 80%; text-decoration: none; vertical-align: super;