aboutsummaryrefslogtreecommitdiff
path: root/doc/language
diff options
context:
space:
mode:
author_ov4 <ov4@ov4.org>2026-10-17 05:09:23 +0000
committer_ov4 <ov4@ov4.org>2026-10-17 05:09:23 +0000
commitf282535399a0c5cae8f6965bb32f449f834c0757 (patch)
treeb37b6024fd94b922a82d6b7938d3a671f877fddb /doc/language
parenta6b8afcfb61e1d321405fe8713beaec2aa6320a2 (diff)
docs(input): document array and member targets
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Diffstat (limited to 'doc/language')
-rw-r--r--doc/language/cpsc-language-overview.7.md2
-rw-r--r--doc/language/keyword/cpsc-keyword-input.7.md29
2 files changed, 24 insertions, 7 deletions
diff --git a/doc/language/cpsc-language-overview.7.md b/doc/language/cpsc-language-overview.7.md
index 233e9ef..8838b7f 100644
--- a/doc/language/cpsc-language-overview.7.md
+++ b/doc/language/cpsc-language-overview.7.md
@@ -67,7 +67,7 @@ Closing and auxiliary keywords are documented with their main constructs: THEN/E
# UNSUPPORTED FEATURES
-DATE, SET types and DEFINE, random-file operations (RANDOM/SEEK/GETRECORD/PUTRECORD), INT, RAND, INPUT into array elements or fields, string escapes, whole-array assignment or return, array fields, and class methods/constructors/destructors/inheritance (NEW/INHERITS/SUPER).
+DATE, SET types and DEFINE, random-file operations (RANDOM/SEEK/GETRECORD/PUTRECORD), INT, RAND, string escapes, whole-array assignment or return, array fields, and class methods/constructors/destructors/inheritance (NEW/INHERITS/SUPER).
The individual pages note relevant differences from the Cambridge 2026 pseudocode guide. This manual describes the compiler's current support.
diff --git a/doc/language/keyword/cpsc-keyword-input.7.md b/doc/language/keyword/cpsc-keyword-input.7.md
index c1ec905..4c6c309 100644
--- a/doc/language/keyword/cpsc-keyword-input.7.md
+++ b/doc/language/keyword/cpsc-keyword-input.7.md
@@ -7,21 +7,38 @@ cpsc-keyword-input - read a value from standard input
# SYNOPSIS
```text
-INPUT variable
+INPUT target
```
# DESCRIPTION
-Read into a previously declared INTEGER, REAL, BOOLEAN, CHAR, or STRING variable. STRING input reads one whitespace-delimited word. The target must be a plain variable; array elements and record/class fields are unsupported, unlike the wider INPUT syntax in guide section 5.1.
+Read into an INTEGER, REAL, BOOLEAN, CHAR, or STRING location: a previously declared variable, an individual array element, or a public record/class field, as allowed by guide section 5.1. Nested fields, fields of array elements and pointer dereferences are supported through the existing access syntax. STRING input reads one whitespace-delimited word.
-Native C scalar variables are also supported, using their actual widths and signedness. Plain C char reads a character; signed/unsigned char read numbers. C _Bool reads a number and stores whether it is nonzero. C pointers, including C_STRING, cannot be INPUT targets. See [cpsc-keyword-c_type(7)](cpsc-keyword-c_type.7.md).
+Native C scalar targets are also supported, using their actual widths and signedness. Plain C char reads a character; signed/unsigned char read numbers. C _Bool reads a number and stores whether it is nonzero. C pointers, including C_STRING, cannot be INPUT targets. See [cpsc-keyword-c_type(7)](cpsc-keyword-c_type.7.md).
+
+The target address is evaluated once per INPUT execution, before reading the value. Array bounds, unset pointers and private fields are checked as for assignment. Constants, whole arrays, whole records/classes, enums and pointer values cannot be INPUT targets. A dereferenced pointer may select a supported target type.
# EXAMPLE
```text
-DECLARE Name : STRING
-INPUT Name
-OUTPUT Name
+DECLARE Scores : ARRAY[1:3] OF INTEGER
+DECLARE j : INTEGER
+FOR j <- 1 TO 3
+ INPUT Scores[j]
+NEXT j
+OUTPUT Scores
+
+TYPE Student
+ DECLARE Score : INTEGER
+ENDTYPE
+CLASS Box
+ Value : INTEGER
+ENDCLASS
+DECLARE Person : Student
+DECLARE Item : Box
+INPUT Person.Score
+INPUT Item.Value
+OUTPUT Person.Score, ":", Item.Value
```
# SEE ALSO