Creates a new `READ` command.
(index: Rc<RefCell<usize>>)
| 66 | impl ReadCommand { |
| 67 | /// Creates a new `READ` command. |
| 68 | pub fn new(index: Rc<RefCell<usize>>) -> Rc<Self> { |
| 69 | Rc::from(Self { |
| 70 | metadata: CallableMetadataBuilder::new("READ") |
| 71 | .with_syntax(&[( |
| 72 | &[], |
| 73 | Some(&RepeatedSyntax { |
| 74 | name: Cow::Borrowed("vref"), |
| 75 | type_syn: RepeatedTypeSyntax::VariableRef, |
| 76 | sep: ArgSepSyntax::Exactly(ArgSep::Long), |
| 77 | require_one: true, |
| 78 | allow_missing: false, |
| 79 | }), |
| 80 | )]) |
| 81 | .with_category(CATEGORY) |
| 82 | .with_description( |
| 83 | "Extracts data values from DATA statements. |
| 84 | DATA statements can appear anywhere in the program and they register data values into an array of \ |
| 85 | values. READ is then used to extract values from this array into the provided variables in the \ |
| 86 | order in which they were defined. In other words: READ maintains an internal index into the data \ |
| 87 | array that gets incremented by the number of provided variables every time it is executed. |
| 88 | The variable references in the vref1..vrefN list must match the types or be compatible with the \ |
| 89 | values in the corresponding position of the data array. Empty values in the data array can be \ |
| 90 | specified by DATA, and those are converted into the default values for the relevant types: \ |
| 91 | booleans are false, numbers are 0, and strings are empty. |
| 92 | Attempting to extract more values than are defined by DATA results in an \"out of data\" error. |
| 93 | The index that READ uses to extract DATA values can be reset by RESTORE and, more generally, by \ |
| 94 | CLEAR.", |
| 95 | ) |
| 96 | .build(), |
| 97 | index, |
| 98 | }) |
| 99 | } |
| 100 | } |
| 101 | |
| 102 | #[async_trait(?Send)] |
nothing calls this directly
no test coverage detected