program nestbug(output); (* nestbug: bugs in gpcc with the use of --nested-comments
Dr. Thomas D. Schneider National Cancer Institute Laboratory of Experimental and Computational Biology Frederick, Maryland 21702-1201 toms@ncifcrf.gov permanent email: toms@alum.mit.edu http://www.lecb.ncifcrf.gov/~toms/
*)
label 1; (* end of program *)
const (* begin module version *) version = 1.00; (* of nestbug.p 2000 July 11 1.00; 2000 July 11 origin *) updateversion = 1.00; (* defines lowest acceptable current parameter file *) (* end module version *)
(* begin module describe.nestbug *) (* name nestbug: bugs in gpcc with the use of --nested-comments
synopsis nestbug(output: out)
files
output: messages to the user
description
This code demonstrates a bug in gpc:
GNU Pascal version 20000707, based on gcc-2.95.2 19991024 (release).
which when called on this program as:
gpc --standard-pascal --nested-comments --transparent-file-names $nestbug.p -o $nestbug
will object as follows:
nestbug.p:54: parse error before `Documentation'
because, although the --nested-comments is on, it still can't handle this unbalanced right curlie bracket: }
examples
documentation
see also
{GPC will also object to the } shell.p {program at} http://www.lecb.ncifcrf.gov/~toms/delila/shell.html
author
Thomas Dana Schneider
bugs
1. See above.
2. ADDITIONAL BUG: Note also that GPC capitalizes the word "Documentation", which is confusing and it should not do. Someone doing a case sensitive search would not find the problem! This occurs in other places in the code. GPC should NEVER change cases!!!! (Oh, I see. In German one capitalizes nouns. Perhaps this is why you thought to do it. The rest of the world does not and it will cause confusion and trouble. How about creating a --German command line option? :-)
3. The use of the unbalanced bracket was legitimate in the shell program as part of a quoted string inside the documentation comments.
{ I infer that when comments are parsed gpc does not remember the kind of starting comment. It should recall that the comment of this documentation began with a left-parenthesis-astrisk, and so should ignore everything until it encounters an astrisk-right parenthesis. Apparently it doesn't and is sensitive to the curlie brackets. (The reverse should hold inside a curlie bracket comment of course.) }
4. If the curlies around the above paragraph are deleted, the message is:
nestbug.p:92: unterminated string or character constant nestbug.p:83: possible real start of unterminated constant
The program is sensitive to single quote marks! I had the word "doesn't" in the bugs section, and it blocked the case mentioned above! The curlie brackets above protect the single quote!
The whole comment skipping code needs a careful overhaul!
It should not be looking at quotes at all during comment skipping!
technical notes
The program does a successful goto to the end of the code from the halt routine, so that bug is FIXED. :-) :-) Thank you!
*) (* end module describe.nestbug *)
(* begin module halt *) procedure halt; (* stop the program. the procedure performs a goto to the end of the program. you must have a label: label 1; declared, and also the end of the program must have this label: 1: end. examples are in the module libraries. this is the only goto in the delila system. *) begin writeln(output,' program halt.'); goto 1 end; (* end module halt version = 'delmod 6.16 84 mar 12 tds/gds'; *)
(* begin module nestbug.themain *) procedure themain; (* the main procedure of the program *) var parameterversion: real; (* parameter version number *) begin writeln(output,'nestbug ',version:4:2);
halt;
end; (* end module nestbug.themain *)
begin themain; 1: end.