Characters that killed a render, what may sit next to a klammer, and ref/

A character written in the ^...^ mnemonic form -- ^oe^, ^zz^, ^hello^ --
used to kill ktext outright: no message, no output, and an exit status
that looked like a crash because it was one.  Only the forms that happen
to spell hexadecimal digits escaped, and they were right by luck rather
than by reading.  Any caret form that names no character is now a located
error that quotes what was written.

A klammer may now sit inside square brackets and braces as it already
could inside parentheses, and may be followed by the punctuation that
ends a sentence: [@i word@], {@b word@}, @i word@'s.  The rule is a fixed
list of characters, because none of them can occur inside a klammer name
and so none of them is ambiguous next to a delimiter.  A letter still
cannot: "x@" is the named closing delimiter, so a letter before "@" has
two readings and no rule can separate them.

The abbreviations an author writes -- the hyphen form @i-word, a klammer
glued to its neighbouring punctuation -- are now recognised as author
conveniences only.  They are not applied to @@ definitions or @@@ system
commands, which are written by someone who needs no such shorthand and
whose forms are already whole.

Also fixed, each of them silent: an exported shell function in the
environment broke every @eval in the document; a line break written with
@nl was destroyed when it passed through a klammer that generates a
table, printing as \textbackslash{}newline in the finished PDF; and
"kdesc --coverage" shortened its file column by comparing the spelling of
a path rather than the path, so a klammer set reached by a symbolic link
showed a full path where its neighbours showed a short one.

New in the distribution: ref/, a small klammerset that describes the
Klammermachine's own tables in Klammertext.  It currently provides the
character tables -- the diacritics and the extended Latin letters -- as
klammers that render to any target, so the documentation of what can be
written cannot drift from what the machine accepts.  It is early, and
will grow.

The Klammertext taxonomy now has a section on targets, describes the
@@@klammerset system command alongside the other three, and states the
precedence of "^" -- what a caret means before a letter, a digit, a
punctuation character, and a quote, in one ordered list.

(from dev 6594c7ff8c1f)
This commit is contained in:
ack committed 2026-09-07 22:37:05 +02:00
1 parent b80e823ab3
commit e4f1307aa9
53 files changed
+2014 -350

No files matched your search

+50
View File
@@ -121,6 +121,56 @@ check "17c. structural code points are re-read-safe" '@@' '^0040 0040^'
check_err "17d. invalid code point in a CLOSED sequence" 'in a ^...^ sequence' '^263A FFFFFF^'
check "17e. unclosed hex-like prose is untouched" 'about ^263A FFFFFF prose' 'about ^263A FFFFFF prose'
echo
echo "-- the delimited mnemonic form ^x^ (multi-letter entries, and a form"
echo " that names no character at all)"
# The two-letter mnemonics had NO lexical rule: the nonascii katom pattern
# offered "^Xy" and "^<hex>{1,6}^", and "oe" is neither. So "^oe^" matched
# no katom type, fell through to the "non-diacritic non-ascii" rewrite rule
# -- which pads the word with whitespace and hands back the SAME single
# word -- and make_katoms_from_word() recursed on it until the stack died:
# SIGSEGV, no message, exit 139. ^ae^ and ^AE^ appeared to work only
# because "ae" happens to be hex digits, so they were lexed as CODE POINTS
# and rendered correctly only because encode() runs process_extended_latin()
# before process_unicode_codepoint(); reversing those two passes would have
# turned ^ae^ into U+00AE. Cases 20-22 pin the mnemonics, 23-25 the forms
# that resolve to nothing. A crash must never read as a pass, so 20a
# distinguishes a signal death from an error exit explicitly.
check "20. two-letter mnemonic" 'œ' '^oe^'
check "21. two-letter mnemonic, capital" 'Œ' '^OE^'
check "22. hex-spelled mnemonic is the MNEMONIC, not U+00AE" 'æ' '^ae^'
check "22a. mnemonic in running text" 'cœur' 'c^oe^ur'
# 20a: exit 139 (128+SIGSEGV) rather than a clean status is the failure
# this suite exists to catch, and check_err alone cannot tell them apart.
"$KTEXT" --klammersets none -s '^oe^' -d >/dev/null 2>&1; st=$?
if [ $st -ge 128 ]; then
echo "${red}FAIL${reset} 20a. ^oe^ dies on a signal (exit $st)"
FAIL=$((FAIL+1))
else
echo "${green}PASS${reset} 20a. ^oe^ does not die on a signal"
PASS=$((PASS+1))
fi
# 25a: the katomizer's rewrite loop must terminate on a word no rule can
# decompose. "^\s" is such a word -- rule "diacritic non-ascii" matches it
# whole (its [a-zA-z] range spans ASCII 65-122 and so includes the
# backslash), pads it with spaces, and hands the same word back. It killed
# kdiag until 2026-08-30. Not a character-form case at heart, but this is
# where the class is pinned.
"$KTEXT" --klammersets none -s '^\s' -d >/dev/null 2>&1; st=$?
if [ $st -ge 128 ]; then
echo "${red}FAIL${reset} 25a. a barren rewrite rule terminates (exit $st)"
FAIL=$((FAIL+1))
else
echo "${green}PASS${reset} 25a. a barren rewrite rule terminates"
PASS=$((PASS+1))
fi
check_err "23. a form naming no character is an error" 'is not a character code' '^zz^'
check_err "24. ... at any length the lexer accepts" 'is not a character code' '^hello^'
check_err "25. ... letters and digits mixed" 'is not a character code' '^g1^'
echo
echo "-- direct entry and NFC convergence"
check "18. pinyin tone is precomposed" 'ā' '^a1'