[flang] Support NAMELIST input of short arrays
NAMELIST array input does not need to fully define an array. If another input item begins after at least one element, it ends input into the array and the remaining items are not modified. The tricky part of supporting this feature is that it's not always easy to determine whether the next non-blank thing in the input is a value or the next item's name, esp. in the case of logical data where T and F can be names. E.g., &group logicalArray = t f f t = 1 / should read three elements into "logicalArray" and then read an integer or real variable named "t". So the I/O runtime has to do some look-ahead to determine whether the next thing in the input is a name followed by '=', '(', or '%'. Since the '=' may be on a later record, possibly with intervening NAMELIST comments, the runtime has to support a general form of saving and restoring its current position. The infrastructure in the I/O runtime already has to support repositioning for list-directed repetition, even on non-positionable input sources like terminals and sockets; this patch adds an internal RAII API to make it easier to save a position and then do arbitrary look-ahead. Differential Revision: https://reviews.llvm.org/D112245
Loading
Please sign in to comment