diff options
| author | _ov4 <ov4@ov4.org> | 2026-10-22 15:32:49 +0000 |
|---|---|---|
| committer | _ov4 <ov4@ov4.org> | 2026-10-22 15:32:49 +0000 |
| commit | 713a313b06256a13ddefa5e257e3b80f8aa808ba (patch) | |
| tree | 0288e9e9e44b9765cf2285fa3adaf82963612180 /pseudocode-lib/string.cps | |
| parent | 5a5a14be5e2683a42906da4b2ad19690e230c871 (diff) | |
feat(codegen): convert implicitly between CHAR and STRING
A CHAR becomes a one-character STRING in &, comparisons, assignment,
parameter passing and RETURN. A STRING becomes a CHAR in assignment,
parameter passing and RETURN, with a runtime error when its length is
not 1. CHAR with INTEGER or BOOLEAN still does not convert.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Diffstat (limited to 'pseudocode-lib/string.cps')
| -rw-r--r-- | pseudocode-lib/string.cps | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/pseudocode-lib/string.cps b/pseudocode-lib/string.cps index 41181c4..a118326 100644 --- a/pseudocode-lib/string.cps +++ b/pseudocode-lib/string.cps @@ -52,6 +52,9 @@ CLASS STRING OVERLOAD PROCEDURE OPERATOR<-(Text : C_STRING) CALL _string_impl_assign_cstr(_HANDLE, Text) ENDPROCEDURE + FUNCTION _LENGTH() RETURNS INTEGER + RETURN (INTEGER)_string_impl_length(_HANDLE) + ENDFUNCTION FUNCTION C_STR() RETURNS C_STRING RETURN _string_impl_c_str(_HANDLE) ENDFUNCTION |
