From 8745f421b4cf7e1d54c17a360d46fab889ca12cc Mon Sep 17 00:00:00 2001 From: _ov4 Date: Thu, 22 Oct 2026 15:33:17 +0000 Subject: feat(input)!: validate INPUT and read whole lines into STRING Scalar INPUT now reads one whitespace-delimited token through module-local IR helpers instead of scanf, then skips spaces and tabs and consumes one newline. INTEGER, REAL, BOOLEAN (TRUE or FALSE in any case) and CHAR are validated, and bad input or end of input is a runtime error. STRING INPUT reads the rest of the line. The unused scanf and REAL printf format globals are removed. Co-Authored-By: Claude Sonnet 5.5 --- tests/ii/files/program.cps | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'tests/ii/files/program.cps') diff --git a/tests/ii/files/program.cps b/tests/ii/files/program.cps index f825118..a9f22c0 100644 --- a/tests/ii/files/program.cps +++ b/tests/ii/files/program.cps @@ -3,12 +3,19 @@ DECLARE Index : INTEGER DECLARE Text : STRING DECLARE Extra : STRING DECLARE Line : STRING +DECLARE Pair : STRING +DECLARE Cut : INTEGER DECLARE Combined : STRING DECLARE Lines : INTEGER INPUT Count FOR Index <- 1 TO Count - INPUT Text - INPUT Extra + INPUT Pair + Cut <- 1 + WHILE MID(Pair, Cut, 1) <> " " + Cut <- Cut + 1 + ENDWHILE + Text <- LEFT(Pair, Cut - 1) + Extra <- RIGHT(Pair, LENGTH(Pair) - Cut) OPENFILE "roundtrip.txt" FOR WRITE WRITEFILE "roundtrip.txt", Text WRITEFILE "roundtrip.txt", "" -- cgit v1.3.1-4-g156e