J3/01-152r1 Page 1 of 3 Date: 22 March 2001 To: J3 From: John Reid/Rich Bleikamp Subject: Interpretation 10 (Meaning of embedded blanks in namelist input name) There is an ambiguity in the standard since the term 'name' is sometimes used in the namelist part of the standard when 'name or designator' is intended. Are spaces allowed inside a subobject designator in an input record such as &ABC LONG__NAME % LEVEL1 ( 20:30 ) % string = '123' / Here are two alternative draft answers corresponding to: Yes, but % is not allowed in a logical value No. I sent earlier drafts to the WG5 list for comments and would like thank those that helped me get to this version, specially Robert Corbett and Makki Takata. - - End of John Reid's comments - - - Interp notes that there are two different meanings of "name" in section 10.9, but believes that the usage of each "name" is consistent and clear. .............................................................. NUMBER: 000010 TITLE: Meaning of embedded blanks in namelist input name KEYWORDS: NAMELIST, optional qualification, name, input DEFECT TYPE: Clarification STATUS: J3 consideration in progress BACKGROUND: In running some older NAMELIST tests, a test case was encountered that has embedded blanks within the "optional qualification" following a namelist group object name: CHARACTER*10 string NAMELIST /junk/ string WRITE(9,*) ' $junk string( : ) = ''1234567890'' /' REWIND(9) READ(9,junk) ... END While studying the standard to determine if the above program was standard- conforming or not, some questions arose about the use of "name" and embedded blanks in the namelist section 10.9.1.1. Among them were: Since a blank is a delimiter, should it be allowed to be embedded in a variety of places in a namelist input record that are not currently described by the standard? Do we want to strain namelist input scanning more than a reasonable amount? J3/01-152r1 Page 2 of 3 In normal Fortran terminology, the term "name" does not include subobject qualification. In section 2.5.1 Name and designator, lines 2 through 5, the standard states: A name is used to identify a program constituent, such as a program unit, named variable, named constant, dummy argument, or derived type. The rules governing the construction of names are given in 3.2.1. A subobject designator is a name followed by one or more of the following: component selectors, array section, array element selectors, and substring selectors. In section 10.9.1 Namelist Input, lines 13 to 16, the standard states: In each name-value subsequence, the name shall be the name of a namelist group list item with an optional qualification and the name with the optional qualification shall not be a zero-sized array, a zero-sized array section, or a zero-length character string. The optional qualification, if any, shall not contain a vector subscript. In section 10.9.1.1 Namelist group object names, lines 32 and 33, the standard states: The name in the input record may be preceded and followed by one or more optional blanks but shall not contain embedded blanks. QUESTION: (1) Does Section 2.5.1 mean that the optional qualification described in the 10.9.1 is not part of the name for namelist input? If the optional qualification is not part of the name, there seem to be no rules for where blanks and end-of-record may occur within the optional qualification. Also note that size of the name and the optional qualification together may be longer than the size of an input record if there are multiple levels of structure component qualification in a structure component reference. (2) Are embedded blanks allowed within substring and subscript qualifications in the namelist input? May an END-OF-RECORD occur in these same places? (3) More specifically, are embedded blanks/END-OF-RECORD allowed in the following places in namelist input? a. Between the name and the left parenthesis of either a substring or subscript qualification? b. Between tokens within the parenthesized qualifier? c. Between the two sets of parentheses for array and substring notation? d. Within the two subscripts or start and end values themselves? (4) Are embedded blanks allowed within a reference to a structure? May an END-OF-RECORD occur within this reference? J3/01-152r1 Page 3 of 3 ANSWER: The answer to all of the questions above is no. In section 10.9.1, the standard says "In each name-value subsequence, the name shall be ...". This usage of "name" refers to the optionally qualified namelist group object list item; therefore, in this context, "name" refers to both the namelist group object name list item, and any following qualification. In section 19.9.1.1, the standard says "The name in the input record may be preceded and followed by one or more optional blanks but shall not contain embedded blanks." This usage of "name" also refers to optionally qualified namelist group object list item; therefore, no blanks are permitted anywhere within the "name" of a name-value subsequence. Since the end of a record has the same effect as a blank in namelist input (10.9), an end of record may not appear anywhere within the "name" of a name-value subsequence. EDITS: None SUBMITTED BY: Joanne Brixius / Larry Rolison HISTORY: J3/97-253 m143 submitted J3/01-152r1 m156 Draft J3 Response