On 15/12/2009, at 6:47 AM, Dennis Lovelady wrote:
Is it special programming, or is there a rule that would help here?
I presume it's access to the command definition object that makes this
work. The parser is not already in a comment area, it finds a space-
delimited token (DSPOBJD), checks if it is a *CMD object, if so it
interrogates the CDO and applies the "rules" of the command parameters
to the data. Certain general rules also apply such as parameters are
separated by spaces, parameter values cannot contain spaces unless
quoted etc.
Thus in your example, the first slash is embedded in the second token
therefore is a qualified name. DSPOBJD supports a qualified name for
its first parameter so the parser applies it as such. It does not
mistake the embedded /* of MYLIB/*ALL as a comment because:
1) The CDO indicates a qualified name is allowed
2) The CDO indicates *ALL is an allowed special value
For a generalised text parser without access to the CDO you'd have to
set some rules that are likely not onerous such as the opening /* of a
comment must have a space either before or after it. Most programmers
are likely to this anyway because it makes the code tidier. For example:
dspobjd mylib/*all *jobq /* Show the object information */
vs.
dspobjd mylib/*all *jobq /*Show the object information*/
vs.
dspobjd mylib/*all *jobq/*Show the object information*/
The CL parser will accept the 3rd example but I don't know anyone who
would write code like that.
Applying such rules will make your parser different from the CL one
and therefore some coding styles could break it but I think that's the
best you can do.
Regards,
Simon Coulter.
--------------------------------------------------------------------
FlyByNight Software OS/400, i5/OS Technical Specialists
http://www.flybynight.com.au/
Phone: +61 2 6657 8251 Mobile: +61 0411 091 400 /"\
Fax: +61 2 6657 8251 \ /
X
ASCII Ribbon campaign against HTML E-Mail / \
--------------------------------------------------------------------
As an Amazon Associate we earn from qualifying purchases.