|
You do not need the full "parser" for ILE RPG IV in order to strip
out comments.
Just create a "filter" -- a program that makes one pass over the
source code, writing the code without any comments to a temporary
source file member (e.g. in QTEMP), and then scan that for what you
are looking for.
The rules for RPG IV comments are pretty simple:
First, strip anything beyond column 80, that is, overlay that with
blanks, as those are always comments for "fixed form" RPG.
Start scanning in column 6.
If column 6 contains a " " (blank space) then the line is in "free
form" ...
If column 6 contains an "*" then the entire line is a comment line
-- either suppress the line entirely or just print a blank line.
If column 6 contains a non-blank (F, I, D, C, etc.) then if column 7
contains an "*" the entire line is a comment line -- either suppress
the line entirely or just print the line up through column 7.
Scan from left to right, starting at column 7, for "//" and if you
find it, blank out the "// and everything to the end of the line,
then write out that line.
Repeat the above for each source line in the input member, creating
a temporary member to be scanned "without comments" ...
Now, scan that using whatever tool(s) you want.
<<SNIP>>
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.