On Mon, 8 Sep 2008, Andrew Armstrong wrote: > I'm with you - comments are problematic, but you could track the original > physical structure by emitting sequences of attributes as they are found on > each line. For example, > > //INPUT DD DSN=MY.DATASET, This is a required > // BLKSIZE=3120, input dataset > // RECFM=FB,LRECL=80 and it must be FB > > ...could be parsed into something like: > > <dd name="INPUT"> > <line> > <dsn>MY.DATASET</dsn> > <comment>This is a required</comment> > </line> > <line> > <blksize>3120</blksize> > <comment>input dataset</comment> > </line> > <line> > <recfm>FB</recfm> > <lrecl>80</lrecl> > <comment>and it must be FB</comment> > </line> > </dd>
The problem is that my lexer code, in the YY_INPUT, loads the Flex buffer with ONLY the logical line, without comments. In your example, what YY_INPUT would place in the buffer would look like: //INPUT DD DSN=MY.DATASET,BLKSIZE=3120,RECFM=FB,LRECL=80 The code also detects the "//*" comment and simply ignores it, reading the next card from the input stream. This really helps if somebody does: //INPUT DD DSN=MY.DATASET, //*THE ABOVE IN THE INPUT DATASET NAME // DISP=OLD //* AND I NEED EXCLUSIVE USE TO IT Which would be a real PITA, for me, to handle in the actual Bison parser logic. I am trying to be as general as I can. And I'm thinking more in terms of a compiler than anything else. Comments are just not important to a compiler. > <SNIP> > The JCL2XML rexx (in CBT File 647) implements a compromise by discarding all > but the last comment on a logical statement, producing a more condensed (but > lossy): I didn't even realize there was such a file. Thanks! > For comments that are meant to actually document a JCL's function then > perhaps a convention like javadoc would be useful. At the job and step level > you could code "jcldoc" comments something like: > <snip> My "intent" was to create XML which could then be used as desired. But it would be more like a compiler or the JCL converter. It would not retain comments at all. Comments are "free form" and don't really give any information to a computer. They are only useful to humans. Sometimes. Maybe. <grin> -- Q: What do theoretical physicists drink beer from? A: An EIN stein. Maranatha! John McKown ---------------------------------------------------------------------- For IBM-MAIN subscribe / signoff / archive access instructions, send email to [EMAIL PROTECTED] with the message: GET IBM-MAIN INFO Search the archives at http://bama.ua.edu/archives/ibm-main.html

