Text conversion (L551, L555 correction)
Scope: text NAME "..." declarations in the baseline converter (tools/bridge c|python,
modes C/P of src/toc.om). The seeded frontends (tools/bridge-seeded, all other modes)
refuse a text line with error 24 before reading its bytes. Only src/toc.om implements conversion.
- Lexing. A quote starts a text token only while
parse_txreads a declaration value (qtext), so note lines, cabi directives and every other line keep their earlier tokens. The span rules match the pinned seed'stok_text: the text ends at an unescaped quote on the same line; a raw LF, end of input inside the quotes or a non-blank byte right after the closing quote is error 22. Any further token on the declaration line is error 16 (the seed refuses it first, error 5). The token kind is 5 (kind 4 is a seeded float literal). - Decoding. Exactly
\n,\t,\\and\"are decoded; any other escape is error 22. Raw NUL, CR, tab and bytes 128-255 are kept. Decoded bytes go into one fixed 32,768-byte pool; overflow is error 14. Texts share the eight-entry global table with global arrays (error 14 beyond), each with its pool offset, uchar element type, exact length and a read-only flag. Empty text has length zero. - Access.
get,len,writeand readonlyviewarguments are accepted.put,readandeditarguments are refused (error 20), after the seed already refused them with the same code. Inline quoted expressions are refused by the seed (error 16) before the converter runs. - C output.
static const uint8_t gN[n]={b0,b1,...,};with decimal initializers only, so no source byte reaches target syntax, andstatic const uint64_t gN_n=n;, so neither the bytes nor the bound thato_getchecks can be changed or linked from outside the unit. Empty text uses a one-byte placeholder{0}with logical lengthgN_n=0, never an implicit terminator. Readonly view parameters (internal and exported) areconst void *. - Python output.
gN=bytes((b0,b1,...,)). An exported function's readonlyview ucharparameter acceptsbytesorbytearray; aneditparameter still requiresbytearray; other widths still require a list of valid values; length mismatches still return(8, None). - Notes. Outside cabi library modes,
tokskips a note body untokenized (skipline), as the seed does, so note bytes such as raw NUL no longer cause a converter-only error 16. Cabi library modes still read theirnote cabidirectives token by token. - Names and indices (L555 whole-core review). The converter itself refuses what the seed's
topnameands_fnrefuse, even whenbuild/bridgeruns without the seed in front: a text or global name longer than eight bytes (13); a text, global, function, parameter or local name that is a keyword (16; tablekwlist: the seed's 66 words from omc.om 29b12760fn kwin every mode, the seeded frontend's 93 further words from omega-mv e5b32567fn kwin seeded modes, and the 6 words draft-1049 adds in its modes E and J; OM-2-only and target-conditional words are left to the seeded frontend, which runs first intools/bridge-seeded); a text, global or function name that repeats another one in either order (10); and words after a global's count (16; the seed says 5). A parameter name is at most eight bytes (13) and may not repeat another parameter, a global or text declared above it, or any function (10, checked after the name scan and reported at that function's line, so cabi header and map modes refuse it too); a global or text declared below may share it, as in the seed. A literal index at or past a sized array's length is 21:geton any text (an empty one included) or global array, andputon a global array (putinto a text stays 20). Length 0 marks an unsized runtime view only for locals. Known conservative differences, unchanged: a local named like a global declared below its function is refused 7 (the seed accepts it); baseline function names of 9 to 63 bytes are refused 13.
Verification: python3 tests/text.py (native/C/Python byte and status agreement for 380 sources,
two targets each; 85 direct converter runs that bypass the seed: three accepted programs and 33
refusals in both baseline targets, a seeded-mode text refusal (24) and a seeded keyword parameter
(16, accepted in the baseline target) in seeded targets, a draft-1049 keyword parameter (16 in E,
accepted in D), and the cabi fixture accepted and a parameter named like a later function refused
(10 at the function's line) in library modes L, M and V; 16 controls:
valid compiled emitter mutants, emitted-storage and length mutants and library callers),
tools/test.sh (runs it), the seeded suites, evidence/text-native/ and the parent qualification
in evidence/text-parent-qualification/.